Hi,
I’m using Vaadin 6.7.5.
it seems that removing all items from a container data source does not delete the selection of the assigned table. IMO everytime a container is changed the selection (see com.vaadin.ui.AbstractSelect#setValue()/#getValue()) should be changed accordingly in order to avoid inconsitencies between the table model and its selection.
I discovered the problem when refreshing a vaadin table in multi selection mode.
At first the old selection is stored in a local set. Then the attached container is purged (using removeAllItems()) and created from scratch.
Afterwards the old selection is applied again.
In order to achieve this only instances from the refreshed container are used and applied as the new selection.
However Vaadin refuses to set the values because the selections are equal from its point of view:
com.vaadin.ui.AbstractField#setValue(Object newValue, boolean repaintIsNotNeeded):
if ((newValue == null && value != null)
|| (newValue != null && !newValue.equals(value))) {
I am using a com.vaadin.data.util.BeanItemContainer containing a bean that overwrites #hashCode() and #equals().
So the equals method compares the old and the new selections and they are equal even if the instances are not the same!
Thus the old selection remains in the table and is inconsistent to the table container: the instances are not the same anymore!
Best Regards
Udo Offermann