org.openide.nodes
Class Index.Support

java.lang.Object
  |
  +--org.openide.nodes.Index.Support
All Implemented Interfaces:
Index, Node.Cookie
Direct Known Subclasses:
DataFolder.Index
Enclosing class:
Index

public abstract static class Index.Support
extends Object
implements Index

A support class implementing some methods of the Index cookie.


Inner classes inherited from class org.openide.nodes.Index
Index.ArrayChildren, Index.KeysChildren, Index.Support
 
Constructor Summary
Index.Support()
          Default constructor.
 
Method Summary
 void addChangeListener(ChangeListener chl)
          Add a new listener to the listener list.
 void exchange(int x, int y)
          Exchange two elements.
protected  void fireChangeEvent(ChangeEvent che)
          Fires notification about reordering to all registered listeners.
abstract  Node[] getNodes()
          Get the nodes; should be overridden if needed.
abstract  int getNodesCount()
          Get the node count.
 int indexOf(Node node)
          Get the index of a node.
 void move(int x, int y)
          Move the element at the x-th position to the y-th position.
 void moveDown(int x)
          Move an element down.
 void moveUp(int x)
          Move an element up.
 void removeChangeListener(ChangeListener chl)
          Remove a listener from the listener list.
 void reorder()
          Reorder the nodes with dialog; should be overridden if needed.
abstract  void reorder(int[] perm)
          Reorder by permutation.
static void showIndexedCustomizer(Index idx)
          Utility method to create and show an indexed customizer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Index.Support

public Index.Support()
Default constructor.
Method Detail

move

public void move(int x,
                 int y)
Description copied from interface: Index
Move the element at the x-th position to the y-th position. All elements after the y-th position are moved down.
Specified by:
move in interface Index
Following copied from interface: org.openide.nodes.Index
Parameters:
x - the position to remove the element from
y - the position to insert the element to
Throws:
IndexOutOfBoundsException - if an index is out of bounds

exchange

public void exchange(int x,
                     int y)
Description copied from interface: Index
Exchange two elements.
Specified by:
exchange in interface Index
Following copied from interface: org.openide.nodes.Index
Parameters:
x - position of the first element
y - position of the second element
Throws:
IndexOutOfBoundsException - if an index is out of bounds

moveUp

public void moveUp(int x)
Description copied from interface: Index
Move an element up.
Specified by:
moveUp in interface Index
Following copied from interface: org.openide.nodes.Index
Parameters:
x - index of element to move up
Throws:
IndexOutOfBoundsException - if an index is out of bounds

moveDown

public void moveDown(int x)
Description copied from interface: Index
Move an element down.
Specified by:
moveDown in interface Index
Following copied from interface: org.openide.nodes.Index
Parameters:
x - index of element to move down
Throws:
IndexOutOfBoundsException - if an index is out of bounds

addChangeListener

public void addChangeListener(ChangeListener chl)
Description copied from interface: Index
Add a new listener to the listener list. The listener will be notified of any change in the order of the nodes.
Specified by:
addChangeListener in interface Index
Following copied from interface: org.openide.nodes.Index
Parameters:
chl - new listener

removeChangeListener

public void removeChangeListener(ChangeListener chl)
Description copied from interface: Index
Remove a listener from the listener list.
Specified by:
removeChangeListener in interface Index
Following copied from interface: org.openide.nodes.Index
Parameters:
chl - listener to remove

fireChangeEvent

protected void fireChangeEvent(ChangeEvent che)
Fires notification about reordering to all registered listeners.
Parameters:
che - change event to fire off

getNodes

public abstract Node[] getNodes()
Get the nodes; should be overridden if needed.
Specified by:
getNodes in interface Index
Returns:
the nodes

indexOf

public int indexOf(Node node)
Get the index of a node. Simply scans through the array returned by getNodes().
Specified by:
indexOf in interface Index
Parameters:
node - the node
Returns:
the index, or -1 if the node was not found

reorder

public void reorder()
Reorder the nodes with dialog; should be overridden if needed.
Specified by:
reorder in interface Index

showIndexedCustomizer

public static void showIndexedCustomizer(Index idx)
Utility method to create and show an indexed customizer. Displays some sort of dialog permitting the index cookie to be reordered. Blocks until the reordering is performed (or cancelled).
Parameters:
idx - the index cookie to reorder based on
Since:
1.37

getNodesCount

public abstract int getNodesCount()
Get the node count. Subclasses must provide this.
Specified by:
getNodesCount in interface Index
Returns:
the count

reorder

public abstract void reorder(int[] perm)
Reorder by permutation. Subclasses must provide this.
Specified by:
reorder in interface Index
Parameters:
perm - the permutation


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.