This is the JSF interface:
public interface Converter { Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException;
String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException; }
Which is tightly coupled to JSF. Furthermore, I think (by doing a quick code scan of MyFaces) that locales are not supported in JSF as well as we support it.
Currently in Wicket, these are the interfaces:
public interface IConverter { public Object convert(Object value); }
and
public interface IFormatter { public String format(Object value, String pattern); }
Now, that I have a closer look to it, I think the pattern should be omitted, and the interface should look like:
public interface IConverter { Object getAsObject(String value) throws ConversionException;
String getAsString(Object value) throws ConversionException; }
However, I know from experience that use of a pattern can be very convenient, I am have never been very happy with the way localization is implemented (which is again a legacy issue as I copied that from BeanUtils.
There are several ways to tackle this. I think the most elegant - and future safe - option is to introduce a context object, like:
public interface IConverter
{
Object getAsObject(ConversionContext ctx, String value) throws ConversionException;
String getAsString(ConversionContext ctx, Object value) throws ConversionException;
}
Where ConversionContext would at least have a reference to the optional locale object to use (note that besides the user's locale, this can be explicitly set in the PropertyModel) and the optional conversion pattern. I think if the API looked like this, the writing of custom converters would be much simpler/ clearer and the lookup process would be drastically simplified and thus more transparent to our framework users.
What do you think?
Eelco
Juergen Donnerstag wrote:
So, as that's a legacy thing
now, we could just as well loose the difference.
Sorry, it is probably only my english. Our current implementation isn't better nore worse than what JSF (and may be others) offer. And because there are "standard" packages out there to that job, the idea is to move towards this package. Correct?
Juergen
-------------------------------------------------------
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