Package org.graffiti.attributes
Interface CollectionAttribute
- All Superinterfaces:
Attribute,DeepCopy,Displayable
- All Known Subinterfaces:
SortedCollectionAttribute
- All Known Implementing Classes:
AbstractCollectionAttribute,ColorAttribute,CoordinateAttribute,DimensionAttribute,DockingAttribute,EdgeGraphicAttribute,EdgeLabelAttribute,EdgeLabelPositionAttribute,GraphElementGraphicAttribute,HashMapAttribute,ImageAttribute,LabelAttribute,LinkedHashMapAttribute,NodeGraphicAttribute,NodeLabelAttribute,NodeLabelPositionAttribute,PortAttribute,PortsAttribute,PositionAttribute,ShapeDescriptionAttribute
public interface CollectionAttribute extends DeepCopy, Attribute
Contains a
Collection of Attributes. It is similar
to a directory which contains files and subdirectories. All methods modifying
the CollectionAttribute (no get-Methods or anything
similar) have to inform the ListenerManager about the
modification. The ListenerManager is accessible via
getAttributable().getListenerManager().
Implementation note: The information of the
ListenerManager could look as follows:
public whatever modify() {
AttributeEvent attr = new AttributeEvent(...);
ListenerManager lm = getAttributable().getListenerManager();
lm.preAttributeModified();
// ...
// here the Attribute will be modified.
// ...
lm.postAttributeModified();
return anything;
}
- Version:
- $Revision: 1.5 $
-
Field Summary
-
Method Summary
Modifier and Type Method Description voidadd(Attribute att)Adds a givenAttributeto the list.voidadd(Attribute a, boolean inform)Adds a given attribute to the collection.AttributegetAttribute(String path)Returns theAttributelocated atpath.Map<String,Attribute>getCollection()Returns the map of ids to attributes in theCollectionAttribute.booleanisEmpty()Returnstrueif theCollectionAttributeis empty.voidremove(String id)Removes theAttributewith the givenidfrom the list.voidremove(Attribute att)Removes the givenAttributefrom the list.voidsetAttributable(Attributable att)Sets the attributable theAttributebelongs to.voidsetCollection(Map<String,Attribute> attrs)Sets the collection of attributes contained within this CollectionAttributeintsize()Methods inherited from interface org.graffiti.attributes.Attribute
getAttributable, getId, getParent, getPath, getValue, isDeleted, setDefaultValue, setDeleted, setId, setParent, setValue, toStringMethods inherited from interface org.graffiti.plugin.Displayable
getDescription, getIcon, getName, setDescription, toXMLString
-
Method Details
-
setAttributable
Sets the attributable theAttributebelongs to. Implementation Note: This function should only work if theAttribute's attributable is null before. Normaly onlyaddAttribute()methods should call it.- Parameters:
att- theAttribute's attributable.- Throws:
FieldAlreadySetException- if the attributable was already set before.
-
getAttribute
Attribute getAttribute(String path) throws AttributeNotFoundException, NoCollectionAttributeExceptionReturns theAttributelocated atpath.- Parameters:
path- the relative path to the attribute fromthis.- Returns:
- DOCUMENT ME!
- Throws:
AttributeNotFoundException- if there is no attribute at the given location.NoCollectionAttributeException
-
setCollection
Sets the collection of attributes contained within this CollectionAttribute- Parameters:
attrs- the map that contains all attributes.
-
getCollection
Returns the map of ids to attributes in theCollectionAttribute.- Returns:
- the map of ids to attributes in the
CollectionAttribute.
-
isEmpty
boolean isEmpty()Returnstrueif theCollectionAttributeis empty.- Returns:
trueif this CollectionAttribute is empty.
-
add
Adds a givenAttributeto the list. The id of given attribute may not be already in the list.- Parameters:
att- the new attribute to add to the list.- Throws:
AttributeExistsException- if there is already an attribute with the same id as the given attribute.FieldAlreadySetException
-
add
Adds a given attribute to the collection. Only informs theListenerManagerabout the addition wheninformis set to true.- Parameters:
a- the new attribute to add to the list.inform- when true,ListenerManagergets informed otherwise not- Throws:
AttributeExistsException- if there is already an attribute with the id of a.FieldAlreadySetException- thrown if Attribute a already has a parent or attributable associated with it.
-
remove
Removes theAttributewith the givenidfrom the list.- Parameters:
id- the id of the attribute.- Throws:
AttributeNotFoundException- if there is no attribute with the given id.
-
remove
Removes the givenAttributefrom the list.- Parameters:
att- the attribute to be removed.- Throws:
AttributeNotFoundException- if the given attribute is not part of thisCollectionAttribute.
-
size
int size()
-