com.dynamide.util
Class Composite

java.lang.Object
  extended by com.dynamide.util.CompositeAbstract
      extended by com.dynamide.util.Composite
All Implemented Interfaces:
IComposite

public class Composite
extends CompositeAbstract
implements IComposite

Composite is the base class for any item found in a tree structure. A composite can own child Composites. A Composite has a name, and any named attributes. Attributes are Objects. The special attribute 'name' is just a String. A top level Composite will not have a parent.

Author:
Laramie Crocker

Nested Class Summary
 
Nested classes/interfaces inherited from class com.dynamide.util.CompositeAbstract
CompositeAbstract.DumpWalker
 
Field Summary
 
Fields inherited from class com.dynamide.util.CompositeAbstract
ATTRIBUTE_NOT_FOUND, ATTRIBUTES_CHANGED, CHILDREN_CHANGED, NAME_CHANGED
 
Constructor Summary
Composite(java.lang.String name, IComposite parent)
           
 
Method Summary
 void addAttribute(java.lang.String attribute_name, java.lang.Object attribute_value)
           
 IComposite addChild(IComposite new_child)
          Normally, you wouldn't call addChild from user classes.
 java.lang.Object attributeByName(java.lang.String attributeName)
           
 IComposite findComposite(java.lang.String itemName)
           
 java.util.Collection getAttributes()
           
 java.util.Map getAttributesMap()
           
 int getChildCount()
           
 java.util.Collection getChildren()
           
 IComposite removeChild(IComposite old_child)
           
 
Methods inherited from class com.dynamide.util.CompositeAbstract
addChangeListener, detach, dump, dump, dumpHTML, dumpPath, finalize, get, getDepth, getName, getParent, getRoot, notifyChangeListeners, printAttributes, removeChangeListener, setName, setParent, toString, walk, walkPostOrder, walkPreOrder
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.dynamide.util.IComposite
dump, dumpHTML, dumpPath, get, getDepth, getName, getParent, getRoot, printAttributes, setParent, walk
 

Constructor Detail

Composite

public Composite(java.lang.String name,
                 IComposite parent)
Method Detail

addChild

public IComposite addChild(IComposite new_child)
                    throws java.lang.Exception
Normally, you wouldn't call addChild from user classes. Just call the constructor (String name, Composite parent). This sets the parent and adds the child to the tree.

Specified by:
addChild in interface IComposite
Specified by:
addChild in class CompositeAbstract
Throws:
java.lang.Exception

getChildren

public java.util.Collection getChildren()
Specified by:
getChildren in interface IComposite
Specified by:
getChildren in class CompositeAbstract
Returns:
An Enumeration of all direct children of this Composite.

getChildCount

public int getChildCount()
Specified by:
getChildCount in class CompositeAbstract

removeChild

public IComposite removeChild(IComposite old_child)
Specified by:
removeChild in interface IComposite
Specified by:
removeChild in class CompositeAbstract

findComposite

public IComposite findComposite(java.lang.String itemName)
                         throws java.lang.Exception
Specified by:
findComposite in interface IComposite
Specified by:
findComposite in class CompositeAbstract
Throws:
java.lang.Exception

addAttribute

public void addAttribute(java.lang.String attribute_name,
                         java.lang.Object attribute_value)
Specified by:
addAttribute in interface IComposite
Specified by:
addAttribute in class CompositeAbstract

attributeByName

public java.lang.Object attributeByName(java.lang.String attributeName)
Specified by:
attributeByName in class CompositeAbstract
Returns:
The attribute with the requested name, or null if not found.

getAttributesMap

public java.util.Map getAttributesMap()
Specified by:
getAttributesMap in class CompositeAbstract

getAttributes

public java.util.Collection getAttributes()
Specified by:
getAttributes in interface IComposite
Specified by:
getAttributes in class CompositeAbstract


Copyright © 2001-2013 DYNAMIDE.COM. All Rights Reserved.