@Override
public void setContainerDataSource(Container newDataSource) {
if (newDataSource == null) {
// Note: using wrapped IndexedContainer to match constructor (super
// creates an IndexedContainer, which is then wrapped).
newDataSource = new ContainerHierarchicalWrapper(
new IndexedContainer());
}
// Assure that the data source is ordered by making unordered
// containers ordered by wrapping them
if (Container.Hierarchical.class.isAssignableFrom(newDataSource
.getClass())) {
super.setContainerDataSource(newDataSource);
} else {
super.setContainerDataSource(new ContainerHierarchicalWrapper(
newDataSource));
}
}