etomica.graphics
Class Device

java.lang.Object
  extended by etomica.graphics.Device
All Implemented Interfaces:
GraphicalElement, Dimensioned
Direct Known Subclasses:
DeviceBox, DeviceButton, DeviceCheckBox, DeviceSelector, DeviceSlider, DeviceSpinner, DeviceTable, DeviceTernarySelector, DeviceThermoSelector, DeviceThermoSlider, DeviceToggleRadioButtons, DeviceTrioControllerButton

public abstract class Device
extends Object
implements GraphicalElement, Dimensioned

Base class for all Devices. These are objects that permit manipulation of the fields of other objects. They provide a (usually) graphical interface to permit values of fields to be input and changed.


Nested Class Summary
protected static class Device.ActionSet
           
 
Field Summary
protected  IController controller
           
protected  Unit unit
           
 
Constructor Summary
Device()
           
Device(IController controller)
           
 
Method Summary
protected  void doAction(IAction action)
          Method called by subclasses to execute the action of the device.
 IController getController()
           
 Dimension getDimension()
           
 IAction getPostAction()
           
 IAction getPreAction()
          Returns the action to be performed before the primary action executed by the device.
 Unit getUnit()
           
 Component graphic()
          Same as graphic method with a null argument.
abstract  Component graphic(Object obj)
          Interface for a Simulation element that would be used in a simulation graphical user interface (GUI)
 void setController(IController controller)
           
 void setPostAction(IAction action)
          Sets an action to be performed after the primary action executed by the device.
 void setPreAction(IAction action)
          Sets an action to be performed before the primary action executed by the device.
 void setUnit(Unit u)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unit

protected Unit unit

controller

protected IController controller
Constructor Detail

Device

public Device()

Device

public Device(IController controller)
Method Detail

doAction

protected void doAction(IAction action)
Method called by subclasses to execute the action of the device. Action is specified by the subclass as the targetAction field; if this field is null, not action is performed. The action is normally performed by calling the doActionNow method of the controller, which causes the controller's thread to perform the action as soon as possible after suspending all simulation activities. If a controller has not been defined (is null), then the action is performed on the thread calling this method.


setPreAction

public void setPreAction(IAction action)
Sets an action to be performed before the primary action executed by the device. This is useful for modifying the behavior of concrete subclasses of the device without accessing their primary action.


getPreAction

public IAction getPreAction()
Returns the action to be performed before the primary action executed by the device.


setPostAction

public void setPostAction(IAction action)
Sets an action to be performed after the primary action executed by the device. This is useful for modifying the behavior of concrete subclasses of the device without accessing their primary action.


getPostAction

public IAction getPostAction()

getController

public IController getController()
Returns:
Returns the controller.

setController

public void setController(IController controller)
Parameters:
controller - The controller to set.

graphic

public abstract Component graphic(Object obj)
Description copied from interface: GraphicalElement
Interface for a Simulation element that would be used in a simulation graphical user interface (GUI)

Specified by:
graphic in interface GraphicalElement
Parameters:
obj - An object that might be used to specify the graphic that the GraphicalElement is to return. In most cases the GraphicalElement ignores this parameter, and it can be set to null.
Returns:
A Component that can be used in the GUI of a graphical simulation
See Also:
Device, Display

graphic

public final Component graphic()
Same as graphic method with a null argument.


setUnit

public void setUnit(Unit u)
Specified by:
setUnit in interface Dimensioned

getUnit

public Unit getUnit()
Specified by:
getUnit in interface Dimensioned

getDimension

public Dimension getDimension()
Specified by:
getDimension in interface Dimensioned