org.openide.nodes
Class Index.ArrayChildren

java.lang.Object
  |
  +--org.openide.nodes.Children
        |
        +--org.openide.nodes.Children.Array
              |
              +--org.openide.nodes.Index.ArrayChildren
All Implemented Interfaces:
Cloneable, Index, Node.Cookie
Enclosing class:
Index

public static class Index.ArrayChildren
extends Children.Array
implements Index

Reorderable children list stored in an array.


Inner classes inherited from class org.openide.nodes.Children
Children.Array, Children.Keys, Children.Map, Children.SortedArray, Children.SortedMap
 
Inner classes inherited from class org.openide.nodes.Index
Index.ArrayChildren, Index.KeysChildren, Index.Support
 
Field Summary
protected  Index support
          Support instance for delegation of some Index methods.
 
Fields inherited from class org.openide.nodes.Children.Array
nodes
 
Fields inherited from class org.openide.nodes.Children
LEAF, MUTEX
 
Constructor Summary
Index.ArrayChildren()
          Constructor for the support.
 
Method Summary
 void addChangeListener(ChangeListener chl)
          Add a new listener to the listener list.
 void exchange(int x, int y)
          Exchange two elements.
 int indexOf(Node node)
          Get the index of a given node.
protected  Collection initCollection()
          If default constructor is used, then this method is called to lazily create the collection.
 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()
          Invokes a dialog for reordering children using IndexedCustomizer.
 void reorder(int[] perm)
          Reorder all children with a given permutation.
 
Methods inherited from class org.openide.nodes.Children.Array
add, clone, refresh, remove
 
Methods inherited from class org.openide.nodes.Children
addNotify, findChild, getNode, getNodes, getNodesCount, isInitialized, nodes, removeNotify
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openide.nodes.Index
getNodes, getNodesCount
 

Field Detail

support

protected Index support
Support instance for delegation of some Index methods.
Constructor Detail

Index.ArrayChildren

public Index.ArrayChildren()
Constructor for the support.
Method Detail

initCollection

protected Collection initCollection()
If default constructor is used, then this method is called to lazily create the collection. Even it claims that it returns Collection only subclasses of List are valid values.

This implementation returns ArrayList.

Overrides:
initCollection in class Children.Array
Returns:
any List collection.

reorder

public void reorder(int[] perm)
Description copied from interface: Index
Reorder all children with a given permutation.
Specified by:
reorder in interface Index
Following copied from interface: org.openide.nodes.Index
Parameters:
perm - permutation with the length of current nodes
Throws:
IllegalArgumentException - if the permutation is not valid

reorder

public void reorder()
Invokes a dialog for reordering children using IndexedCustomizer.
Specified by:
reorder in interface Index

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

indexOf

public int indexOf(Node node)
Description copied from interface: Index
Get the index of a given node.
Specified by:
indexOf in interface Index
Following copied from interface: org.openide.nodes.Index
Parameters:
node - node to find index of
Returns:
index of the node, or -1 if no such node was found

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


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