net.java.joglutils.msg.nodes
Class Group

java.lang.Object
  extended by net.java.joglutils.msg.nodes.Node
      extended by net.java.joglutils.msg.nodes.Group
All Implemented Interfaces:
Iterable<Node>
Direct Known Subclasses:
Separator

public class Group
extends Node
implements Iterable<Node>

A node which manages other Node instances.


Constructor Summary
Group()
           
 
Method Summary
 void addChild(Node child)
          Append a child node to the list of children nodes this group node is managing.
 void doAction(Action action)
          Performs the "typical" operation for this node when an action is applied to it.
 int findChild(Node node)
          Finds the index of given child within the group.
 Node getChild(int index)
          Returns the child node with the given index.
 int getNumChildren()
          Returns number of children.
 void insertChild(int index, Node child)
          Adds a child so that it becomes the one with the given index.
 Iterator<Node> iterator()
          Returns an Iterator over the nodes this Group contains.
 void removeAllChildren()
          Removes all children from this Group node.
 void removeChild(int index)
          Removes the child with given index from the group.
 void removeChild(Node node)
          Removes the given child from the group.
 void replaceChild(int index, Node newChild)
          Replaces the child at the given index with the new child.
 void replaceChild(Node oldChild, Node newChild)
          Replaces the old child with the new child.
 
Methods inherited from class net.java.joglutils.msg.nodes.Node
rayPick, render
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Group

public Group()
Method Detail

addChild

public void addChild(Node child)
Append a child node to the list of children nodes this group node is managing.


insertChild

public void insertChild(int index,
                        Node child)
Adds a child so that it becomes the one with the given index.


getChild

public Node getChild(int index)
Returns the child node with the given index.


findChild

public int findChild(Node node)
Finds the index of given child within the group. Returns -1 if not found.


getNumChildren

public int getNumChildren()
Returns number of children.


removeChild

public void removeChild(int index)
                 throws IndexOutOfBoundsException
Removes the child with given index from the group.

Throws:
IndexOutOfBoundsException - if the index is less than 0 or greater than the number of children

removeChild

public void removeChild(Node node)
Removes the given child from the group. This is a convenience method equivalent to calling findChild and, if the node is found, passing the index to removeChild.


removeAllChildren

public void removeAllChildren()
Removes all children from this Group node.


replaceChild

public void replaceChild(int index,
                         Node newChild)
                  throws IndexOutOfBoundsException
Replaces the child at the given index with the new child.

Throws:
IndexOutOfBoundsException - if the index is less than 0 or greater than the number of children

replaceChild

public void replaceChild(Node oldChild,
                         Node newChild)
Replaces the old child with the new child. This is a convenience method. It will simply call findChild with oldChild as argument, and call replaceChild(int, SoNode*) if the child is found.


iterator

public Iterator<Node> iterator()
Returns an Iterator over the nodes this Group contains.

Specified by:
iterator in interface Iterable<Node>

doAction

public void doAction(Action action)
Description copied from class: Node
Performs the "typical" operation for this node when an action is applied to it. The default implementation does nothing.

Overrides:
doAction in class Node