DESY ACOP Beans Home

com.cosylab.gui.displayers
Class UpdateRequest

java.lang.Object
  extended by java.util.EventObject
      extended by com.cosylab.gui.displayers.UpdateRequest
All Implemented Interfaces:
java.io.Serializable

public class UpdateRequest
extends java.util.EventObject

This update request is sent to NumericAsynchonousConsumer to inform it that the source value has changed. The consumer take appropriate action, which in the case of Abeans adapter includes notifying the modeling layer about the change in target value.

See Also:
Serialized Form

Field Summary
protected  java.lang.Object newTargetValue
           
protected static long requestCount
           
protected  long requestID
           
protected  java.lang.Object targetValue
           
protected  long timestamp
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
UpdateRequest(UpdateRequestListener source)
          Constructs a new instance of this event.
UpdateRequest(UpdateRequestListener source, java.lang.Object targetValue)
          Constructs a new instance of this event.
 
Method Summary
 java.lang.Object getNewTargetValue()
          Returns the value that was actually set as confirmed by the data consumer.
 long getRequestID()
          Returns the request ID associated with this request.
 java.lang.Object getTargetValue()
          Returns the target value.
 long getTimestamp()
          Returns the timestamp (as in System.currentTimeMillis when the event was created.
 void reply(java.lang.Object newTargetValue, boolean success, java.lang.Exception exception)
          Signals the source UpdateRequestListener that the request has been processed.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

targetValue

protected java.lang.Object targetValue

newTargetValue

protected java.lang.Object newTargetValue

timestamp

protected long timestamp

requestID

protected long requestID

requestCount

protected static long requestCount
Constructor Detail

UpdateRequest

public UpdateRequest(UpdateRequestListener source)
Constructs a new instance of this event.

Parameters:
source - the listener which will receive replay for update request

UpdateRequest

public UpdateRequest(UpdateRequestListener source,
                     java.lang.Object targetValue)
Constructs a new instance of this event. The event will contain unique serial number and other data that allow the event source and target to track the request. This imposes additional performance overhead.

Parameters:
source - setter dispatching the event
targetValue - Object rendering of the target value
Throws:
java.lang.NullPointerException - if target value is null
Method Detail

getTimestamp

public long getTimestamp()
Returns the timestamp (as in System.currentTimeMillis when the event was created. Will return 0 if the event was created with single-paramter constructor.

Returns:
long timestamp

getRequestID

public long getRequestID()
Returns the request ID associated with this request. IDs are unique within the JVM session. Will return 0 if the event was created with single-parameter constructor.

Returns:
long UID

reply

public void reply(java.lang.Object newTargetValue,
                  boolean success,
                  java.lang.Exception exception)
Signals the source UpdateRequestListener that the request has been processed. This method may be invoked only by the asynchronous data consumer. This is a callback and needs to be called for each asynchronous update request. The event will delegate the call to the source UpdateRequestListener.

Parameters:
newTargetValue - the new value of the dynamic value after the set operation. If success indicates true, this value should be the same as the requested value for setting. Otherwise, this value may be something else (for instance, if setter wants to set above maximum, the actual value set may be maximum allowed limit).
success - true if update process proceeded without problems, as defined by the asynchonous data consumer
exception - the exception thrown during unsuccesful update

getNewTargetValue

public java.lang.Object getNewTargetValue()
Returns the value that was actually set as confirmed by the data consumer. This value may differ from the targetValue requested by the update requestor because of the possible exceptional conditions in the modeling layer. This method will return null if the event was created with the single-parameter constructor. Note: it is the responsibility of the adapter to synchronize the target value of the setter with the confirmed value after the set by calling setTargetValue on the setter.

Returns:
Object an object rendering of the confirmed target value or null if single parameter constructor was used.

getTargetValue

public java.lang.Object getTargetValue()
Returns the target value. Target value is the value requested by update requestor to be set in the modeling layer by the asynchronous data consumer. This method will return null if the event was instantiated with the single parameter constructor.

Returns:
Object an object rendering of the target value or null if single parameter constructor was used.


Copyright © 2010. All Rights Reserved.