com.vaadin.data.util.
Interface ItemSorter
-
All Superinterfaces:
All Known Implementing Classes:
public interface ItemSorter extends Comparator<Object>, Cloneable, Serializable
An item comparator which is compatible with the
Container.Sortable
interface. TheItemSorter
interface can be used inSortable
implementations to provide a custom sorting method.
-
-
Method Summary
All Methods Modifier and Type Method and Description int
compare(Object itemId1, Object itemId2)
Compares its two arguments for order.
void
setSortProperties(Container.Sortable container, Object[] propertyId, boolean[] ascending)
Sets the parameters for an upcoming sort operation.
-
Methods inherited from interface java.util.Comparator
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
setSortProperties
void setSortProperties(Container.Sortable container, Object[] propertyId, boolean[] ascending)
Sets the parameters for an upcoming sort operation. The parameters determine what container to sort and how the
ItemSorter
sorts the container.Parameters:
container
- The container that will be sorted. The container must contain the propertyIds given in thepropertyId
parameter.propertyId
- The property ids used for sorting. The property ids must exist in the container and should only be used if they are also sortable, i.e include in the collection returned bycontainer.getSortableContainerPropertyIds()
. SeeContainer.Sortable.sort(Object[], boolean[])
for more information.ascending
- Sorting order flags for each property id. SeeContainer.Sortable.sort(Object[], boolean[])
for more information.
-
compare
int compare(Object itemId1, Object itemId2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The parameters for the
ItemSorter
compare()
method must always be item ids which exist in the container set using#setSortProperties(Sortable, Object[], boolean[])
.Specified by:
compare
in interfaceComparator<Object>
See Also:
-
-