|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkaapo.Observable
kaapo.project.ProjectComponent
public abstract class ProjectComponent
Abstract base class for diagrams, elements and connections. ProjectComponent maintains the attribute map that all project components have. The attribute map is a collection of name/value pairs. All attributes must be added to the project component with addAttribute.
Attribute
,
Serialized FormNested Class Summary | |
---|---|
static class |
ProjectComponent.ObservableMessage
|
Field Summary | |
---|---|
protected HashMap<String,Attribute> |
attributeMap
|
protected AttributePanel |
attributePanel
|
Constructor Summary | |
---|---|
ProjectComponent()
|
Method Summary | |
---|---|
void |
addAttribute(String name,
Attribute.AttributeType type)
Adds attribute to project component with null as initial value. |
void |
addAttribute(String name,
Attribute.AttributeType type,
Object value)
Adds attribute to project component. |
protected AttributePanel |
buildAttributePanel(ProjectManager pm)
Build a new attribute panel. |
Object |
getAttribute(String name)
Returns the value of given attribute. |
Map<String,Attribute> |
getAttributeMap()
Returns the attributes as a map. |
AttributePanel |
getAttributePanel(ProjectManager pm)
Returns the attribute panel instance associated with this project component. |
abstract ImageIcon |
getSmallIcon()
Returns a 16*16 icon representing the project component type. |
abstract String |
getTypeName()
Returns the component type name formatted in a human-friendly manner. |
boolean |
hasAttribute(String name)
Tells whether the attribute is in the attribute map. |
Object |
removeAttribute(String name)
Removes attribute from project component. |
void |
setAttribute(String name,
Object value)
Sets the value of an attribute. |
Methods inherited from class kaapo.Observable |
---|
addObserver, notifyObservers, notifyObservers, removeAllObservers, removeObserver, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected HashMap<String,Attribute> attributeMap
protected transient AttributePanel attributePanel
Constructor Detail |
---|
public ProjectComponent()
Method Detail |
---|
public abstract ImageIcon getSmallIcon()
public abstract String getTypeName()
public boolean hasAttribute(String name)
name
- Attribute name
public void addAttribute(String name, Attribute.AttributeType type, Object value)
name
- Attribute nametype
- Attribute typevalue
- Initial attribute value
IllegalArgumentException
- If an attribute
with the same name is already in the project
component or if the value is of wrong type. To
replace an attribute, remove the
old one first with removeAttribute.public void addAttribute(String name, Attribute.AttributeType type)
name
- Attribute nametype
- Attribute typepublic Object getAttribute(String name)
name
- Attributename
IllegalArgumentException
- if the attribute doesn't exist.
If you're not sure whether the attribute exists, check with
hasAttribute()
first.Attribute
public void setAttribute(String name, Object value)
name
- Attribute namevalue
- New attribute value.
IllegalArgumentException
- if the attribute doesn't exist.public Object removeAttribute(String name)
name
- Name of the attribute to be removed.
IllegalArgumentException
- if the attribute doesn't exist.public Map<String,Attribute> getAttributeMap()
protected AttributePanel buildAttributePanel(ProjectManager pm)
pm
- Project Manager
GenericAttributePanel
public AttributePanel getAttributePanel(ProjectManager pm)
pm
- Project Manager. This is needed by the
attribute panel because it must access the undo
stack when modifying attributes.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |