Paolo - You could try creating your own component and pass a SimpleDateFormat object (custom mask) into the constructor of this custom component. In addition, when you assign this component as a constructor argument to the DatePicker it will use this mask for output. You can deconstruct the Date object back end if required back into string with same mask formatting - maybe to be part of a SQL WhereClauseGenerator etc.... I've attached an example where we use a custom DateTimeTextField for this purpose and override the getConverter method with the DateTimeConverter class (also attached). It makes use of wicket's SimpleConverterAdapter class. Hope this helps.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Paolo Di Tommaso Sent: 15 June 2007 15:18 To: wicket-user@lists.sourceforge.net Subject: [Wicket-user] Convertes Hell (Wicket 1.2.x) I need to replace the default Wicket Date conversion with a custom one to override the default format for dates. To do that I've made something like that in my wicket application : getApplicationSettings().setConverterFactory( new IConverterFactory() { public IConverter newConverter(Locale locale) { return new MyConverter() ; } } ); Where: public class MyConverter extends Converter { public MyConverter() { super(); set(Date.class, new MyDateConverter()); set(String.class, new MyStringConverter() ); } public MyConverter(final Locale locale) { this(); setLocale(locale); } } public class MyDateConverter extends AbstractConverter { protected Class getTargetType() { return Date.class; } public Object convert(final Object value, Locale locale) { return parse(MY_DATE_FORMAT, value); } } public class MyStringConverter extends AbstractConverter { .... /* * ... that requires also an extra class MyDateToStringConverter .. */ } This is really too complex to do a trivial job like a Date <---> String conversion . Exists a better and simpler way to override the default date-string conversion ? Thank you, Paolo Di Tommaso This e-mail (and any attachments) may contain privileged and/or confidential information. If you are not the intended recipient please do not disclose, copy, distribute, disseminate or take any action in reliance on it. If you have received this message in error please reply and tell us and then delete it. Should you wish to communicate with us by e-mail we cannot guarantee the security of any data outside our own computer systems. For the protection of Legal & General's systems and staff, incoming emails will be automatically scanned. Any information contained in this message may be subject to applicable terms and conditions and must not be construed as giving investment advice within or outside the United Kingdom. The following companies are subsidiary companies of the Legal & General Group Plc which are authorised and regulated by the Financial Services Authority for advising and arranging the products shown: Legal & General Partnership Services Limited (insurance and mortgages), Legal & General Insurance Limited (insurance), Legal & General Assurance Society Limited (life assurance, pensions and investments), Legal & General Unit Trust Managers Limited and Legal & General Portfolio Management Services Limited (investments). They are registered in England under numbers shown. The registered office is Temple Court, 11 Queen Victoria Street, London EC4N 4TP. Legal & General Partnership Services Limited: 5045000 Legal & General Assurance Society Limited: 166055 Legal & General (Unit Trust Managers) Limited: 1009418 Legal & General (Portfolio Management Services) Limited: 2457525 Legal & General Insurance Limited: 423930 They are registered with the Financial Services Authority under numbers shown. You can check this at www.fsa.gov.uk/register Legal & General Partnership Services Limited: 300792 Legal & General Assurance Society Limited: 117659 Legal & General (Unit Trust Managers) Limited: 119273 Legal & General (Portfolio Management Services) Limited: 146786 Legal & General Insurance Limited: 202050
DateTimeTextField.java
Description: Binary data
DateTimeConverter.java
Description: Binary data
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user