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
  • Constructor Details

    • CompositeAttribute

      public CompositeAttribute​(String id)
      Creates a new CompositeAttribute with the given id.
      Parameters:
      id - DOCUMENT ME!
  • Method Details

    • setAttribute

      public abstract void setAttribute​(String id, Attribute att) throws AttributeNotFoundException, IllegalArgumentException
      Sets the given attribute to the given value. The attribute that is already location path is overwritten!
      Parameters:
      att - the Attribute 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 - if att has not the appropriate type.
    • getAttributes

      public abstract CollectionAttribute getAttributes()
      Transforms the CompositeAttribute 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 the CollectionAttribute have no effect on the values of this CompositeAttribute.
      Returns:
      the values of the composite attribute in a CollectionAttribute.
    • getAttribute

      public Attribute getAttribute​(String id) throws AttributeNotFoundException
      Returns the attribute with the given id. Proper ids can be obtained by calling getAttributes() and then traversing the contained Attributes and calling getId() on them. The returned Attribute is intended to be read-only. Changes to the attribute have no effect on the coresponding value in the CompositeAttribute.
      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.