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
Class Children.Array

    java.lang.Object
      org.openide.nodes.Children
          org.openide.nodes.Children.Array

All Implemented Interfaces:
  Cloneable

Direct Known Subclasses:
  Children.Keys, Children.SortedArray, Index.ArrayChildren

Enclosing class:
  Children

    public static class Children.Array

extends Children
implements Cloneable

Implements the storage of node children by an array. Each new child is added at the end of the array. The nodes are returned in the order they were inserted.

Normally you will simply create an instance of `Children.Array` and add some nodes to it. If you expect the child nodes to change dynamically, `Children.Keys` is preferable.

Nested Class Summary

Nested classes/interfaces inherited from class org.openide.nodes.Children
`Children.Array, Children.Keys, Children.Map, Children.SortedArray, Children.SortedMap`

Field Summary
`protected Collection` | `nodes` vector of added children

Fields inherited from class org.openide.nodes.Children
`LEAF, MUTEX`

Constructor Summary
`` | `Children.Array()` Constructs a new array children without any assigned collection.
`protected` | `Children.Array(Collection c)` Constructs a new list and allows a subclass to provide its own implementation of `Collection` to store data in.

Method Summary
`boolean` | `add(Node[] arr)` Add nodes this container.
`Object` | `clone()` Clones all nodes that are contained in the children list.
`protected Collection` | `initCollection()` Allow subclasses to create a collection, the first time the children are used.
`protected void` | `refresh()` This method can be called by subclasses that directly modify the nodes collection to update the state of the nodes appropriatelly.
`boolean` | `remove(Node[] arr)` Remove nodes from the list.

Methods inherited from class org.openide.nodes.Children
`addNotify, findChild, getNode, getNodes, getNodes, getNodesCount, isInitialized, nodes, removeNotify`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### nodes

    protected Collection nodes

  vector of added children

Constructor Detail

### Children.Array

    protected Children.Array(Collection c)

  Constructs a new list and allows a subclass to provide its own implementation of `Collection` to store data in. The collection should be empty and should not be directly accessed in any way after creation.

  Parameters:
    `c` - collection to store data in

### Children.Array

    public Children.Array()

  Constructs a new array children without any assigned collection. The collection will be created by a call to method initCollection the first time, children will be used.

Method Detail

### clone

    public Object clone()

  Clones all nodes that are contained in the children list.

  Overrides:
    `clone` in class `Children`
  Returns:
    the cloned array for this children

### initCollection

    protected Collection initCollection()

  Allow subclasses to create a collection, the first time the children are used. It is called only if the collection has not been passed in the constructor.

  The current implementation returns ArrayList.

  Returns:
    empty or initialized collection to use

### refresh

    protected final void refresh()

  This method can be called by subclasses that directly modify the nodes collection to update the state of the nodes appropriatelly.

### add

    public boolean add(Node[] arr)

  Description copied from class: `Children`
  Add nodes this container. The parent node of these nodes is changed to the parent node of this list. Each node can be added only once. If there is some reason a node cannot be added, for example if the node expects only a special type of subnodes, the method should do nothing and return `false` to signal that the addition has not been successful.

  This method should be implemented by subclasses to filter some nodes, etc.

  Specified by:
    `add` in class `Children`
  Parameters:
    `arr` - set of nodes to add to the list
  Returns:
    `true` if successfully added

### remove

    public boolean remove(Node[] arr)

  Description copied from class: `Children`
  Remove nodes from the list. Only nodes that are present are removed.

  Specified by:
    `remove` in class `Children`
  Parameters:
    `arr` - nodes to be removed
  Returns:
    `true` if the nodes could be removed

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.