Table: represent Integer column as mapped String

Hi,

I have a newbie question.
How can I make a Table to show me some strings instead of integers?

String TYPES[] = new String[] { "Home", "Work", "Cell", "Unknown" }; Container c = new IndexedContainer(); c.addContainerProperty("Type", Integer.class, 3); table.setContainerDataSource(c); And I want either “Home”, “Work”, “Cell” or “Unknown” to be shown instead of 0…3

I know that I can simply define in my container another property of type string, fill it correspondingly and hide the integer column. But this way seems to be wrong. I want to manipulate representation, not the data model.

Could somebody give me a hint which direction should I look to?
Thanks in advance!

Hi Roman, you can set a custom
Converter
to the column using table.setConverter(propertyId, Converter).

Thanks for a hint, it works!
Btw why not to use the Table.formatPropertyValue:

            @Override
            protected String formatPropertyValue(Object rowId, Object colId,
                    Property<?> property);

?
Will it be a bad practice?

If all you want is a text representation and it is no problem to subclass the Table for this specific use, overriding formatPropertyValue() should be ok.