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

java.lang.Object
  extended by edu.stanford.hci.dtools.statechart.model.ModelElement
      extended by edu.stanford.hci.dtools.statechart.model.ShapeModel
          extended by edu.stanford.hci.dtools.statechart.model.StateModel
All Implemented Interfaces:
java.io.Serializable, org.eclipse.ui.views.properties.IPropertySource

public class StateModel
extends ShapeModel

This software is distributed under the BSD License.

Author:
Michael Bernstein ( mbernst(AT)stanford.edu ), Bjoern Hartmann ( bjoern(AT)stanford.edu )
See Also:
Serialized Form

Field Summary
static java.lang.String CHILD_ADDED_PROP
          Property ID to use when a child is added to this diagram.
static java.lang.String CHILD_REMOVED_PROP
          Property ID to use when a child is removed from this diagram.
static java.lang.String CURRENT_RUN_MODE_STATE
          Property ID to use when the state becomes the current state in Run Mode
static java.lang.String DEVICE_CONFIG_PROP
          Property ID to use when the device config has been changed and we have new children
static java.lang.String HAS_SOURCE_CODE_PROP
           
static java.lang.String START_RUN_MODE_STATE
          Property ID to use when the state is the start state for Run Mode
static java.lang.String STATENAME_CHANGED_PROP
           
static java.lang.String STATENAME_PROP
          Property ID to use when a child is added to this diagram.
 
Fields inherited from class edu.stanford.hci.dtools.statechart.model.ShapeModel
DIAGRAM_PROP, LOCATION_PROP, SIZE_PROP, SOURCE_CONNECTIONS_PROP, TARGET_CONNECTIONS_PROP
 
Constructor Summary
StateModel()
           
 
Method Summary
 boolean addChild(IOModel s)
          Add a component to this diagram.
 java.util.List<IOModel> getChildren()
          Return a List of IOmodels in this diagram.
 java.lang.Boolean getCurrentState()
           
 org.eclipse.swt.graphics.Image getIcon()
          Return a pictogram (small icon) describing this model element.
 java.lang.String getJavaClassName()
           
 java.lang.String getJavaFileName()
           
 java.lang.Object getPropertyValue(java.lang.Object propertyId)
          Return the property value for the given propertyId, or null.
 java.lang.Boolean getStartState()
           
 java.lang.String getStateName()
           
 boolean hasCode()
           
 void realizeStateInHardware()
          Tells all its children to realize themselves (if they're capable of doing so)
 boolean removeAllChildren()
           
 boolean removeChild(IOModel s)
          Remove a shape from this diagram.
 void setCurrentState(java.lang.Boolean isCurrentState)
          Tell this state it is (or is not) the current state in run mode
 void setDiagramModel(DiagramModel newDiagram)
          Tells this state which diagram model it's associated with
 void setHasCode(boolean b)
           
 void setLocation(org.eclipse.draw2d.geometry.Point newLoc)
          Set the Location of this shape.
 void setPropertyValue(java.lang.Object propertyId, java.lang.Object value)
          Set the property value for the given property id.
 void setStartState(java.lang.Boolean isStartState)
          Tell this state it is the start state for Run Mode
 void setStateName(java.lang.String s)
           
 java.lang.String toString()
           
 void updateBoundsForDeviceConfig(DeviceConfiguration deviceConfig)
          Resizes the state based on the new device size
 void updateDeviceConfiguration(DeviceConfiguration deviceConfig, IOComponentHashMap deviceMapping, java.util.Map<StateModel,java.util.List<ComponentConnectionModel>> componentConnectionMap)
          Sets the state up with whatever the current device configuaration is.
 
Methods inherited from class edu.stanford.hci.dtools.statechart.model.ShapeModel
createImage, getDiagramModel, getLocation, getPropertyDescriptors, getSize, getSourceConnections, getTargetConnections, setSize
 
Methods inherited from class edu.stanford.hci.dtools.statechart.model.ModelElement
addPropertyChangeListener, getEditableValue, isPropertySet, removePropertyChangeListener, resetPropertyValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHILD_ADDED_PROP

public static final java.lang.String CHILD_ADDED_PROP
Property ID to use when a child is added to this diagram.

See Also:
Constant Field Values

CHILD_REMOVED_PROP

public static final java.lang.String CHILD_REMOVED_PROP
Property ID to use when a child is removed from this diagram.

See Also:
Constant Field Values

CURRENT_RUN_MODE_STATE

public static final java.lang.String CURRENT_RUN_MODE_STATE
Property ID to use when the state becomes the current state in Run Mode

See Also:
Constant Field Values

START_RUN_MODE_STATE

public static final java.lang.String START_RUN_MODE_STATE
Property ID to use when the state is the start state for Run Mode

See Also:
Constant Field Values

DEVICE_CONFIG_PROP

public static final java.lang.String DEVICE_CONFIG_PROP
Property ID to use when the device config has been changed and we have new children

See Also:
Constant Field Values

STATENAME_PROP

public static final java.lang.String STATENAME_PROP
Property ID to use when a child is added to this diagram.

See Also:
Constant Field Values

STATENAME_CHANGED_PROP

public static final java.lang.String STATENAME_CHANGED_PROP
See Also:
Constant Field Values

HAS_SOURCE_CODE_PROP

public static final java.lang.String HAS_SOURCE_CODE_PROP
See Also:
Constant Field Values
Constructor Detail

StateModel

public StateModel()
Method Detail

updateDeviceConfiguration

public void updateDeviceConfiguration(DeviceConfiguration deviceConfig,
                                      IOComponentHashMap deviceMapping,
                                      java.util.Map<StateModel,java.util.List<ComponentConnectionModel>> componentConnectionMap)
Sets the state up with whatever the current device configuaration is. Use at first creation and then again whenever the device configuration is changed.


updateBoundsForDeviceConfig

public void updateBoundsForDeviceConfig(DeviceConfiguration deviceConfig)
Resizes the state based on the new device size

Parameters:
deviceConfig -

getIcon

public org.eclipse.swt.graphics.Image getIcon()
Description copied from class: ShapeModel
Return a pictogram (small icon) describing this model element. Children should override this method and return an appropriate Image.

Specified by:
getIcon in class ShapeModel
Returns:
a 16x16 Image or null

setCurrentState

public void setCurrentState(java.lang.Boolean isCurrentState)
Tell this state it is (or is not) the current state in run mode

Parameters:
isCurrentState -

getCurrentState

public java.lang.Boolean getCurrentState()

setStartState

public void setStartState(java.lang.Boolean isStartState)
Tell this state it is the start state for Run Mode

Parameters:
isStartState -

getStartState

public java.lang.Boolean getStartState()

setLocation

public void setLocation(org.eclipse.draw2d.geometry.Point newLoc)
Description copied from class: ShapeModel
Set the Location of this shape.

Overrides:
setLocation in class ShapeModel
Parameters:
newLoc - a non-null Point instance

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object propertyId)
Description copied from class: ShapeModel
Return the property value for the given propertyId, or null.

The property view uses the IDs from the IPropertyDescriptors array to obtain the value of the corresponding properties.

Specified by:
getPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource
Overrides:
getPropertyValue in class ShapeModel
See Also:
ShapeModel.descriptors, ShapeModel.getPropertyDescriptors()

setDiagramModel

public void setDiagramModel(DiagramModel newDiagram)
Tells this state which diagram model it's associated with

Overrides:
setDiagramModel in class ShapeModel

setPropertyValue

public void setPropertyValue(java.lang.Object propertyId,
                             java.lang.Object value)
Description copied from class: ShapeModel
Set the property value for the given property id. If no matching id is found, the call is forwarded to the superclass.

The property view uses the IDs from the IPropertyDescriptors array to set the values of the corresponding properties.

Specified by:
setPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource
Overrides:
setPropertyValue in class ShapeModel
See Also:
ShapeModel.descriptors, ShapeModel.getPropertyDescriptors()

realizeStateInHardware

public void realizeStateInHardware()
Tells all its children to realize themselves (if they're capable of doing so)


addChild

public boolean addChild(IOModel s)
Add a component to this diagram.

Parameters:
s - a non-null shape instance
Returns:
true, if the shape was added, false otherwise

getChildren

public java.util.List<IOModel> getChildren()
Return a List of IOmodels in this diagram. The returned List should not be modified.


removeChild

public boolean removeChild(IOModel s)
Remove a shape from this diagram.

Parameters:
s - a non-null shape instance;
Returns:
true, if the shape was removed, false otherwise

removeAllChildren

public boolean removeAllChildren()

getStateName

public java.lang.String getStateName()

setStateName

public void setStateName(java.lang.String s)

hasCode

public boolean hasCode()

getJavaFileName

public java.lang.String getJavaFileName()

getJavaClassName

public java.lang.String getJavaClassName()

setHasCode

public void setHasCode(boolean b)