Package org.graffiti.attributes
Class CompositeAttribute
java.lang.Object
org.graffiti.attributes.AbstractAttribute
org.graffiti.attributes.CompositeAttribute
- All Implemented Interfaces:
Attribute,DeepCopy,Displayable
- Direct Known Subclasses:
AWTImageAttribute,LineModeAttribute
public abstract class CompositeAttribute extends AbstractAttribute
Interfaces a composite attribute. All user-defined attributes should extend
CompositeAttribute.
- Version:
- $Revision: 1.4 $
- See Also:
Attribute
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CompositeAttribute(String id)Creates a newCompositeAttributewith the given id. -
Method Summary
Modifier and Type Method Description AttributegetAttribute(String id)Returns the attribute with the given id.abstract CollectionAttributegetAttributes()Transforms theCompositeAttributeinto the basehierarchy.abstract voidsetAttribute(String id, Attribute att)Sets the given attribute to the given value.Methods inherited from class org.graffiti.attributes.AbstractAttribute
addEdgeAttributeType, addNodeAttributeType, getAttributable, getDescription, getIcon, getId, getName, getParent, getPath, getTypedAttribute, isDeleted, isTypedAttributeFromID, setDeleted, setDescription, setId, setParent, setValue, toString, toString, toXMLStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graffiti.attributes.Attribute
getValue, setDefaultValue
-
Constructor Details
-
CompositeAttribute
Creates a newCompositeAttributewith the given id.- Parameters:
id- DOCUMENT ME!
-
-
Method Details
-
setAttribute
public abstract void setAttribute(String id, Attribute att) throws AttributeNotFoundException, IllegalArgumentExceptionSets the given attribute to the given value. The attribute that is already locationpathis overwritten!- Parameters:
att- theAttributecontaining the new value for the value asociated with the given id.id- the id of the attribute to be set.- Throws:
AttributeNotFoundException- if there is no value associated with the given id.IllegalArgumentException- ifatthas not the appropriate type.
-
getAttributes
Transforms theCompositeAttributeinto the basehierarchy. Maps relative paths to the apropriate 'standard attributes' (e.g. IntegerAttribute, StringAttribute etc.) of the composite attribute. This representation is intended to be read-only - changes to theCollectionAttributehave no effect on the values of thisCompositeAttribute.- Returns:
- the values of the composite attribute in a CollectionAttribute.
-
getAttribute
Returns the attribute with the given id. Proper ids can be obtained by callinggetAttributes()and then traversing the containedAttributesand callinggetId()on them. The returnedAttributeis intended to be read-only. Changes to the attribute have no effect on the coresponding value in theCompositeAttribute.- Parameters:
id- the id of the attribute searched for.- Returns:
- the attribute with the given id.
- Throws:
AttributeNotFoundException- if the searched attribute is not found.
-