All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class uhr.core.structure.ContainerStd

java.lang.Object
   |
   +----uhr.core.structure.NodeStd
           |
           +----uhr.core.structure.ContainerStd

public class ContainerStd
extends NodeStd
implements Container
This defines a container type of Node in a System Tree of Nodes. Containers hold zero or more child nodes. The root Node in a System Tree is aways a container. A container cannot contain itself.


Constructor Index

 o ContainerStd()

Method Index

 o addListener(int, ContainerListener)
Adds the listener for the eventType.
 o appendChild(Node)
Appends the child node after the last index.
 o appendPart(String, Object, boolean)
Appends the part after the last index and returns the new node the part is in.
 o enumerateChildNames()
Returns an Enumeration of all child node names in the node, in order.
 o findPart(String)
Finds and returns the named part.
 o fireSemanticEvent(String)
This is a handy dandy way for parts to notify each other of purly semantic events.
 o getChild(String)
Returns the named child node or null if not found.
 o getChildAt(int)
Returns the child node at the specified index.
 o getChildCount()
Returns the number of nodes in the cell.
 o getChildPart(String)
Returns the part in the child node with partName or null if not found.
 o insertChildBefore(Node, Node)
Inserts the child node before the nodeBefore, which must be in the Node.
 o isContainer()
Returns true if this is a container part or false if not.
 o listTree(boolean, boolean)
Returns a String representing nodes in the the System Tree.
 o removeAllChildren()
Removes all child nodes from the node.
 o removeChild(Node)
Removes the child node.
 o removeListener(int, ContainerListener)
Removes the listener for the eventType.

Constructors

 o ContainerStd
 public ContainerStd()

Methods

 o isContainer
 public boolean isContainer()
Returns true if this is a container part or false if not.

A unique type of core part is a container. It holds other container or leaf parts. All non-container parts are leaf parts. A container part requires the other core parts to run. Thus the core parts form the "container" portion of a system. We do not call this "isCell" to allow other types of containers, such as organs.

Returns:
true if this is a container or false if not.
Overrides:
isContainer in class NodeStd
 o addListener
 public void addListener(int eventType,
                         ContainerListener listener)
Adds the listener for the eventType. This approach allows a fine grained design of what events are subscribable without lots of extra event methods.

Parameters:
eventType - the event type constant. This must be ALL_NODE_EVENTS or ALL_BRANCH_EVENTS.
listener - the listener for the eventType.
Throws: IllegalArgumentException
if an invalid eventType.
 o removeListener
 public void removeListener(int eventType,
                            ContainerListener listener)
Removes the listener for the eventType.

Parameters:
eventType - the event type constant. This must be ALL_NODE_EVENTS or ALL_BRANCH_EVENTS.
listener - the listener for the eventType.
Throws: IllegalArgumentException
if an invalid eventType.
 o fireSemanticEvent
 public void fireSemanticEvent(String name)
This is a handy dandy way for parts to notify each other of purly semantic events. This method fires a ContainerEvent of type ContainerEvent.SEMANTIC with the semantic event name property equal to the provided name.

Parameters:
name - the name of the semantic event.
 o appendPart
 public Node appendPart(String partName,
                        Object part,
                        boolean isContainer)
Appends the part after the last index and returns the new node the part is in. This method is preferred to appendChild(Node node) because it configures the created node perfectly every time.

Parameters:
partName - the name of the part, which is the name of the node.
part - the part to append.
isContainer - true if the parts is a container, false if not.
Returns:
the new node the part is in.
Throws: IllegalStateException
if duplicate partName.
 o appendChild
 public void appendChild(Node node)
Appends the child node after the last index. Throws an IllegalStateException if the node has a duplicate name.

Parameters:
node - the node to append.
 o insertChildBefore
 public void insertChildBefore(Node node,
                               Node nodeBefore)
Inserts the child node before the nodeBefore, which must be in the Node. Throws an IllegalStateException if the nodeBefore is not found or the node has a duplicate name.

Parameters:
node - the node to insert.
nodeBefore - the node to insert before.
 o removeAllChildren
 public void removeAllChildren()
Removes all child nodes from the node.

 o removeChild
 public Node removeChild(Node node)
Removes the child node. Returns the node removed or null if none.

Parameters:
node - the node to remove.
 o getChildCount
 public int getChildCount()
Returns the number of nodes in the cell. We use the Bean Spec method name style rather than size().

Returns:
the number of nodes in the cell.
 o getChildAt
 public Node getChildAt(int index)
Returns the child node at the specified index.

Parameters:
index - the index of interest.
Returns:
the node at the index.
Throws: ArrayIndexOutOfBoundsException
if invalid index.
 o enumerateChildNames
 public Enumeration enumerateChildNames()
Returns an Enumeration of all child node names in the node, in order.

Returns:
the node names in the cell.
 o getChild
 public Node getChild(String nodeName)
Returns the named child node or null if not found.

Parameters:
nodeName - the name of the node to retrieve.
Returns:
the node with the nodeName or null if not found..
 o getChildPart
 public Object getChildPart(String partName)
Returns the part in the child node with partName or null if not found.

Parameters:
nodeName - the name of the part to retrieve.
Returns:
the part with the nodeName or null if not found..
 o listTree
 public String listTree(boolean startAtRoot,
                        boolean includeHidden)
Returns a String representing nodes in the the System Tree. Format is one line per node with indentation. This is for developement use.

Parameters:
startAtRoot - true to start at the root or false to start at this node.
includeHidden - true to include hidden nodes or false to not include them.
Returns:
a String representing the System Tree.
 o findPart
 public Object findPart(String partName)
Finds and returns the named part. See full documentation.

Parameters:
partName - the name of the part to find.
Returns:
the part with the partName.

All Packages  Class Hierarchy  This Package  Previous  Next  Index