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 Attribute
s. 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 void
add(Attribute att)
Adds a givenAttribute
to the list.void
add(Attribute a, boolean inform)
Adds a given attribute to the collection.Attribute
getAttribute(String path)
Returns theAttribute
located atpath
.Map<String,Attribute>
getCollection()
Returns the map of ids to attributes in theCollectionAttribute
.boolean
isEmpty()
Returnstrue
if theCollectionAttribute
is empty.void
remove(String id)
Removes theAttribute
with the givenid
from the list.void
remove(Attribute att)
Removes the givenAttribute
from the list.void
setAttributable(Attributable att)
Sets the attributable theAttribute
belongs to.void
setCollection(Map<String,Attribute> attrs)
Sets the collection of attributes contained within this CollectionAttributeint
size()
Methods inherited from interface org.graffiti.attributes.Attribute
getAttributable, getId, getParent, getPath, getValue, isDeleted, setDefaultValue, setDeleted, setId, setParent, setValue, toString
Methods inherited from interface org.graffiti.plugin.Displayable
getDescription, getIcon, getName, setDescription, toXMLString
-
Method Details
-
setAttributable
Sets the attributable theAttribute
belongs 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 theAttribute
located 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()Returnstrue
if theCollectionAttribute
is empty.- Returns:
true
if this CollectionAttribute is empty.
-
add
Adds a givenAttribute
to 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 theListenerManager
about the addition wheninform
is set to true.- Parameters:
a
- the new attribute to add to the list.inform
- when true,ListenerManager
gets 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 theAttribute
with the givenid
from the list.- Parameters:
id
- the id of the attribute.- Throws:
AttributeNotFoundException
- if there is no attribute with the given id.
-
remove
Removes the givenAttribute
from the list.- Parameters:
att
- the attribute to be removed.- Throws:
AttributeNotFoundException
- if the given attribute is not part of thisCollectionAttribute
.
-
size
int size()
-