com.sencha.gxt.data.shared
Enum SortDir

java.lang.Object
  extended by java.lang.Enum<SortDir>
      extended by com.sencha.gxt.data.shared.SortDir
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<SortDir>

public enum SortDir
extends java.lang.Enum<SortDir>

Sort direction enumeration.


Enum Constant Summary
ASC
          Ascending sort order.
DESC
          Descending sort order.
 
Method Summary
abstract
<X> java.util.Comparator<X>
comparator(java.util.Comparator<X> c)
          An example of how to use this : List list = ...
static SortDir toggle(SortDir sortDir)
          Toggles the given sort direction, that is given one sort direction, it returns the other.
static SortDir valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static SortDir[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ASC

public static final SortDir ASC
Ascending sort order.


DESC

public static final SortDir DESC
Descending sort order.

Method Detail

values

public static SortDir[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SortDir c : SortDir.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SortDir valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

toggle

public static SortDir toggle(SortDir sortDir)
Toggles the given sort direction, that is given one sort direction, it returns the other.

Parameters:
sortDir - the sort direction to toggle
Returns:
the toggled sort direction

comparator

public abstract <X> java.util.Comparator<X> comparator(java.util.Comparator<X> c)
An example of how to use this : List list = ... Collections.sort(list, SortDir.ASC.comparator(new Comparator() { public int compare(Object o1, Object o2) { return ... } });

Returns:
a Comparator that wraps the specific comparator that orders the results according to the sort direction


Copyright © 2012. All Rights Reserved.