Table and JPAContainer format values ?


I’m trying format values of my Table rewriting the formatPropertyValue() method.
I’m using JPAContainer and I don’t know how to I do this. I tried use addContainerProperty() but doesn’t work and returns an exception.

I’m trying this

    final Table table = new Table("Formatted Table") {
        protected String formatPropertyValue(Object rowId,
                Object colId, Property property) {
            // Format by property type
            if (property.getType() == Date.class) {
                SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
                return df.format((Date)property.getValue());
            return super.formatPropertyValue(rowId, colId, property);
    // The table has some columns
    table.addContainerProperty("Time", Date.class, null);

How to I do this ?

I solved the problem. Using JPAContainer I don’t use addContainerProperty() …Now works :smiley: