objectivehtml.oms
Class Signal
java.lang.Object
|
+--objectivehtml.oms.Signal
- public final class Signal
- extends java.lang.Object
This object represents a signal in OMS. The object includes the method
that represents the signal and also the data that is associated
with the signal. Any public method that returns a Signal object meets the
requirements of being a signal method. However it must properly implement
the Signal pattern to work correctly.
This is the implementation of the valueChanged(String,String) signal of HtmlInput:
public Signal valueChanged(String sNewValue, String sOldValue)
{
ParameterList objParamList = new ParameterList();
objParamList.addParam(sNewValue);
objParamList.addParam(sOldValue);
Signal objSignal = null;
try
{
objSignal = new Signal(signal("valueChanged(String, String)"), objParamList);
}
catch (Exception e)
{
e.printStackTrace(); // shouldn't happen
}
return objSignal;
} // end valueChanged
To implement a signal method you need to do the following:
- Declare a public method that returns a Signal object, it should not throw an exception
- Instantiate a ParameterList object
- Add all the method parameters using the overloaded addParam method of the ParameterList class
- Instantiate a Signal object, pass to it a SignalId object that represents this
method and also the parameter list
- Return the Signal object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Signal
public Signal(SignalId objSignalId,
ParameterList objParameterList)
throws InvalidParameterListException
- Constructs an instance of Signal.
- Parameters:
objSignalId
- the signal id for this signalobjParameterList
- the list of parameters for this signal- Throws:
InvalidParameterListException
- if the number of parameters don't match or the parameter types don't match
getSignalId
public SignalId getSignalId()
- Gets the signal id for this signal.
- Returns:
- the signal id
getParameterList
public ParameterList getParameterList()
- Returns the parameter list
- Returns:
- the parameter list