You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by James Carman <jc...@carmanconsulting.com> on 2009/02/14 22:53:12 UTC

Re: propertycolumn - date column, checkbox column

Perhaps a subclass of AbstractColumn?

public class MessageFormatColumn<T> extends AbstractColumn<T>
{
  private final String pattern;

  public MessageFormatColumn(IModel<String> displayModel, String pattern)
  {
    super(displayModel);
    this.pattern = pattern;
  }

  public void populateItem(Item<ICellPopulator<T>> cellItem, String
componentId, IModel<T> model)
  {
    cellItem.add(new Label(componentId, MessageFormat.format(pattern,
model.getObject())));
  }
}

This would work for dates, numbers, etc.  You just have to know how to
specify the format pattern.

p.s. Warning, this code is off the top of my head, so it might not
work "out of the box", but it gives you the idea.

On Sat, Feb 14, 2009 at 2:32 PM, Christoph GrĂ¼n <ch...@gmx.at> wrote:
> Hi all,
>
>
>
> columns.add(new PropertyColumn(new Model<String>("Title"), "title", " title
> "));
>
>
>
> How can I have such a  property column that displays java.util.dates?
>
> I would also need the same for checkboxes or true/false values.
>
>
>
> Thanks a lot,
>
> Christoph
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org