Interface Container.Sortable
-
- All Superinterfaces:
Container
,Container.Ordered
,Serializable
- All Known Implementing Classes:
AbstractBeanContainer
,BeanContainer
,BeanItemContainer
,GeneratedPropertyContainer
,HierarchicalContainer
,IndexedContainer
,SQLContainer
,Table
,TreeTable
- Enclosing interface:
- Container
public static interface Container.Sortable extends Container.Ordered
Interface for Container classes whoseItem
s can be sorted.When an
Container.Ordered
orContainer.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, theaddItem*()
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 implementsContainer.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 com.vaadin.data.Container
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<?>
getSortableContainerPropertyIds()
Gets the container property IDs which can be used to sort the items.void
sort(Object[] propertyId, boolean[] ascending)
Sorts the container items.-
Methods inherited from interface com.vaadin.data.Container
addContainerProperty, addItem, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, removeAllItems, removeContainerProperty, removeItem, size
-
Methods inherited from interface com.vaadin.data.Container.Ordered
addItemAfter, addItemAfter, firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId
-
-
-
-
Method Detail
-
sort
void sort(Object[] propertyId, boolean[] ascending)
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.
- Parameters:
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 bygetSortableContainerPropertyIds()
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. Usetrue
to sort in ascending order,false
to use descending order.
-
getSortableContainerPropertyIds
Collection<?> getSortableContainerPropertyIds()
Gets the container property IDs which can be used to sort the items.- Returns:
- the IDs of the properties that can be used for sorting the container
-
-