|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.edu.agh.cast.model.visual.backward.ModelElement
public abstract class ModelElement
An abstract class for a visual model element. Provides implementation for property change support.
Field Summary | |
---|---|
static String |
ATTRIBUTE_CHANGE
Id of an event informing of attribute value changes in model elements. |
protected SortedMap<Attribute,AttributeValue> |
attributeValues
|
Constructor Summary | |
---|---|
protected |
ModelElement()
Initializes new instance. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener l)
Add a property change listener to the object. |
protected void |
bindToAttributeManager()
Registers this model elements to notifications from its attribute manager about changed properties. |
protected void |
copyAttributes(AttributeValueContainer target)
Copies attributes present in current model element to another model element. |
void |
copyAttributeValues(Mappable mappable)
Copies values of all Attribute s of mappable that are registered in this ModelElement
's AttributeManager . |
protected void |
firePropertyChange(String property,
Object oldValue,
Object newValue)
Notifies about property change. |
List<AttributeValue> |
getAllValues()
Returns complete list of attribute values in this container. |
abstract AttributeManager |
getAttributeManager()
Returns attribute manager for this container. |
AttributeValue |
getAttributeValue(String name)
Returns the value of the attribute named name . |
long |
getMid()
|
boolean |
isAttributeEditable(String attributeName)
Checks if given attribute is editable. |
boolean |
isAttributeSettable(String name)
Checks if an attribute value may be set. |
boolean |
isSaved()
|
void |
propertyChange(PropertyChangeEvent evt)
|
protected Object |
readResolve()
|
void |
removePropertyChangeListener(PropertyChangeListener l)
Remove a property change listener to the object. |
AttributeValue |
removePropertyValue(String name)
Removes attribute value from this container. |
void |
setAttributeValue(String name,
Object newValue)
Sets a new attribute value, fires change event. |
void |
setAttributeValue(String name,
Object newValue,
AttributeMergePolicy policy)
Sets a new attribute value according to given AttributeMergePolicy , fires change event. |
void |
setMid(long mid)
|
void |
setSaved(boolean saved)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ATTRIBUTE_CHANGE
PropertyChangeEvent
, old
value is of type AttributeValue
, and new value is the AttributeValue.getValue()
of the new value.
@XStreamConverter(value=AttributeValuesConverter.class) protected SortedMap<Attribute,AttributeValue> attributeValues
Constructor Detail |
---|
protected ModelElement()
Method Detail |
---|
public abstract AttributeManager getAttributeManager()
getAttributeManager
in interface AttributeValueContainer
AttributeValueContainer.getAttributeManager()
public long getMid()
public void setMid(long mid)
public boolean isSaved()
public void setSaved(boolean saved)
protected Object readResolve()
public void addPropertyChangeListener(PropertyChangeListener l)
addPropertyChangeListener
in interface IPropertyChangeProvider
l
- property change listenerIPropertyChangeProvider.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener
in interface IPropertyChangeProvider
l
- property change listener#removePropertyChangeListener(java.beans.PropertyChangeListener)
protected void firePropertyChange(String property, Object oldValue, Object newValue)
property
- name of the propertyoldValue
- old value of the propertynewValue
- new value of the propertypublic AttributeValue getAttributeValue(String name)
name
.
getAttributeValue
in interface AttributeValueContainer
name
- name of the attribute
AttributeValue
instance for the given attributeAttributeValueContainer.getAttributeValue(java.lang.String)
public boolean isAttributeSettable(String name)
name
- name of the attribute
true
if attribute value may be setpublic void setAttributeValue(String name, Object newValue)
setAttributeValue
in interface AttributeValueContainer
name
- name of the attribute to changenewValue
- new value of the attributeAttributeValueContainer.setAttributeValue(java.lang.String, java.lang.Object)
public void setAttributeValue(String name, Object newValue, AttributeMergePolicy policy)
AttributeMergePolicy
, fires change event.
If policy
is null
then acts the same as AttributeValueContainer.setAttributeValue(String, Object)
.
setAttributeValue
in interface AttributeValueContainer
name
- name of the attribute to changenewValue
- new value of the attributepolicy
- merge policyAttributeValueContainer.setAttributeValue(java.lang.String, java.lang.Object,
pl.edu.agh.cast.model.attributes.AttributeMergePolicy)
public boolean isAttributeEditable(String attributeName)
isAttributeEditable
in interface AttributeValueContainer
attributeName
- name of the attribute
AttributeValueContainer.isAttributeEditable(java.lang.String)
public List<AttributeValue> getAllValues()
getAllValues
in interface AttributeValueContainer
AttributeValue
sAttributeValueContainer.getAllValues()
public AttributeValue removePropertyValue(String name)
removePropertyValue
in interface AttributeValueContainer
name
- name of attribute to remove
AttributeValue
, or null if this attribute's value was not set (see
Collection.remove(Object)
)AttributeValueContainer.removePropertyValue(java.lang.String)
protected void copyAttributes(AttributeValueContainer target)
target
- AttributeValueContainer
to copy topublic void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
protected final void bindToAttributeManager()
public void copyAttributeValues(Mappable mappable)
Attribute
s of mappable
that are registered in this ModelElement
's AttributeManager
.
If defined, the Attribute.getDefaultMergePolicy()
policies are used in order to update particular
attribute value.
mappable
- Mappable
to copy attribute values' from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |