That makes sense; it would then be like the converters in JSF. These converters came from another project (Baritus) which had them largely based on the commons BeanUtils package. So, as that's a legacy thing now, we could just as well loose the difference.

If everyone (devs) are +1 with this, I'll try to fix this later this week.

Eelco

Jonathan Carlson wrote:

Thanks Eelco. It was not clear to me that a Formatter is the opposite of a Converter but your info helps. I wonder if this could all be more intuitive. My first reaction is that it might be less confusing if Converters did both directions and the Formatter concept went away. Maybe IConverter could have #toString(Object o) and #toObject(String s) methods. Converters that only need to go one direction could just No-Op the method they don't need.
It looks like I should use DateLocaleConverter (with 'YYYY-MM-DD' as the pattern and no Locale) because that's an IFormatter as well. This too seems like it could be more intuitive.
Do I have a valid point? I won't be hurt if you tell me that I don't know what I'm talking about. :-)
- Jonathan



>>> [EMAIL PROTECTED] 2005-02-01 3:33:01 PM >>> Ooops: 'Because I added a type converter, ...' should have been: 'Because I added a TypeValidator, ...'.

Eelco


Eelco Hillenius wrote:

> Yep. That's the nicest way to do it.
>
> You probably want to use this setting (false by default):
>
> settings.setPropertyModelDefaultApplyFormatting(true);
>
> as then the converting works both ways.
>
> If you take a look at the forminput example (CVS HEAD), you'll see:
>
> TextField dateInput = new TextField("dateInput", input,
> "dateProperty");
> dateInput.add(new TypeValidator(Date.class));
>
> where the input object has property 'dateProperty' of type
> java.util.Date. Because I added a type converter, before any model
> update, the type is checked first using the registered type converter.
> If that validates, the actual converting will be done using again that
> registered converter by the property model.
>
> That's how I use most forms. A form has a target object, say a person
> object. For the properties I want to have edited, I create input
> fields with property models so the converting and updating go
> semi-automatic. In form submit, all I have to do is to update/ save my
> altered object.
>
> Furthermore, when you use a framework like Hibernate or a JDO variant,
> it is probably sensible to work with detachable models a lot. Take a
> look the stuff that's in contrib for making this easier.
>
> Eelco
>
>
> Jonathan Carlson wrote:
>
>> I want to have a text form field that converts to a Date attribute on
>> a bean (using the YYYY-MM-DD string format).
>> >> It looks like I would create a DateConverter implementation of
>> IConverter and register it with the ConverterRepository so that the
>> PropertyModel instance can convert it appropriately. >> Is that the right approach for both directions (String to Date, and
>> Date to String)?
>> >> - Jonathan
>>
>>
>> **********************************************************************
>> This email and any files transmitted with it are confidential and
>> intended solely for the use of the individual or entity to whom they
>> are addressed. If you have received this email in error please notify
>> the system manager.
>>
>> www.katun.com <http://www.katun.com/>
>> **********************************************************************
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user





------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to