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 newCompositeAttribute
with the given id. -
Method Summary
Modifier and Type Method Description Attribute
getAttribute(String id)
Returns the attribute with the given id.abstract CollectionAttribute
getAttributes()
Transforms theCompositeAttribute
into the basehierarchy.abstract void
setAttribute(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, toXMLString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.graffiti.attributes.Attribute
getValue, setDefaultValue
-
Constructor Details
-
CompositeAttribute
Creates a newCompositeAttribute
with 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 locationpath
is overwritten!- Parameters:
att
- theAttribute
containing 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
- ifatt
has not the appropriate type.
-
getAttributes
Transforms theCompositeAttribute
into 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 theCollectionAttribute
have 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 containedAttributes
and callinggetId()
on them. The returnedAttribute
is 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.
-