KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > instruments > PositionControl


1 package JSci.instruments;
2
3 import java.util.*;
4 import java.awt.*;
5 import javax.swing.*;
6 import java.awt.event.*;
7 import javax.swing.event.*;
8
9 /** Describes a mechanical device that can control the position of
10  * something
11  */

12 public interface PositionControl extends Control {
13
14     /** set the position
15      * @param p the position
16      */

17     void setPosition(double p);
18
19     /** get the position that must be reached. Since the mechanical
20      * device needs some time to reach the position, getPosition()
21      * can be different from getActualPosition()
22      * @return the position that must be reached
23      */

24     double getPosition();
25
26     /** get the actual position of the device. Since the mechanical
27      * device needs some time to reach the position, getPosition()
28      * can be different from getActualPosition()
29      * @return the actual position
30      */

31     double getActualPosition();
32
33     /** get the minimum position
34      * @return the minimum position
35      */

36     double getMinimum();
37
38     /** get the maximum position
39      * @return the maximum position
40      */

41     double getMaximum();
42
43     /** sleeps for the time needed to stabilize the position.
44      */

45     void sleep();
46
47     /** get a Component through which we can control the position
48      * @return the Component with the controls for the position
49      */

50     Component getControlComponent();
51
52     /** get a String with the description of the units used
53      * for all the values.
54      * @return the unit
55      */

56     String JavaDoc getUnit();
57     
58
59
60     //////////////////////////////////////////////////////////////////
61
// Events
62

63     /** Adds a ChangeListener to the model's listener list. The
64      * ChangeListeners must be notified when the models value changes.
65      * @param l the ChangeListener to add
66      * @see #removeChangeListener
67      */

68     void addChangeListener(ChangeListener l);
69
70     /** Removes a ChangeListener from the model's listener list.
71      * @param l the ChangeListener to remove
72      * @see #addChangeListener
73      */

74     void removeChangeListener(ChangeListener l);
75
76     /** Returns an array of all the <code>ChangeListener</code>s added
77      * to this PositionControl with addChangeListener().
78      * @return all of the <code>ChangeListener</code>s added or an empty
79      * array if no listeners have been added
80      */

81     ChangeListener[] getChangeListeners();
82
83     /** Return an array of all the listeners of the given type that
84      * were added to this PositionControl. For example to find all of the
85      * ChangeListeners added to this model:
86      * @param listenerType the type of listeners to return, e.g. ChangeListener.class
87      * @return all of the objects receiving <em>listenerType</em> notifications
88      * from this model
89      */

90     EventListener[] getListeners(Class JavaDoc listenerType);
91
92
93 }
94
95
Popular Tags