I think your answer got lost somewhere. -----Original Message----- From: Antoine Angenieux [mailto:aangeni...@clinigrid.com] Sent: Tuesday, December 01, 2009 1:06 PM To: users@wicket.apache.org Subject: Re: It may be basic, but... Globally setting date styles for the application?
-- Antoine Angénieux Associé Clinigrid 5, avenue Mozart 75016 Paris, France +336 60 21 09 18 aangeni...@clinigrid.com Le 1 déc. 2009 à 18:57, "Loritsch, Berin C." <berin.lorit...@gd- ais.com> a écrit : > It appears that the newConverterLocator() route is about right, but I > have a slight issue between the Hibernate binding and what I want to > happen. In order for the converter to work, it looks for the exact > class. That means that java.util.Date won't work when the subclass > actually used is java.sql.Timestamp. Problem is that I need to > display > just the date at some times, and allow people to see the full > timestamp > at others (depending on the context). For example, on the main page > where I show a record the dates alone are fine, but on the page > where I > display the audit history I need the full date. > > So, how do I accomplish what I'm after without overcomplicating my > pages? Are converters set per page? That may be good enough for now. > > Also, is there any real reason why the standard converters don't allow > you to specify a style without subclassing? > > -----Original Message----- > From: Loritsch, Berin C. [mailto:berin.lorit...@gd-ais.com] > Sent: Tuesday, December 01, 2009 11:54 AM > To: users@wicket.apache.org > Subject: It may be basic, but... Globally setting date styles for the > application? > > It may seem rather basic, but I'm looking for a reasonably simple > way to > globally set how the application displays dates. On rails, it was as > simple as setting that information in the l10n/i18n resource files. > I've been googling and trying to find the answer in the "Wicket in > Action" book, but it doesn't seem like it's something anyone's cared > to > post the answer to. > > At first I thought it was setting up a converter registered with the > java.util.Date class. The instructions on the Wiki provide answers on > how to do that for wicket 1.1, 1.2, and 1.3. I attempted the 1.3 > solution, and my dates are not changed. Here's what I have: > > @Override > protected IConverterLocator newConverterLocator() { > ConverterLocator converterLocator = new ConverterLocator(); > converterLocator.set(Date.class, new DateConverter() { > private static final long serialVersionUID = > 194715223274764825L; > > @Override > public DateFormat getDateFormat(Locale locale) { > return new SimpleDateFormat("yyyy-MM-dd"); > } > }); > return converterLocator; > } > > The date still is displayed like: 11/12/09 12:58 PM > > Am I missing something? Even more specifically, I would like to have > three styles I can switch between: date only, time only, and date and > time. I'm trying not to repeat myself if I can help it. I'd like to > default to "date only" and specify time or date/time when needed. I > can't seem to get the system to recognize my date only solution. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org