Runtime

## org.eclipse.gmf.runtime.diagram.ui.dialogs.sortfilter
Class SortFilterViewerSorter

    java.lang.Object
      org.eclipse.jface.viewers.ViewerComparator
          org.eclipse.jface.viewers.ViewerSorter
              org.eclipse.gmf.runtime.diagram.ui.dialogs.sortfilter.SortFilterViewerSorter

public class SortFilterViewerSorter
extends ViewerSorter

Provides a `ViewerSorter` which tracks the type of sorting to ascending or descending orders.

Field Summary
`protected com.ibm.icu.text.Collator` `collator` The locale specific collator
`protected int` `criteria` The hint for the sorting.

Constructor Summary
`SortFilterViewerSorter()`

Method Summary
`protected int` `compareString(java.lang.String item1, java.lang.String item2)` compares the passed elements based on the current `SortingDirection`
`protected int` `compareVisible(java.lang.String item1, java.lang.String item2)` compares the passed elements based on the current `SortingDirection`
`int` `getCriteria()`
`SortingDirection` `getSortingDirection()`
`void` `setCriteria(int criteria)`
`void` `setSortingDirection(SortingDirection sortingDirection)`
`void` `toggleSortingDirection()` Toggles the sorting direction from its current state.

Methods inherited from class org.eclipse.jface.viewers.ViewerSorter
`getCollator, getComparator`

Methods inherited from class org.eclipse.jface.viewers.ViewerComparator
`category, compare, isSorterProperty, sort`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### criteria

    protected int criteria

  The hint for the sorting. Defines the item to sort on

### collator

    protected com.ibm.icu.text.Collator collator

  The locale specific collator

Constructor Detail

### SortFilterViewerSorter

    public SortFilterViewerSorter()

Method Detail

### toggleSortingDirection

    public void toggleSortingDirection()

  Toggles the sorting direction from its current state.

### getSortingDirection

    public SortingDirection getSortingDirection()

  Returns:
    Returns the sortingDirection.

### setSortingDirection

    public void setSortingDirection(SortingDirection sortingDirection)

  Parameters:
    `sortingDirection` - The sortingDirection to set.

### getCriteria

    public int getCriteria()

  Returns:
    Returns the criteria.

### setCriteria

    public void setCriteria(int criteria)

  Parameters:
    `criteria` - The criteria to set.

### compareString

    protected int compareString(java.lang.String item1,
                                java.lang.String item2)

  compares the passed elements based on the current `SortingDirection`

  Parameters:
    `item1` - first item
    `item2` - second item
  Returns:
    a negative number if the first item is before the second element; the value `0` if the first element is the same order as the second element; and a positive number if the first element is after the second element

### compareVisible

    protected int compareVisible(java.lang.String item1,
                                 java.lang.String item2)

  compares the passed elements based on the current `SortingDirection`

  Parameters:
    `item1` - first item
    `item2` - second item
  Returns:
    a negative number if the first item is before the second element; the value `0` if the first element is the same order as the second element; and a positive number if the first element is after the second element

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.