Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.nodes 6.7.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openide.nodes
Interface Index

All Superinterfaces:
  Node.Cookie

All Known Implementing Classes:
  Index.ArrayChildren, Index.Support

    public interface Index

extends Node.Cookie

Index cookie providing operations useful for reordering child nodes. `IndexedNode` is the common implementation.

Nested Class Summary
`static class` | `Index.ArrayChildren` Reorderable children list stored in an array.
`static class` | `Index.KeysChildren` Implementation of index interface that operates on an list of objects that are presented by given nodes.
`static class` | `Index.Support` A support class implementing some methods of the `Index` cookie.

Method Summary
`void` | `addChangeListener(ChangeListener chl)` Add a new listener to the listener list.
`void` | `exchange(int x, int y)` Exchange two elements.
`Node[]` | `getNodes()` Get the child nodes.
`int` | `getNodesCount()` Get the number of nodes.
`int` | `indexOf(Node node)` Get the index of a given 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()` Invoke a dialog for reordering the children.
`void` | `reorder(int[] perm)` Reorder all children with a given permutation.

Method Detail

### getNodesCount

    int getNodesCount()

  Get the number of nodes.

  Returns:
    the count

### getNodes

    Node[] getNodes()

  Get the child nodes.

  Returns:
    array of nodes that can be sorted by this index

### indexOf

    int indexOf(Node node)

  Get the index of a given node.

  Parameters:
    `node` - node to find index of
  Returns:
    index of the node, or `-1` if no such node was found

### reorder

    void reorder()

  Invoke a dialog for reordering the children.

### reorder

    void reorder(int[] perm)

  Reorder all children with a given permutation.

  Parameters:
    `perm` - permutation with the length of current nodes
  Throws:
    `IllegalArgumentException` - if the permutation is not valid

### move

    void move(int x,
              int y)

  Move the element at the `x`-th position to the `y`-th position. All elements after the `y`-th position are moved down.

  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

    void exchange(int x,
                  int y)

  Exchange two elements.

  Parameters:
    `x` - position of the first element
    `y` - position of the second element
  Throws:
    `IndexOutOfBoundsException` - if an index is out of bounds

### moveUp

    void moveUp(int x)

  Move an element up.

  Parameters:
    `x` - index of element to move up
  Throws:
    `IndexOutOfBoundsException` - if an index is out of bounds

### moveDown

    void moveDown(int x)

  Move an element down.

  Parameters:
    `x` - index of element to move down
  Throws:
    `IndexOutOfBoundsException` - if an index is out of bounds

### addChangeListener

    void addChangeListener(ChangeListener chl)

  Add a new listener to the listener list. The listener will be notified of any change in the order of the nodes.

  Parameters:
    `chl` - new listener

### removeChangeListener

    void removeChangeListener(ChangeListener chl)

  Remove a listener from the listener list.

  Parameters:
    `chl` - listener to remove

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.nodes 6.7.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.