public class TLcyActionBarItemComparator extends java.lang.Object implements java.util.Comparator<TLcyActionBarItem>
TLcyGroupDescriptor
. Those
items can be ILcdAction
s or ILcyActiveSettables
, but also
Component
s or sub-menus. Some predefined sort methods are to sort alphabetically,
or to add the most recently inserted item at the top (useful for say a recent items list).
All available predefined sort strategies are defined as constants in this class
(e.g. ABC
), the syntax is defined in lucy.cfg (above TLcyMain.menuBar.groupPriorities).Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ABC
Name of the order that order items alphabetically.
|
static java.lang.String |
END
Name of the order that puts new items always at the end.
|
static java.lang.String |
FIXED
Name of the order that puts items as configured in the
configuration file.
|
static java.lang.String |
START
Name of the order that puts new items always at the start.
|
static java.lang.String |
SUB_MENUS_FIRST
Name of the order that puts sub menu items before other
items.
|
static java.lang.String |
SUB_MENUS_LAST
Name of the order that puts sub menu items after other
items.
|
static java.lang.String |
ZYX
Name of the order that order items inverse alphabetically.
|
Constructor and Description |
---|
TLcyActionBarItemComparator(java.lang.String[] aGroupDescriptors)
Creates a new
TLcyActionBarItemComparator that parses the group descriptor names
for sort orders. |
Modifier and Type | Method and Description |
---|---|
int |
compare(TLcyActionBarItem aO1,
TLcyActionBarItem aO2) |
protected java.util.Comparator<TLcyActionBarItem> |
createComparator(java.lang.String aSortOrderName)
Creates a
Comparator for the given sort order name. |
public static final java.lang.String ABC
public static final java.lang.String ZYX
public static final java.lang.String SUB_MENUS_LAST
public static final java.lang.String SUB_MENUS_FIRST
public static final java.lang.String FIXED
public static final java.lang.String END
public static final java.lang.String START
public TLcyActionBarItemComparator(java.lang.String[] aGroupDescriptors)
TLcyActionBarItemComparator
that parses the group descriptor names
for sort orders. The syntax is defined in lucy.cfg (above TLcyMain.menuBar.groupPriorities).aGroupDescriptors
- The names for the group descriptors, including the sort orders.protected java.util.Comparator<TLcyActionBarItem> createComparator(java.lang.String aSortOrderName)
Comparator
for the given sort order name. Overwrite this method
to support additional sort orders.aSortOrderName
- The name of the sort order.Comparator
for the given sort order name.public int compare(TLcyActionBarItem aO1, TLcyActionBarItem aO2)
compare
in interface java.util.Comparator<TLcyActionBarItem>