SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 260 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

get(Calendar.YEAR);
}
public void setYear(int year)
{
c.set(Calendar.YEAR, year);
date = c.getTime();
}
}
Chapter 8
[ 217 ]
The code is pretty simple, mostly just getters and setters, and there is only one thing
that might be worth commenting on??”the use of @SetupRender annotation. It simply
marks the method that we want to be invoked before the component is rendered.
This gives us an opportunity to do any preparations. In this case, we are making
sure that the Calendar instance we are using for convenience is set either to the date
parameter or, if the parameter is null, to the current date and time.
We can now put the new DateInput component onto any page and see if it works.
Here is how it can be declared:

Date test:

Don't forget to add a page property of java.util.Date type to provide an initial
value to the component and to store the user's input.
Run the application, and you should see that the component works as expected.
We had to put it inside of the Form component, as the Select components used to
construct the DateInput will not work otherwise. But still, our new creation isn't a
full member of the family of Tapestry components.


Pages:
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6