Remote Systems
v6.4.1

com.ibm.etools.systems.core.ui
Class SystemSortableSelection

java.lang.Object
  extended bycom.ibm.etools.systems.core.ui.SystemSortableSelection
All Implemented Interfaces:
Comparable

public class SystemSortableSelection
extends Object
implements Comparable

The TreeViewer widget does not seem to guarantee that multiple-selections are returned sorted in order of appearance in the tree. Some action require they be, such as MoveUp and MoveDown. This class captures the information for each selected item and permits sorting via position, using the Arrays helper class in java.util.


Field Summary
static String copyright
           
 
Constructor Summary
SystemSortableSelection(Object selectedObject)
          Constructor for SystemSortableSelection
 
Method Summary
 int compareTo(Object other)
           
 boolean equals(Object other)
           
 int getPosition()
          Get the poisition of the selected object within its parent list
 Object getSelectedObject()
          Get the selected object
static Object[] getSortedObjects(SystemSortableSelection[] sortedArray, Object[] outputArray)
          IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, AND CALLED SORTARRAY, THIS CONVERTS INTO A SORTED ARRAY THAT JUST HAS THE ORIGINAL OBJECTS IN IT FROM THE SELECTION LIST.
static SystemSortableSelection[] makeSortableArray(IStructuredSelection selection)
          Convert structured selection into an array of these objects.
 void setPosition(int position)
          Set the position of the selected object within its parent list
static void sortArray(SystemSortableSelection[] sortableArray)
          IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, THIS WILL SORT THAT ARRAY BY THE POSITION
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values
Constructor Detail

SystemSortableSelection

public SystemSortableSelection(Object selectedObject)
Constructor for SystemSortableSelection

Method Detail

getSelectedObject

public Object getSelectedObject()
Get the selected object


setPosition

public void setPosition(int position)
Set the position of the selected object within its parent list


getPosition

public int getPosition()
Get the poisition of the selected object within its parent list


compareTo

public int compareTo(Object other)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(Object)

equals

public boolean equals(Object other)

makeSortableArray

public static SystemSortableSelection[] makeSortableArray(IStructuredSelection selection)
Convert structured selection into an array of these objects. YOU MUST CALL SET POSITION AFTER FOR EACH ITEM, BEFORE YOU CAN SORT THIS ARRAY!


sortArray

public static void sortArray(SystemSortableSelection[] sortableArray)
IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, THIS WILL SORT THAT ARRAY BY THE POSITION


getSortedObjects

public static Object[] getSortedObjects(SystemSortableSelection[] sortedArray,
                                        Object[] outputArray)
IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, AND CALLED SORTARRAY, THIS CONVERTS INTO A SORTED ARRAY THAT JUST HAS THE ORIGINAL OBJECTS IN IT FROM THE SELECTION LIST.


Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.