org.apache.directory.studio.apacheds.views
Class ServersViewerComparator

java.lang.Object
  extended by org.eclipse.jface.viewers.ViewerComparator
      extended by org.apache.directory.studio.apacheds.views.ServersViewerComparator

public class ServersViewerComparator
extends org.eclipse.jface.viewers.ViewerComparator

This class implements the servers table viewer comparator.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Field Summary
static int ASCENDING
           
static int DESCENDING
           
protected  int[] directions
           
protected  ServersViewLabelProvider labelProvider
           
static int MAX_DEPTH
           
protected  int[] priorities
           
 
Constructor Summary
ServersViewerComparator(ServersViewLabelProvider labelProvider)
          Creates a new instance of ServersViewerComparator.
 
Method Summary
 int compare(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object e1, java.lang.Object e2)
           
 int compare(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object e1, java.lang.Object e2, int a)
          Returns a negative, zero, or positive number depending on whether the first element is less than, equal to, or greater than the second element.
 int getTopPriority()
          Gets the top priority.
 int getTopPriorityDirection()
          Gets the top priority direction
 void reverseTopPriority()
          Reverses the top priority
 void setTopPriority(int priority)
          Sets the top priority.
 void setTopPriorityDirection(int direction)
          Sets the top priority direction
 
Methods inherited from class org.eclipse.jface.viewers.ViewerComparator
category, getComparator, isSorterProperty, sort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DEPTH

public static final int MAX_DEPTH
See Also:
Constant Field Values

ASCENDING

public static final int ASCENDING
See Also:
Constant Field Values

DESCENDING

public static final int DESCENDING
See Also:
Constant Field Values

labelProvider

protected ServersViewLabelProvider labelProvider

priorities

protected int[] priorities

directions

protected int[] directions
Constructor Detail

ServersViewerComparator

public ServersViewerComparator(ServersViewLabelProvider labelProvider)
Creates a new instance of ServersViewerComparator.

Parameters:
labelProvider - the label provider
Method Detail

setTopPriority

public void setTopPriority(int priority)
Sets the top priority.

Parameters:
priority - the priority

getTopPriority

public int getTopPriority()
Gets the top priority.

Returns:
the top priority

setTopPriorityDirection

public void setTopPriorityDirection(int direction)
Sets the top priority direction

Parameters:
direction - the direction

getTopPriorityDirection

public int getTopPriorityDirection()
Gets the top priority direction

Returns:
the top priority direction

reverseTopPriority

public void reverseTopPriority()
Reverses the top priority


compare

public int compare(org.eclipse.jface.viewers.Viewer viewer,
                   java.lang.Object e1,
                   java.lang.Object e2,
                   int a)
Returns a negative, zero, or positive number depending on whether the first element is less than, equal to, or greater than the second element.

The default implementation of this method is based on comparing the elements' categories as computed by the category framework method. Elements within the same category are further subjected to a case insensitive compare of their label strings, either as computed by the content viewer's label provider, or their toString values in other cases. Subclasses may override.

Parameters:
viewer - the viewer
e1 - the first element
e2 - the second element
a - the direction
Returns:
a negative number if the first element is less than the second element; the value 0 if the first element is equal to the second element; and a positive number if the first element is greater than the second element

compare

public int compare(org.eclipse.jface.viewers.Viewer viewer,
                   java.lang.Object e1,
                   java.lang.Object e2)
Overrides:
compare in class org.eclipse.jface.viewers.ViewerComparator


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.