Interface Container.Sortable

All Superinterfaces:
Container, Container.Ordered,
All Known Implementing Classes:
AbstractBeanContainer, BeanContainer, BeanItemContainer, HierarchicalContainer, IndexedContainer, SQLContainer, Table, TreeTable
Enclosing interface:

public static interface Container.Sortable
extends Container.Ordered

Interface for Container classes whose Items can be sorted.

When an Container.Ordered or Container.Indexed container is sorted, all relevant operations of these interfaces should only use the filtered and sorted contents and the filtered indices to the container. Indices or item identifiers in the public API refer to the visible view unless otherwise stated. However, the addItem*() methods may add items that will be filtered out after addition or moved to another position based on sorting.

How sorting is performed when a Container.Hierarchical container implements Container.Sortable is implementation specific and should be documented in the implementing class. However, the recommended approach is sorting the roots and the sets of children of each item separately.

Depending on the container type, sorting a container may permanently change the internal order of items in the container.

Nested Class Summary
Nested classes/interfaces inherited from interface
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeEvent, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer
Method Summary
 java.util.Collection<?> getSortableContainerPropertyIds()
          Gets the container property IDs which can be used to sort the items.
 void sort(java.lang.Object[] propertyId, boolean[] ascending)
          Sort method.
Methods inherited from interface
addItemAfter, addItemAfter, firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId
Methods inherited from interface
addContainerProperty, addItem, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, removeAllItems, removeContainerProperty, removeItem, size

Method Detail


void sort(java.lang.Object[] propertyId,
          boolean[] ascending)
Sort method. Sorts the container items. Sorting a container can irreversibly change the order of its items or only change the order temporarily, depending on the container.

propertyId - Array of container property IDs, whose values are used to sort the items in container as primary, secondary, ... sorting criterion. All of the item IDs must be in the collection returned by getSortableContainerPropertyIds()
ascending - Array of sorting order flags corresponding to each property ID used in sorting. If this array is shorter than propertyId array, ascending order is assumed for items where the order is not specified. Use true to sort in ascending order, false to use descending order.


java.util.Collection<?> getSortableContainerPropertyIds()
Gets the container property IDs which can be used to sort the items.

the IDs of the properties that can be used for sorting the container

Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.