JSci.instruments
Class PositionControlAdapter

java.lang.Object
  extended by JSci.instruments.PositionControlAdapter
All Implemented Interfaces:
Control, PositionControl
Direct Known Subclasses:
DummyPositionControl, Mercury

public abstract class PositionControlAdapter
extends java.lang.Object
implements PositionControl

A mechanical device that can control the position of something. Implements the methods to notify changes.


Field Summary
protected  javax.swing.event.EventListenerList listenerList
          The list of ChangeListeners for this model.
 
Constructor Summary
PositionControlAdapter()
           
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds a ChangeListener to the model's listener list.
protected  void fireStateChanged()
          Run each ChangeListeners stateChanged() method.
abstract  double getActualPosition()
          get the actual position of the device.
 javax.swing.event.ChangeListener[] getChangeListeners()
          Returns an array of all the ChangeListeners added to this model with addChangeListener().
abstract  java.awt.Component getControlComponent()
          get a Component through which we can control the position
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Return an array of all the listeners of the given type that were added to this model.
abstract  double getMaximum()
          get the maximum position
abstract  double getMinimum()
          get the minimum position
abstract  double getPosition()
          get the position that must be reached.
abstract  java.lang.String getUnit()
          get a String with the description of the units used for all the values.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes a ChangeListener from the model's listener list.
abstract  void setPosition(double p)
          set the position
abstract  void sleep()
          sleeps for the time needed to stabilize the position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected javax.swing.event.EventListenerList listenerList
The list of ChangeListeners for this model. Subclasses may store their own listeners here.

Constructor Detail

PositionControlAdapter

public PositionControlAdapter()
Method Detail

setPosition

public abstract void setPosition(double p)
set the position

Specified by:
setPosition in interface PositionControl
Parameters:
p - the position

getPosition

public abstract double getPosition()
get the position that must be reached. Since the mechanical device needs some time to reach the position, getPosition() can be different from getActualPosition()

Specified by:
getPosition in interface PositionControl
Returns:
the position that must be reached

getActualPosition

public abstract double getActualPosition()
get the actual position of the device. Since the mechanical device needs some time to reach the position, getPosition() can be different from getActualPosition()

Specified by:
getActualPosition in interface PositionControl
Returns:
the actual position

getMinimum

public abstract double getMinimum()
get the minimum position

Specified by:
getMinimum in interface PositionControl
Returns:
the minimum position

getMaximum

public abstract double getMaximum()
get the maximum position

Specified by:
getMaximum in interface PositionControl
Returns:
the maximum position

sleep

public abstract void sleep()
sleeps for the time needed to stabilize the position.

Specified by:
sleep in interface PositionControl

getControlComponent

public abstract java.awt.Component getControlComponent()
get a Component through which we can control the position

Specified by:
getControlComponent in interface Control
Specified by:
getControlComponent in interface PositionControl
Returns:
the Component with the controls for the position

getUnit

public abstract java.lang.String getUnit()
get a String with the description of the units used for all the values.

Specified by:
getUnit in interface PositionControl
Returns:
the unit

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener to the model's listener list. The ChangeListeners must be notified when the models value changes.

Specified by:
addChangeListener in interface PositionControl
Parameters:
l - the ChangeListener to add
See Also:
removeChangeListener(javax.swing.event.ChangeListener)

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener from the model's listener list.

Specified by:
removeChangeListener in interface PositionControl
Parameters:
l - the ChangeListener to remove
See Also:
addChangeListener(javax.swing.event.ChangeListener)

getChangeListeners

public javax.swing.event.ChangeListener[] getChangeListeners()
Returns an array of all the ChangeListeners added to this model with addChangeListener().

Specified by:
getChangeListeners in interface PositionControl
Returns:
all of the ChangeListeners added or an empty array if no listeners have been added

fireStateChanged

protected void fireStateChanged()
Run each ChangeListeners stateChanged() method.

See Also:
EventListenerList

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Return an array of all the listeners of the given type that were added to this model.

Specified by:
getListeners in interface PositionControl
Parameters:
listenerType - the type of listeners to return, e.g. ChangeListener.class
Returns:
all of the objects receiving listenerType notifications from this model