edu.stanford.hci.dtools.statechart.model
Class ModelElement

java.lang.Object
  extended by edu.stanford.hci.dtools.statechart.model.ModelElement
All Implemented Interfaces:
java.io.Serializable, org.eclipse.ui.views.properties.IPropertySource
Direct Known Subclasses:
ConnectionModel, DeviceDiagramModel, DeviceModel, DiagramModel, IOComponent, ShapeModel

public abstract class ModelElement
extends java.lang.Object
implements org.eclipse.ui.views.properties.IPropertySource, java.io.Serializable

This software is distributed under the BSD License.

This code is partially based on code that is copyright (c) 2004 Elias Volanakis. See License.txt Abstract prototype of a model element.

This class provides features necessary for all model elements, like:

Author:
Elias Volanakis
See Also:
Serialized Form

Constructor Summary
ModelElement()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Attach a non-null PropertyChangeListener to this object.
 java.lang.Object getEditableValue()
          Returns a value for this property source that can be edited in a property sheet.
 org.eclipse.ui.views.properties.IPropertyDescriptor[] getPropertyDescriptors()
          Children should override this.
 java.lang.Object getPropertyValue(java.lang.Object id)
          Children should override this.
 boolean isPropertySet(java.lang.Object id)
          Children should override this.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Remove a PropertyChangeListener from this component.
 void resetPropertyValue(java.lang.Object id)
          Children should override this.
 void setPropertyValue(java.lang.Object id, java.lang.Object value)
          Children should override this.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelElement

public ModelElement()
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Attach a non-null PropertyChangeListener to this object.

Parameters:
l - a non-null PropertyChangeListener instance
Throws:
java.lang.IllegalArgumentException - if the parameter is null

getEditableValue

public java.lang.Object getEditableValue()
Returns a value for this property source that can be edited in a property sheet.

My personal rule of thumb:

Override only if necessary.

Specified by:
getEditableValue in interface org.eclipse.ui.views.properties.IPropertySource
Returns:
this instance

getPropertyDescriptors

public org.eclipse.ui.views.properties.IPropertyDescriptor[] getPropertyDescriptors()
Children should override this. The default implementation returns an empty array.

Specified by:
getPropertyDescriptors in interface org.eclipse.ui.views.properties.IPropertySource

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object id)
Children should override this. The default implementation returns null.

Specified by:
getPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource

isPropertySet

public boolean isPropertySet(java.lang.Object id)
Children should override this. The default implementation returns false.

Specified by:
isPropertySet in interface org.eclipse.ui.views.properties.IPropertySource

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a PropertyChangeListener from this component.

Parameters:
l - a PropertyChangeListener instance

resetPropertyValue

public void resetPropertyValue(java.lang.Object id)
Children should override this. The default implementation does nothing.

Specified by:
resetPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource

setPropertyValue

public void setPropertyValue(java.lang.Object id,
                             java.lang.Object value)
Children should override this. The default implementation does nothing.

Specified by:
setPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource