Re: [Wicket-user] Not sure how to use DatePicker component
I just asked on the developer list http://www.nabble.com/replacement-for-date-picker-tf3162478.html Eelco On 2/2/07, Scott Swank <[EMAIL PROTECTED]> wrote: > Nice, thank you. Where does the process to replace DatePicker stand? > > > On 2/2/07, Eelco Hillenius <[EMAIL PROTECTED] > wrote: > > The date converter is being phased out because it is messy in many > > ways (and the java.util.Date API is partly to blame for that!). I > > think you would do best just copying the whole component to your own > > project and then tweaking it in getInitiScript and by depending on > > your own date converter for getting the proper patterns. > > > > Btw, if you are working with different locales, the client's time zone > > is something you might want to consider as well. Here is something > > that does that and which depends on JodaTime > > > > > > import java.util.Date ; > > import java.util.TimeZone; > > > > import org.joda.time.DateTime; > > import org.joda.time.DateTimeZone; > > import org.joda.time.MutableDateTime; > > import org.joda.time.format.DateTimeFormat; > > import org.joda.time.format.DateTimeFormatter ; > > > > import wicket.Session; > > import wicket.protocol.http.request.WebClientInfo; > > import wicket.request.ClientInfo; > > import wicket.util.convert.SimpleConverterAdapter; > > > > /** > > * Date converter that can be smart about differences in time zone between > > * clients and server. NOT thread safe. > > * > > * @author eelcohillenius > > */ > > public class DateConverter extends SimpleConverterAdapter { > > > > /** > > * Whether to apply the time zone difference when interpreting > dates. > > * > > * > > * When true, the current time is applied on the parsed date, and > the date > > * will be corrected for the time zone difference between the > server and the > > * client. For instance, if I'm in Seattle and the server I'm > working on is > > * in Amsterdam, the server is 9 hours ahead. So, if I'm inputting > say 12/24 > > * at a couple of hours before midnight, at the server it is > already 12/25. > > * If this boolean is true, it will be transformed to 12/25, while > the > > * client sees 12/24. > > * > > * > > * True by default > > * > > */ > > private boolean applyTimeZoneDifference = true; > > > > /** optional pattern to use. */ > > private String datePattern; > > > > /** > > * Construct. > > */ > > public DateConverter() { > > } > > > > /** > > * Gets whether to apply the time zone difference when > interpreting dates. > > * > > * > > * When true, the current time is applied on the parsed date, and > the date > > * will be corrected for the time zone difference between the > server and the > > * client. For instance, if I'm in Seattle and the server I'm > working on is > > * in Amsterdam, the server is 9 hours ahead. So, if I'm inputting > say 12/24 > > * at a couple of hours before midnight, at the server it is > already 12/25. > > * If this boolean is true, it will be transformed to 12/25, while > the > > * client sees 12/24. > > * > > * > > * @return whether to apply the difference in time zones between > client and > > * server > > */ > > public final boolean getApplyTimeZoneDifference() { > > return applyTimeZoneDifference; > > } > > > > /** > > * Gets the optional date pattern. > > * > > * @return datePattern > > */ > > public String getDatePattern() { > > return datePattern; > > } > > > > /** > > * Sets whether to apply the time zone difference when > interpreting dates. > > * > > * > > * When true, the current time is applied on the parsed date, and > the date > > * will be corrected for the time zone difference between the > server and the > > * client. For instance, if I'm in Seattle and the server I'm > working on is > > * in Amsterdam, the server is 9 hours ahead. So, if I'm inputting > say 12/24 > > * at a couple of hours before midnight, at the server it is > already 12/25. > > * If this boolean is true, it will be transformed to 12/25, while > the > > * client sees 12/24. > > * > > * > > * @param applyTimeZoneDifference > > *whether to apply the difference in time zones > between client > > *and server > > */ > > public final void > setApplyTimeZoneDifference(boolean applyTimeZoneDifference) > { > > this.applyTimeZoneDifference = applyTimeZoneDifference; > > } > > > > /** > > * Sets th
Re: [Wicket-user] Not sure how to use DatePicker component
The date converter is being phased out because it is messy in many ways (and the java.util.Date API is partly to blame for that!). I think you would do best just copying the whole component to your own project and then tweaking it in getInitiScript and by depending on your own date converter for getting the proper patterns. Btw, if you are working with different locales, the client's time zone is something you might want to consider as well. Here is something that does that and which depends on JodaTime import java.util.Date; import java.util.TimeZone; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.MutableDateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import wicket.Session; import wicket.protocol.http.request.WebClientInfo; import wicket.request.ClientInfo; import wicket.util.convert.SimpleConverterAdapter; /** * Date converter that can be smart about differences in time zone between * clients and server. NOT thread safe. * * @author eelcohillenius */ public class DateConverter extends SimpleConverterAdapter { /** * Whether to apply the time zone difference when interpreting dates. * * * When true, the current time is applied on the parsed date, and the date * will be corrected for the time zone difference between the server and the * client. For instance, if I'm in Seattle and the server I'm working on is * in Amsterdam, the server is 9 hours ahead. So, if I'm inputting say 12/24 * at a couple of hours before midnight, at the server it is already 12/25. * If this boolean is true, it will be transformed to 12/25, while the * client sees 12/24. * * * True by default * */ private boolean applyTimeZoneDifference = true; /** optional pattern to use. */ private String datePattern; /** * Construct. */ public DateConverter() { } /** * Gets whether to apply the time zone difference when interpreting dates. * * * When true, the current time is applied on the parsed date, and the date * will be corrected for the time zone difference between the server and the * client. For instance, if I'm in Seattle and the server I'm working on is * in Amsterdam, the server is 9 hours ahead. So, if I'm inputting say 12/24 * at a couple of hours before midnight, at the server it is already 12/25. * If this boolean is true, it will be transformed to 12/25, while the * client sees 12/24. * * * @return whether to apply the difference in time zones between client and * server */ public final boolean getApplyTimeZoneDifference() { return applyTimeZoneDifference; } /** * Gets the optional date pattern. * * @return datePattern */ public String getDatePattern() { return datePattern; } /** * Sets whether to apply the time zone difference when interpreting dates. * * * When true, the current time is applied on the parsed date, and the date * will be corrected for the time zone difference between the server and the * client. For instance, if I'm in Seattle and the server I'm working on is * in Amsterdam, the server is 9 hours ahead. So, if I'm inputting say 12/24 * at a couple of hours before midnight, at the server it is already 12/25. * If this boolean is true, it will be transformed to 12/25, while the * client sees 12/24. * * * @param applyTimeZoneDifference *whether to apply the difference in time zones between client *and server */ public final void setApplyTimeZoneDifference(boolean applyTimeZoneDifference) { this.applyTimeZoneDifference = applyTimeZoneDifference; } /** * Sets the optional date pattern. * * @param datePattern *datePattern */ public void setDatePattern(String datePattern) { this.datePattern = datePattern; } @Override public Object toObject(String value) { DateTimeFormatter format = getFormat(); if (applyTimeZoneDifference) { TimeZone zone = getClientTimeZone(); // instantiate now/ current time MutableDateTime dt = new MutableDateTime(); if (zone != null) { // set time zone for client format = format.withZone(DateTime
Re: [Wicket-user] Not sure how to use DatePicker component
It's clearly the AjaxFormValidatingBehavior.addToAllFormComponents(this, "onblur", wicket.util.time.Duration.seconds(2)). Without that everything works as expected. We'll just comment that out for out demo. Here's the code & the stack trace. public RoomRequestForm(String id, IModel model, HotelAvailabilityResultsPanel rPanel) { super(id, model); setRoomRequest((RoomRequest) getModelObject()); setOutputMarkupId(true); resultsPanel = rPanel; FeedbackPanel feedback = new FeedbackPanel("feedback"); add(feedback); feedback.setOutputMarkupId(true); DateTextField checkIn = new DateTextField("checkIn", new PropertyModel(roomRequest, "checkIn")); checkIn.setOutputMarkupId(true); checkIn.setRequired(true); // checkIn.add(DateValidator.minimum(getToday())); add(checkIn); DatePicker dp = new CylleniusCalendar("checkInPicker", checkIn); add(dp); final FormComponentFeedbackBorder checkInBorder = addWithBorder(checkIn, "checkInBorder"); add(checkInBorder); addAjaxBehaviorToComponent(checkIn, checkInBorder, feedback); DateTextField checkOut = new DateTextField("checkOut", new PropertyModel(roomRequest, "checkOut")); checkOut.setOutputMarkupId(true); // checkIn.setRequired(true); add(checkOut); DatePicker dp2 = new CylleniusCalendar("checkOutPicker", checkOut); add(dp2); final FormComponentFeedbackBorder checkOutBorder = addWithBorder(checkOut, "checkOutBorder"); add(checkOutBorder); addAjaxBehaviorToComponent(checkOut, checkOutBorder, feedback); // DatesComparatorValidator validator = new // DatesComparatorValidator(checkIn, checkOut); // add(validator); addRoomChoice(); addAdultChildrenChoice(); AjaxFormValidatingBehavior.addToAllFormComponents(this, "onblur", wicket.util.time.Duration.sec .seconds(2)); } 2/02 10:02:58 INFO | Server.doStart(475): JBoss (MX MicroKernel) [4.0.3SP1(build: CVSTag=JBoss_4_0_3_SP1 date=200510231054)] Started in 32s:378ms 2/02 10:03:53 INFO | PropertiesFactory.loadPropertiesFileAndWatchForChanges(299): Loading properties files from file:/C:/dev/uiproto/wicketapp/content/com/vegas/cart/wicket/components/ProductPanel.properties 2/02 10:03:58 INFO | PropertiesFactory.loadPropertiesFileAndWatchForChanges(299): Loading properties files from file:/C:/dev/jboss/server/concierge/deploy/wicketapp.war/WEB-INF/classes/com/vegas/cart/wicket/CartApplication.properties 2/02 10:03:58 INFO | PropertiesFactory.loadPropertiesFileAndWatchForChanges(299): Loading properties files from jar:file:/C:/dev/jboss/server/concierge/deploy/wicketapp.war/WEB-INF/lib/wicket- 1.2.4.jar!/wicket/Application.properties 2/02 10:04:50 ERROR| AjaxRequestTarget.respond(379): Error while responding to an AJAX request: [EMAIL PROTECTED] markupIdToComponent [{scrollPopup_content_productReservation_roomRequestPopup_content_roomRequestForm_checkOutBorder=[MarkupContainer [Component id = checkOutBorder, page = com.vegas.cart.wicket.pages.Index, path = 0:scrollPopup:content:productReservation:roomRequestPopup:content:roomRequestForm: checkOutBorder.FormComponentFeedbackBorder, isVisible = true, isVersioned = false]], scrollPopup_content_productReservation_roomRequestPopup_content_roomRequestForm_feedback=[MarkupContainer [Component id = feedback, page = com.vegas.cart.wicket.pages.Index, path = 0:scrollPopup:content:productReservation:roomRequestPopup:content:roomRequestForm: feedback.FeedbackPanel, isVisible = true, isVersioned = false]], tabsPopup_content_productReservation_inlineRoomRequest_feedback=[MarkupContainer [Component id = feedback, page = com.vegas.cart.wicket.pages.Index, path = 0:tabsPopup:content:productReservation:inlineRoomRequest: feedback.FeedbackPanel, isVisible = true, isVersioned = false]], tabsPopup_content_productReservation_inlineRoomRequest_checkOutBorder=[MarkupContainer [Component id = checkOutBorder, page = com.vegas.cart.wicket.pages.Index, path = 0:tabsPopup:content:productReservation:inlineRoomRequest: checkOutBorder.FormComponentFeedbackBorder, isVisible = true, isVersioned = false]], tabsPopup_content_productReservation_inlineRoomRequest_checkInBorder=[MarkupContainer [Component id = checkInBorder, page = com.vegas.cart.wicket.pages.Index, path = 0:tabsPopup:content:productReservation:inlineRoomRequest: checkInBorder.FormComponentFeedbackBorder, isVisible = true, isVersioned = false]], scrollPopup_content_productReservation_roomRequestPopup_content_roomRequestForm_checkInBorder=[MarkupContainer [Component id = checkInBorder, page = com.vegas.cart.wicket.pages.Index, path = 0:scrollPopup:content:productReservation:roomRequestPopup:content:roomRequestForm: checkInBorder.FormComponentFeedbackBorder, isVisible = true, isVersioned = false]]}], prependJavascript [[]], appendJavascript [[]] wicket.WicketRuntimeException: Exception i
Re: [Wicket-user] Not sure how to use DatePicker component
Give us a stacktrace if you have it. Eelco On 2/2/07, Scott Swank <[EMAIL PROTECTED]> wrote: > The text field has yy, while the date picker puts into the date -- > whether it's MM/dd/ or dd/MM/ (due to i18n). Then we get an > annoying npe rendering the feedback panel -- which I still haven't tracked > down. > > popup contains panel > panel contains form > form contains fields with validation > form contains date pickers that are tied to two of the fields > form also has form-level validation > form also contains feedback panel with form component feedback borders > around date fields > form applies > AjaxFormValidatingBehavior.addToAllFormComponents("onblur") > > When the date picker pushes an invalid date (check-in date before today or > check-out date on/before check-in date) null pointers just roll in rendering > the feedback panel. I'm working to isolate this to a simpler case... > > Scott > > > > On 2/2/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > The date picker component already tries to sync with the text field > > you provide as the target. Did you try this? > > > > Eelco > > > > > > On 2/1/07, Scott Swank <[EMAIL PROTECTED] > wrote: > > > I just (a bit too optimistically) tried to get the converter from my > > > TextField and use it to set the DateConverter for the corresponding > > > DatePicker. I definitely want to retain the i18n (mm/dd/ for > ENGLISH > > > and dd/mm/ for FRENCH). Is there a straightforward way to synch up > the > > > DateConverters for a TextField and DatePicker while retaining > > > internationalization? > > > > > > RequiredTextField checkIn = new RequiredTextField("checkIn", new > > > PropertyModel(roomRequest, > > > "checkIn"), Date.class); > > > checkIn.setOutputMarkupId(true); > > > checkIn.add(DateValidator.minimum(getToday())); > > > add(checkIn); > > > > > > DatePicker dp = new > > > CylleniusCalendar("checkInPicker", checkIn); > > > dp.setOutputMarkupId(true); > > > dp.setDateConverter ((DateConverter) checkIn.getConverter ()); > > > add(dp); > > > > > > java.lang.ClassCastException: wicket.util.convert.Converter > > > at > > > > com.vegas.cart.wicket.components.RoomRequestForm.(RoomRequestForm.java > > > :69) > > > > > > Thank you, > > > Scott > > > > - > > > Using Tomcat but need to do more? Need to support web services, > security? > > > Get stuff done quickly with pre-integrated technology to make your job > > > easier. > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ___ > > > Wicket-user mailing list > > > Wicket-user@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > - > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job > easier. > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > -- > Scott Swank > reformed mathematician > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
The text field has yy, while the date picker puts into the date -- whether it's MM/dd/ or dd/MM/ (due to i18n). Then we get an annoying npe rendering the feedback panel -- which I still haven't tracked down. popup contains panel panel contains form form contains fields with validation form contains date pickers that are tied to two of the fields form also has form-level validation form also contains feedback panel with form component feedback borders around date fields form applies AjaxFormValidatingBehavior.addToAllFormComponents("onblur") When the date picker pushes an invalid date (check-in date before today or check-out date on/before check-in date) null pointers just roll in rendering the feedback panel. I'm working to isolate this to a simpler case... Scott On 2/2/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: The date picker component already tries to sync with the text field you provide as the target. Did you try this? Eelco On 2/1/07, Scott Swank <[EMAIL PROTECTED]> wrote: > I just (a bit too optimistically) tried to get the converter from my > TextField and use it to set the DateConverter for the corresponding > DatePicker. I definitely want to retain the i18n (mm/dd/ for ENGLISH > and dd/mm/ for FRENCH). Is there a straightforward way to synch up the > DateConverters for a TextField and DatePicker while retaining > internationalization? > > RequiredTextField checkIn = new RequiredTextField("checkIn", new > PropertyModel(roomRequest, > "checkIn"), Date.class); > checkIn.setOutputMarkupId(true); > checkIn.add(DateValidator.minimum(getToday())); > add(checkIn); > > DatePicker dp = new > CylleniusCalendar("checkInPicker", checkIn); > dp.setOutputMarkupId(true); > dp.setDateConverter ((DateConverter) checkIn.getConverter()); > add(dp); > > java.lang.ClassCastException: wicket.util.convert.Converter > at > com.vegas.cart.wicket.components.RoomRequestForm.( RoomRequestForm.java > :69) > > Thank you, > Scott > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Scott Swank reformed mathematician - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
The date picker component already tries to sync with the text field you provide as the target. Did you try this? Eelco On 2/1/07, Scott Swank <[EMAIL PROTECTED]> wrote: > I just (a bit too optimistically) tried to get the converter from my > TextField and use it to set the DateConverter for the corresponding > DatePicker. I definitely want to retain the i18n (mm/dd/ for ENGLISH > and dd/mm/ for FRENCH). Is there a straightforward way to synch up the > DateConverters for a TextField and DatePicker while retaining > internationalization? > > RequiredTextField checkIn = new RequiredTextField("checkIn", new > PropertyModel(roomRequest, > "checkIn"), Date.class); > checkIn.setOutputMarkupId(true); > checkIn.add(DateValidator.minimum(getToday())); > add(checkIn); > > DatePicker dp = new > CylleniusCalendar("checkInPicker", checkIn); > dp.setOutputMarkupId(true); > dp.setDateConverter ((DateConverter) checkIn.getConverter()); > add(dp); > > java.lang.ClassCastException: wicket.util.convert.Converter > at > com.vegas.cart.wicket.components.RoomRequestForm.(RoomRequestForm.java > :69) > > Thank you, > Scott > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
In my application, I implemented a custom IConverterFactory class and I extended Wicket's DateConverter class. Here's what I did for my Intranet application: * import* wicket.util.convert.IConverterFactory; * import* wicket.util.convert.IConverter; * import* wicket.util.convert.Converter; * import* java.util.*; * import* java.text.*; * public* *class* *ConverterFactory* *implements* IConverterFactory { *public* ConverterFactory() { *super*(); } *public* *IConverter* newConverter(*final* Locale locale) { Converter c = *new* Converter(locale); *if* ( (locale == Locale.ENGLISH) || (locale == Locale.US) ) { MyDateConverter dc = *new* *My*DateConverter(); c.set(java.util.Date.*class*, dc); } *return* c; } } ** * public class MyDateConverter extends wicket.util.convert.converters.DateConverter { public DateFormat getDateFormat(Locale locale) { if ( (locale == null) || (locale == Locale.ENGLISH) || (locale == Locale.US) ) { SimpleDateFormat format = new SimpleDateFormat("MM/dd/"); return format; } else { return super.getDateFormat(locale); } } } * On 2/1/07, Scott Swank <[EMAIL PROTECTED]> wrote: I just (a bit too optimistically) tried to get the converter from my TextField and use it to set the DateConverter for the corresponding DatePicker. I definitely want to retain the i18n (mm/dd/ for ENGLISH and dd/mm/ for FRENCH). Is there a straightforward way to synch up the DateConverters for a TextField and DatePicker while retaining internationalization? RequiredTextField checkIn = new RequiredTextField("checkIn", new PropertyModel(roomRequest, "checkIn"), Date.class); checkIn.setOutputMarkupId(true); checkIn.add(DateValidator.minimum(getToday())); add(checkIn); DatePicker dp = new CylleniusCalendar("checkInPicker", checkIn); dp.setOutputMarkupId(true); dp.setDateConverter ((DateConverter) checkIn.getConverter()); add(dp); java.lang.ClassCastException: wicket.util.convert.Converter at com.vegas.cart.wicket.components.RoomRequestForm.( RoomRequestForm.java :69) Thank you, Scott - - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
I just (a bit too optimistically) tried to get the converter from my TextField and use it to set the DateConverter for the corresponding DatePicker. I definitely want to retain the i18n (mm/dd/ for ENGLISH and dd/mm/ for FRENCH). Is there a straightforward way to synch up the DateConverters for a TextField and DatePicker while retaining internationalization? RequiredTextField checkIn = new RequiredTextField("checkIn", new PropertyModel(roomRequest, "checkIn"), Date.class); checkIn.setOutputMarkupId(true); checkIn.add(DateValidator.minimum(getToday())); add(checkIn); DatePicker dp = new CylleniusCalendar("checkInPicker", checkIn); dp.setOutputMarkupId(true); dp.setDateConverter((DateConverter) checkIn.getConverter()); add(dp); java.lang.ClassCastException: wicket.util.convert.Converter at com.vegas.cart.wicket.components.RoomRequestForm.( RoomRequestForm.java:69) Thank you, Scott - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
Actually it work nice for me after I understand how it work... I can see some complaint on the web and look like this just the problem of documentation and the way of change the default is not straigth forward? May be not worth to remove it? Not sure On 11/11/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > Sorry for the misguidance there. Something like this works: > > final DateFormat fmt = new > SimpleDateFormat("-MM-dd"); > final DateConverter dateConverter = new > DateConverter() > { > public DateFormat getDateFormat(Locale locale) > { > return fmt; > } > }; > TextField datePropertyTextField = new > TextField("dateProperty", Date.class); > add(datePropertyTextField); > DatePicker datePicker = new DatePicker("datePicker", > dateLabel, > datePropertyTextField); > datePicker.setDateConverter(dateConverter); > add(datePicker); > > > though in the above example, the text field itself needs to use the > proper date format as well. > > I was wrong about DatePickerSettings#setIfFormat. You don't need that. > > Instead of following the above example code I gave, you'd probably be > best off to set a global date converter (explained here > http://cwiki.apache.org/WICKET/using-custom-converters.html). > > > Eelco > > All of this is friggin' ugly anyway. You may have noticed that we are > about to remove the datepicker component from the extensions project. > > On 11/10/06, Carfield Yim <[EMAIL PROTECTED]> wrote: > > > That would be: > > > > > > /** > > > * The format string that will be used to enter the date in the > > > input field. > > > * This format will be honored even if the input field is hidden. > > > Use > > > * Javascript notation, like '%m/%d/%Y'. > > > */ > > > private String ifFormat = null; > > > > > > Use DatePicker#setDateConverter to align the two. > > > > > > > > I guess you mean something like > > > > DatePicker dp = new DatePicker("birthDayPicker", dateField); > > DateConverter dc = new DateConverter(); > > dc.setDateFormat(Locale.ENGLISH, > > DateFormat.getDateInstance(DateFormat.SHORT, Locale.ENGLISH)); > > dp.setDateConverter(dc); > > > > However, just try and no effect at al ... any problem ? > > > > - > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job > > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
Sorry for the misguidance there. Something like this works: final DateFormat fmt = new SimpleDateFormat("-MM-dd"); final DateConverter dateConverter = new DateConverter() { public DateFormat getDateFormat(Locale locale) { return fmt; } }; TextField datePropertyTextField = new TextField("dateProperty", Date.class); add(datePropertyTextField); DatePicker datePicker = new DatePicker("datePicker", dateLabel, datePropertyTextField); datePicker.setDateConverter(dateConverter); add(datePicker); though in the above example, the text field itself needs to use the proper date format as well. I was wrong about DatePickerSettings#setIfFormat. You don't need that. Instead of following the above example code I gave, you'd probably be best off to set a global date converter (explained here http://cwiki.apache.org/WICKET/using-custom-converters.html). Eelco All of this is friggin' ugly anyway. You may have noticed that we are about to remove the datepicker component from the extensions project. On 11/10/06, Carfield Yim <[EMAIL PROTECTED]> wrote: > > That would be: > > > > /** > > * The format string that will be used to enter the date in the > > input field. > > * This format will be honored even if the input field is hidden. > > Use > > * Javascript notation, like '%m/%d/%Y'. > > */ > > private String ifFormat = null; > > > > Use DatePicker#setDateConverter to align the two. > > > > > I guess you mean something like > > DatePicker dp = new DatePicker("birthDayPicker", dateField); > DateConverter dc = new DateConverter(); > dc.setDateFormat(Locale.ENGLISH, > DateFormat.getDateInstance(DateFormat.SHORT, Locale.ENGLISH)); > dp.setDateConverter(dc); > > However, just try and no effect at al ... any problem ? > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
> That would be: > > /** > * The format string that will be used to enter the date in the input > field. > * This format will be honored even if the input field is hidden. Use > * Javascript notation, like '%m/%d/%Y'. > */ > private String ifFormat = null; > > Use DatePicker#setDateConverter to align the two. > > I guess you mean something like DatePicker dp = new DatePicker("birthDayPicker", dateField); DateConverter dc = new DateConverter(); dc.setDateFormat(Locale.ENGLISH, DateFormat.getDateInstance(DateFormat.SHORT, Locale.ENGLISH)); dp.setDateConverter(dc); However, just try and no effect at al ... any problem ? - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
On 11/10/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > On 11/8/06, Carfield Yim <[EMAIL PROTECTED]> wrote: > > Two questons: > > 1) Can I initalized value of the datapicker according to what > > properties of javabean specificed? > > Some basic configuration options are supported through DatePickerSettings. > The value I refer to is the value of timestamp, in fact wicket already doen that but someone else do something wrong at DAO side and the getTimestamp method always return null. Which lead me think wicket datepicker need extra setup for that. > > 2) Look like the return of the javascript of date picket is localized, > > which is hard to parse at server side. Can I specific a custom output > > of date picker which is more easy to parse like "2006-11-09"? > > That would be: > > /** > * The format string that will be used to enter the date in the input > field. > * This format will be honored even if the input field is hidden. Use > * Javascript notation, like '%m/%d/%Y'. > */ > private String ifFormat = null; > > Use DatePicker#setDateConverter to align the two. > Thanks - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Not sure how to use DatePicker component
On 11/8/06, Carfield Yim <[EMAIL PROTECTED]> wrote: > Two questons: > 1) Can I initalized value of the datapicker according to what > properties of javabean specificed? Some basic configuration options are supported through DatePickerSettings. > 2) Look like the return of the javascript of date picket is localized, > which is hard to parse at server side. Can I specific a custom output > of date picker which is more easy to parse like "2006-11-09"? That would be: /** * The format string that will be used to enter the date in the input field. * This format will be honored even if the input field is hidden. Use * Javascript notation, like '%m/%d/%Y'. */ private String ifFormat = null; Use DatePicker#setDateConverter to align the two. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user