All Packages Class Hierarchy This Package Previous Next Index
Class ControlBeans.AbstractCommunicator
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----com.sun.java.swing.JComponent
|
+----com.sun.java.swing.JPanel
|
+----ControlBeans.AbstractCommunicator
- public abstract class AbstractCommunicator
- extends JPanel
- implements ComponentListener
This class is the class from which all communicator classes should be
inherited. AbstractCommuncator contains the methods and mechanisms needed
to allow components to register with it and have values passed on to them.
It is also prepared to allow custom communication with other classes, thus
passing values to and from the components which have registered.
-
CURRENT_TIME
- Constant used by classes invoking
putValue
.
-
myID
- The ID of the AbstractCommunicator.
-
AbstractCommunicator()
- Constructs a new AbstractCommunicator.
-
putValue(double, int, double, int)
- This method is invoked by components that wish to send double
values through this communicator.
-
putValue(int, int, double, int)
- This method is invoked by components that wish to send integer
values through this communicator.
-
putValue(String, int, double, int)
- This method is invoked by components that wish to send string
values through this communicator.
-
registerComponentEvent(ComponentEvent)
- Inherited from ComponentListener.
-
requestValues()
- Sends a request to all components to make them send their value(s).
-
sendValue(double, int, double)
- This method should be implemented by subclasses that wish to communicate
with other classes.
-
sendValue(int, int, double)
- This method should be implemented by subclasses that wish to communicate
with other classes.
-
sendValue(String, int, double)
- This method should be implemented by subclasses that wish to communicate
with other classes.
myID
protected static final int myID
- The ID of the AbstractCommunicator.
CURRENT_TIME
public static final double CURRENT_TIME
- Constant used by classes invoking
putValue
. If a value
being passed has time
set to this constant, this communicator
will change the time to the number of milliseconds passed since the
creation of it.
AbstractCommunicator
public AbstractCommunicator()
- Constructs a new AbstractCommunicator.
registerComponentEvent
public void registerComponentEvent(ComponentEvent e)
- Inherited from ComponentListener. This method receives a component
that wishes to register with this communicator. The component is
stored within it and a reply is sent to the component,
thus alerting the component of the communicators presence.
- Parameters:
- e - the event itself.
putValue
public final void putValue(int value,
int aTag,
double time,
int ID)
- This method is invoked by components that wish to send integer
values through this communicator.
If time
corresponds to
AbstractCommunicator.CURRENT_TIME
, time
will
be set to the number of milliseconds passed since the creation of this
communicator.
If ID does not correspond to AbstractCommunicator.myID
,
this method will invoke sendValue()
.
Subclasses that wish to send values to the components registered
with this communicator should also invoke this method with ID set to
AbstractCommuncator.myID
(thus preventing the invokation
of sendValue()
).
- Parameters:
- value - the value to be transmitted
- aTag - the tag of components to receive the value
- time - a time tag for the value
- ID - the ID-number of component which sent the value
putValue
public final void putValue(double value,
int aTag,
double time,
int ID)
- This method is invoked by components that wish to send double
values through this communicator.
If time
corresponds to
AbstractCommunicator.CURRENT_TIME
, time
will
be set to the number of milliseconds passed since the creation of this
communicator.
If ID does not correspond to AbstractCommunicator.myID
,
this method will invoke sendValue()
.
Subclasses that wish to send values to the components registered
with this communicator should also invoke this method with ID set to
AbstractCommuncator.myID
(thus preventing the invokation
of sendValue()
).
- Parameters:
- value - the value to be transmitted
- aTag - the tag of components to receive the value
- time - a time tag for the value
- ID - the ID-number of component which sent the value
putValue
public final void putValue(String value,
int aTag,
double time,
int ID)
- This method is invoked by components that wish to send string
values through this communicator.
If time
corresponds to
AbstractCommunicator.CURRENT_TIME
, time
will
be set to the number of milliseconds passed since the creation of this
communicator.
If ID does not correspond to AbstractCommunicator.myID
,
this method will invoke sendValue()
.
Subclasses that wish to send values to the components registered
with this communicator should also invoke this method with ID set to
AbstractCommuncator.myID
(thus preventing the invokation
of sendValue()
).
- Parameters:
- value - the value to be transmitted
- aTag - the tag of components to receive the value
- time - a time tag for the value
- ID - the ID-number of component which sent the value
requestValues
public final void requestValues()
- Sends a request to all components to make them send their value(s).
sendValue
protected abstract void sendValue(int value,
int aTag,
double time)
- This method should be implemented by subclasses that wish to communicate
with other classes. This method will be invoked by
putValue
if ID
does not correspont to
AbstractCommuncator.myID
. The method putValue
is in turn invoked by a component when it wishes to send a value.
- Parameters:
- value - the value to be transmitted
- aTag - the tag of components to receive the value
- time - a time tag for the value
sendValue
protected abstract void sendValue(double value,
int aTag,
double time)
- This method should be implemented by subclasses that wish to communicate
with other classes. This method will be invoked by
putValue
if
ID
does not correspont to
AbstractCommuncator.myID
. The method putValue
is in turn invoked by a component when it wishes to send a value.
- Parameters:
- value - the value to be transmitted
- aTag - the tag of components to receive the value
- time - a time tag for the value
sendValue
protected abstract void sendValue(String value,
int aTag,
double time)
- This method should be implemented by subclasses that wish to communicate
with other classes. This method will be invoked by
putValue
if
ID
does not correspont to
AbstractCommuncator.myID
. The method putValue
is in turn invoked by a component when it wishes to send a value.
- Parameters:
- value - the value to be transmitted
- aTag - the tag of components to receive the value
- time - a time tag for the value
All Packages Class Hierarchy This Package Previous Next Index