edu.stanford.hci.dtools.deviceeditor.components
Class IOComponent

java.lang.Object
  extended by edu.stanford.hci.dtools.statechart.model.ModelElement
      extended by edu.stanford.hci.dtools.deviceeditor.components.IOComponent
All Implemented Interfaces:
java.io.Serializable, org.eclipse.ui.views.properties.IPropertySource
Direct Known Subclasses:
InputComponent, OutputComponent

public abstract class IOComponent
extends ModelElement

Base class for all input & output components

This software is distributed under the BSD License.

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

Field Summary
static java.lang.String CONNECTION_PROP
          ID for hardware connection status
static float CONTINUOUS_RANGE_MAX
           
static float CONTINUOUS_RANGE_MIN
           
static java.lang.String HARDWARE_PROP
          ID for the Hardware property value (used for by the corresponding property descriptor).
static java.lang.String HIGHLIGHT_PROP
           
static java.lang.String IMAGE_PROP
          ID for the image property value (used for by the corresponding property descriptor).
static java.lang.String LOCATION_PROP
          Property ID to use when the location of this shape is modified.
static java.lang.String SIZE_PROP
          Property ID to use then the size of this shape is modified.
static java.lang.String SOCKET_PROP
           
 
Constructor Summary
IOComponent()
           
IOComponent(IOComponent copy)
           
IOComponent(java.lang.String name, java.lang.String image, org.eclipse.draw2d.geometry.Point location, org.eclipse.draw2d.geometry.Dimension dimensions, java.lang.String hardware)
          Creates a new type of button input
 
Method Summary
 java.util.List<ControlSignalSource> getControlSignalSources()
           
 java.util.List<ControlSignalTarget> getControlSignalTargets()
           
abstract  IOComponent getCopy()
           
 ContinuousControlSignalTarget getDefaultContinuousControlSignalTarget()
           
 ControlSignalSource getDefaultControlSignalSource()
          Children that can provide or accept control signals should override to return a default signal handler here.
 DiscreteControlSignalTarget getDefaultDiscreteControlSignalTarget()
           
abstract  java.lang.String getDefaultImage()
          Return a string representing the image that should be returned if there is no other image to use
 DeviceConfiguration getDeviceConfiguration()
           
 DeviceDiagramModel getDiagramComponent()
          Retrieve the DiagramModel that this shape is a child of.
 java.lang.String getHardwareAddress()
          Gets the hardware address currently associated with this IOComponent, or null if there is none
 boolean getHardwareConnection()
           
 java.lang.String getHardwareConnectionImage()
           
 boolean getHighlighted()
           
 java.lang.String getImageFilename()
          Returns an icon representing the button, used for transitions.
 org.eclipse.draw2d.geometry.Point getLocation()
          Gets the point at which the component lives in a default-sized state
 java.lang.String getName()
          Returns the name of the button
 java.lang.String getPrivateName()
          Gets the .toString() name of: 1) This component (in the DeviceEditor) 2) The component this component is descended from (in the StatechartEditor)
 org.eclipse.ui.views.properties.IPropertyDescriptor[] getPropertyDescriptors()
          Returns an array of IPropertyDescriptors for this shape.
 java.lang.Object getPropertyValue(java.lang.Object propertyId)
          Return the property value for the given propertyId, or null.
 org.eclipse.draw2d.geometry.Dimension getSize()
          Returns the dimensions of the component in a default-sized state
 boolean getSocket()
           
 java.lang.String getSocketImage()
           
 java.lang.String getTypeName()
           
 void setDeviceConfiguration(DeviceConfiguration dc)
          Sets the device configuration this Component is tied to
 void setDiagramComponent(DeviceDiagramModel newDiagram)
          Sets the diagram associated with this shape.
 void setHardwareAddress(java.lang.String address)
          Sets the hardware address of this IOComponent
 void setHardwareConnection(boolean isConnected)
           
 void setHighlighted(boolean h)
           
 void setImageFilename(java.lang.String filename)
          Sets the image representing the component, used for transitions
 void setLocation(org.eclipse.draw2d.geometry.Point newLoc)
          Sets the point at which the component lives in a default-sized state
 void setName(java.lang.String newName)
          Sets the name representing the component
 void setPrivateName(java.lang.String newName)
          Sets the .toString() name of: 1) This component (in the DeviceEditor) 2) The component this component is descended from (in the StatechartEditor)
 void setPropertyValue(java.lang.Object propertyId, java.lang.Object value)
          Set the property value for the given property id.
 void setSize(org.eclipse.draw2d.geometry.Dimension newDim)
          Sets the dimensions of the component in a default-sized state
 void setSocket(boolean s)
           
 
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, toString, wait, wait, wait
 

Field Detail

LOCATION_PROP

public static final java.lang.String LOCATION_PROP
Property ID to use when the location of this shape is modified.

See Also:
Constant Field Values

SIZE_PROP

public static final java.lang.String SIZE_PROP
Property ID to use then the size of this shape is modified.

See Also:
Constant Field Values

HARDWARE_PROP

public static final java.lang.String HARDWARE_PROP
ID for the Hardware property value (used for by the corresponding property descriptor).

See Also:
Constant Field Values

IMAGE_PROP

public static final java.lang.String IMAGE_PROP
ID for the image property value (used for by the corresponding property descriptor).

See Also:
Constant Field Values

CONNECTION_PROP

public static final java.lang.String CONNECTION_PROP
ID for hardware connection status

See Also:
Constant Field Values

HIGHLIGHT_PROP

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

SOCKET_PROP

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

CONTINUOUS_RANGE_MIN

public static final float CONTINUOUS_RANGE_MIN
See Also:
Constant Field Values

CONTINUOUS_RANGE_MAX

public static final float CONTINUOUS_RANGE_MAX
See Also:
Constant Field Values
Constructor Detail

IOComponent

public IOComponent(java.lang.String name,
                   java.lang.String image,
                   org.eclipse.draw2d.geometry.Point location,
                   org.eclipse.draw2d.geometry.Dimension dimensions,
                   java.lang.String hardware)
Creates a new type of button input

Parameters:
name - the name of the input (e.g. "play")
image - an iconic image representation of the input

IOComponent

public IOComponent()

IOComponent

public IOComponent(IOComponent copy)
Method Detail

getCopy

public abstract IOComponent getCopy()

getName

public java.lang.String getName()
Returns the name of the button

Returns:
string representing the name

setName

public void setName(java.lang.String newName)
Sets the name representing the component

Parameters:
newName -

getLocation

public org.eclipse.draw2d.geometry.Point getLocation()
Gets the point at which the component lives in a default-sized state


setLocation

public void setLocation(org.eclipse.draw2d.geometry.Point newLoc)
Sets the point at which the component lives in a default-sized state

Parameters:
newLoc -

getSize

public org.eclipse.draw2d.geometry.Dimension getSize()
Returns the dimensions of the component in a default-sized state


setSize

public void setSize(org.eclipse.draw2d.geometry.Dimension newDim)
Sets the dimensions of the component in a default-sized state


setDeviceConfiguration

public void setDeviceConfiguration(DeviceConfiguration dc)
Sets the device configuration this Component is tied to


getDeviceConfiguration

public DeviceConfiguration getDeviceConfiguration()

setHardwareAddress

public void setHardwareAddress(java.lang.String address)
Sets the hardware address of this IOComponent


getHardwareAddress

public java.lang.String getHardwareAddress()
Gets the hardware address currently associated with this IOComponent, or null if there is none


getPropertyDescriptors

public org.eclipse.ui.views.properties.IPropertyDescriptor[] getPropertyDescriptors()
Returns an array of IPropertyDescriptors for this shape.

The returned array is used to fill the property view, when the edit-part corresponding to this model element is selected.

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

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object propertyId)
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 ModelElement
See Also:
descriptors, getPropertyDescriptors()

setPropertyValue

public void setPropertyValue(java.lang.Object propertyId,
                             java.lang.Object value)
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 ModelElement
See Also:
descriptors, getPropertyDescriptors()

getDiagramComponent

public DeviceDiagramModel getDiagramComponent()
Retrieve the DiagramModel that this shape is a child of.

Returns:

setDiagramComponent

public void setDiagramComponent(DeviceDiagramModel newDiagram)
Sets the diagram associated with this shape. Should only be called once, when creating the shape. Shapes should not jump around between diagram models.


getPrivateName

public java.lang.String getPrivateName()
Gets the .toString() name of: 1) This component (in the DeviceEditor) 2) The component this component is descended from (in the StatechartEditor)

Returns:

setPrivateName

public void setPrivateName(java.lang.String newName)
Sets the .toString() name of: 1) This component (in the DeviceEditor) 2) The component this component is descended from (in the StatechartEditor)


getImageFilename

public java.lang.String getImageFilename()
Returns an icon representing the button, used for transitions. Returns null if using the default image.

Returns:
image

setImageFilename

public void setImageFilename(java.lang.String filename)
Sets the image representing the component, used for transitions

Parameters:
filename -

getDefaultImage

public abstract java.lang.String getDefaultImage()
Return a string representing the image that should be returned if there is no other image to use

Returns:

getDefaultControlSignalSource

public ControlSignalSource getDefaultControlSignalSource()
Children that can provide or accept control signals should override to return a default signal handler here.

Returns:

getDefaultDiscreteControlSignalTarget

public DiscreteControlSignalTarget getDefaultDiscreteControlSignalTarget()

getDefaultContinuousControlSignalTarget

public ContinuousControlSignalTarget getDefaultContinuousControlSignalTarget()

getHardwareConnection

public boolean getHardwareConnection()

setHardwareConnection

public void setHardwareConnection(boolean isConnected)

getHardwareConnectionImage

public java.lang.String getHardwareConnectionImage()

getSocketImage

public java.lang.String getSocketImage()

getTypeName

public java.lang.String getTypeName()

getHighlighted

public boolean getHighlighted()

setHighlighted

public void setHighlighted(boolean h)

getSocket

public boolean getSocket()

setSocket

public void setSocket(boolean s)

getControlSignalSources

public java.util.List<ControlSignalSource> getControlSignalSources()

getControlSignalTargets

public java.util.List<ControlSignalTarget> getControlSignalTargets()