|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.edu.agh.cast.data.model.property.PropertyContainer
pl.edu.agh.cast.data.model.AbstractElement
pl.edu.agh.cast.data.model.visual.VisualElement<M>
M
- type of wrapped presentation elementpublic abstract class VisualElement<M extends IPresentationElement<? extends IElement>>
Abstract implementation of IVisualElement
.
IVisualElement
,
IVisualDataSet
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface pl.edu.agh.cast.data.model.visual.IVisualElement |
---|
IVisualElement.Properties |
Field Summary | |
---|---|
protected M |
presentationElement
A reference to presentation element which is described by this visual element. |
Fields inherited from interface pl.edu.agh.cast.data.model.visual.IVisualElement |
---|
DEFAULT_VISUAL_LABEL_ID, TYPE |
Constructor Summary | |
---|---|
protected |
VisualElement(IVisualDataSet<? extends IVisualElement<?>,? extends IPresentationDataSet<?>> dataSet,
Type type,
M presentationElement)
Constructor. |
protected |
VisualElement(IVisualDataSet<? extends IVisualElement<?>,? extends IPresentationDataSet<?>> dataSet,
Type type,
UUID id,
M presentationElement)
Constructor. |
protected |
VisualElement(Type type)
|
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener l)
Add a property change listener to the object. |
protected boolean |
checkIfValid()
Checks if the element is valid - the element reference is not null and the referenced element is valid. |
protected boolean |
checkIfValidVisualElement()
Checks if the visual element is valid. |
protected void |
firePropertyChange(String property,
Object oldValue,
Object newValue)
Fires the property change event. |
M |
getPresentationElement()
Gets element from presentation model which is described by this visual element. |
Collection<Property<? extends MetaProperty>> |
getPropertiesMarkedAsLabel()
Gets collection of properties marked as label (including properties of presentation, visual and original elements). |
String |
getVisualLabel()
Gets visual label which is created from all properties returned by IVisualDataSet.getPropertiesMarkedAsLabel(Type) . |
void |
markPropertyAsLabel(PresentationPropertyDescriptor desc,
boolean flag)
Marks given property as label. |
void |
removePropertyChangeListener(PropertyChangeListener l)
Remove a property change listener to the object. |
VisualElement<M> |
replicateTo(Object replica)
Replicates this instance state to given replica object. |
void |
setPresentationElement(M pe)
Sets the element from presentation model which is described by this visual element. |
Methods inherited from class pl.edu.agh.cast.data.model.AbstractElement |
---|
afterSetMetaPropertyManager, canReplicateTo, equals, getDataSet, getDescString, getId, getType, hashCode, isValid, replicate, setDataSet, setId, setType, toString |
Methods inherited from class pl.edu.agh.cast.data.model.property.PropertyContainer |
---|
addProperty, createProperty, dispose, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, initializeProperties, matches, removeProperty, setMetaPropertyManager, setProperty, update |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface pl.edu.agh.cast.data.model.IElement |
---|
getDataSet |
Methods inherited from interface pl.edu.agh.cast.data.model.Identifiable |
---|
getId, getType |
Methods inherited from interface pl.edu.agh.cast.data.model.property.IPropertyContainer |
---|
addProperty, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, matches, removeProperty, setProperty |
Methods inherited from interface java.util.Observer |
---|
update |
Methods inherited from interface pl.edu.agh.cast.common.IValidatable |
---|
isValid |
Methods inherited from interface pl.edu.agh.cast.common.IDisposable |
---|
dispose |
Methods inherited from interface pl.edu.agh.cast.common.IReplicable |
---|
replicate |
Field Detail |
---|
protected M extends IPresentationElement<? extends IElement> presentationElement
Constructor Detail |
---|
protected VisualElement(Type type)
protected VisualElement(IVisualDataSet<? extends IVisualElement<?>,? extends IPresentationDataSet<?>> dataSet, Type type, M presentationElement)
dataSet
- data set which this element belongs totype
- element typepresentationElement
- a presentation element which is described by this visual element.protected VisualElement(IVisualDataSet<? extends IVisualElement<?>,? extends IPresentationDataSet<?>> dataSet, Type type, UUID id, M presentationElement)
dataSet
- data set which this element belongs totype
- element typeid
- the ID of the elementpresentationElement
- a presentation element which is described by this visual element.Method Detail |
---|
protected boolean checkIfValid()
In order to allow for additional validation by subclasses, the result of checkIfValidVisualElement()
method is checked.
checkIfValid
in class AbstractElement
true
if the element is valid, false
otherwiseAbstractElement.checkIfValid()
,
checkIfValidVisualElement()
,
IValidatable.isValid()
protected boolean checkIfValidVisualElement()
This method is called by the checkIfValid()
method. By default it always returns true
,
however it can be overridden in order to define new validation rules. In such case the implementation from base
class should be called inside the overridden method in order to preserve data consistency.
true
if the visual element is valid, false
otherwisepublic M getPresentationElement()
getPresentationElement
in interface IVisualElement<M extends IPresentationElement<? extends IElement>>
IVisualElement.getPresentationElement()
public void setPresentationElement(M pe)
setPresentationElement
in interface IVisualElement<M extends IPresentationElement<? extends IElement>>
pe
- presentation element to set#setPresentationElement(pl.edu.agh.cast.data.model.presentation.IPresentationElement)
public final String getVisualLabel()
IVisualDataSet.getPropertiesMarkedAsLabel(Type)
. If marked property does not exists in given
element it is ignored. This method should be used by editor to display elements' labels.
getVisualLabel
in interface IVisualElement<M extends IPresentationElement<? extends IElement>>
IVisualElement.getVisualLabel()
public final Collection<Property<? extends MetaProperty>> getPropertiesMarkedAsLabel()
IVisualElement.DEFAULT_VISUAL_LABEL_ID
.
getPropertiesMarkedAsLabel
in interface IVisualElement<M extends IPresentationElement<? extends IElement>>
IVisualElement.getPropertiesMarkedAsLabel()
public final void markPropertyAsLabel(PresentationPropertyDescriptor desc, boolean flag)
flag
is true
the property is added to label,
otherwise it is removed from label.
markPropertyAsLabel
in interface IVisualElement<M extends IPresentationElement<? extends IElement>>
desc
- object which describes property to be added or removed from labelflag
- flag which indicate is given property is to be added or removed from label#markPropertyAsLabel(pl.edu.agh.cast.data.model.presentation.PresentationPropertyDescriptor, boolean)
public final void addPropertyChangeListener(PropertyChangeListener l)
addPropertyChangeListener
in interface IPropertyChangeProvider
l
- property change listener#addPropertyChangeListener(java.beans.PropertyChangeListener)
public final void removePropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener
in interface IPropertyChangeProvider
l
- property change listener#removePropertyChangeListener(java.beans.PropertyChangeListener)
protected final void firePropertyChange(String property, Object oldValue, Object newValue)
property
- the name of the propertyoldValue
- the old value of the propertynewValue
- the new value of the propertyPropertyChangeProviderHelper.firePropertyChange(java.lang.String,
java.lang.Object, java.lang.Object)
public VisualElement<M> replicateTo(Object replica) throws IllegalArgumentException, ReplicationException
Replicates element type and ID.
replicateTo
in interface IReplicable
replicateTo
in class AbstractElement
replica
- the object to replicate to
IllegalArgumentException
- if given object is null or of invalid type
ReplicationException
- if replication failsAbstractElement.replicateTo(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |