public static interface Container.Sortable extends Container.Ordered
Item
s 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.
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
Modifier and Type | Method and 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.
|
addItemAfter, addItemAfter, firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId
addContainerProperty, addItem, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, removeAllItems, removeContainerProperty, removeItem, size
void sort(Object[] propertyId, boolean[] ascending)
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.Collection<?> getSortableContainerPropertyIds()
Copyright © 2019 Vaadin Ltd. All rights reserved.