Override framework default behaviour e.g. IndexedContainer


I would like to know if there is a way in Vaadin to override the default framework initialisation (e.g. IndexedContainer).

The use case for this is to override the default item sorting on IndexedContainer. We want to make it sorting case insensitive, so instead of extending IndexedContainer and set the default item sorter using

class MyContainer extends IndexedContainer {
  MyContainer() {
    setItemSorter(new DefaultItemSorter(new MySortIgnoreCaseFilter()));

We want to have the IndexedContainer automatically have the item sorter.

Is it something possible to be done or it has to be done by extending the IndexedContainer class?



you don’t need to extend the IndexedContainer to call setItemSorter, it’s a public method. If you want to avoid doing that for each container instance, however, extending the class is probably the best way to go.