I keep asking silly questions :-)

I have a lot of ListViews that need to show ISO formatted dates. Is it common practice to make a WebComponent for that? For example like this:

public class DateLabel extends Label
{
    static private final Format sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public DateLabel(String id)
    {
        super(id);
    }

    public DateLabel(String id, Date model)
    {
        super(id, new Model(model));
    }

    public DateLabel(String id, IModel model)
    {
        super(id, model);
    }

    protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
    {
        replaceComponentTagBody(markupStream, openTag, sDateFormat.format(getModelObject()));
    }
}

I must admit that I'm not really in a Wicket Mindset yet. Maybe a Wicket Jedi Master can tell me whether this is the right approach :-)

 S.

_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to