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