Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use YUI calendar in Java Wicket?

Tags:

java

yui

wicket

My question is not so hard, i think. But it does not change the fact that i dont know how to do it :) Anyway, how can i use yui calendar object in my wicket page? i have tried some codes in java codes, but i got some errors, so i need your precious help. Thanks.

like image 395
user500129 Avatar asked Dec 18 '10 01:12

user500129


1 Answers

Its is as simple as this:

...
import org.apache.wicket.extensions.markup.html.form.DateTextField;
import org.apache.wicket.extensions.yui.calendar.DatePicker;
...
DateTextField df = new DateTextField('wicketID', dateModel, "yy.DD.mm");
df.add(new DatePicker());
form.add(df);

Basicaly, you construct a normal DateTextField and add the YUI Picker to it. thats about all.

enjoy

Edit: to answer the questions in the comments:

user500129: are you using maven as build tool? i strongly suggest it to you. if you do, you find the yoi components in the wicket-datetime artefact. The relevant maven dependency is:

<dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-extensions</artifactId>
        <version>${wicket.version}</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>

If you are not using maven, you can download the jar from the maven repository, for wicket.14.14 this would be the correct link: http://mvnrepository.com/artifact/org.apache.wicket/wicket-datetime/1.4.14

hope that helps

like image 198
bert Avatar answered Oct 03 '22 02:10

bert