Creating a custom bean id

Hi everyone,
I have the following container :

BeanContainer<Integer, Person> container = new BeanContainer<Integer, Person>(Person.class);

Where person has a “lastName”, “firstName” and “town” attributes.

I’m passing this container to my table : table.setContainerDataSource(container);

The problem is that I want to have a bean id property value (called “fullname”) that is the result of the lastname and firstname concatenation.

How can I do this wit the setTableFieldFactory and createField methods ?

Thank you.


The quick solution I guess would be to define a method getFullName() in your bean and use “fullName” as a bean ID.


I know … but i’m experimenting the setTableFieldFactory :slight_smile:

A field factory (as well as an overridden formatPropertyValue()) work on single properties. Furthermore, a TableFieldFactory just creates the field but its value is set separately later.

If you want to combine multiple properties, you can use a generated column (Table.addGeneratedColumn()).