public class IlpAttributeComparator extends IlpAbstractComparator
Constructor and Description |
---|
IlpAttributeComparator(IlpAttribute attribute,
boolean direction)
Creates a new comparator instance based on the given business attribute.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Object o1,
Object o2)
Compares the given objects according to the attributes defined in the
sorting criteria and the directions.
|
protected int |
compareObjectsByAttribute(Object ro1,
Object ro2,
IlpAttribute attribute)
Compares the given objects according to the value of the attribute.
|
int |
getDirectionAndOrder(IlpAttribute attribute)
Gets the sorting direction and sorting order of the specified attribute.
|
int |
getSortedAttributesCount()
Returns the number of attributes used to sort the list.
|
void |
removeSortedAttribute(IlpAttribute attribute)
Removes an attribute from the sorted attributes in the list.
|
void |
setDirectionAndOrder(IlpAttribute attribute,
int order,
boolean direction)
Sets the sorting direction and sorting order of the specified attribute.
|
addChangeListener, fireStateChanged, removeChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public IlpAttributeComparator(IlpAttribute attribute, boolean direction)
attribute
- Business attribute used to sort the objectsdirection
- The sorting direction, true
meaning
ascending or false
meaning descendingIllegalArgumentException
- if the given attribute equals
null
.public int getSortedAttributesCount()
public void removeSortedAttribute(IlpAttribute attribute)
attribute
- The attribute to remove.UnsupportedOperationException
- if the attribute to remove is
the last one.public int getDirectionAndOrder(IlpAttribute attribute)
attribute
- The attribute.public void setDirectionAndOrder(IlpAttribute attribute, int order, boolean direction)
attribute
- The attribute to sort.order
- The sorting order of the attribute. If order
is less than or equals to 0
or equals
to 1
, the attribute is put in the first position.
If order
is greater than the current number of
attributes used for the sort, the column is put in the last
position.
If the attribute is already sorted, its index or sorting direction
is changed.direction
- The sorting direction: true
meaning
ascending, or false
meaning descending.IllegalArgumentException
- if the given attribute equals null
.public int compare(Object o1, Object o2)
0
if both objects are equivalent. A value
less than 0
if the first object is meant to be
before the second object. A value greater than 0
if
the first object is meant to be after the second object.setDirectionAndOrder(IlpAttribute, int, boolean)
protected int compareObjectsByAttribute(Object ro1, Object ro2, IlpAttribute attribute)
IlpAttributeValueHolder
instances.0
if both objects are equivalent. A value
less than 0
if the first object is meant to be
before the second object. A value greater than 0
if
the first object is meant to be after the second object.setDirectionAndOrder(IlpAttribute, int, boolean)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.