com.wrq.vhi.script.api
Class EntityEventHandler

java.lang.Object
  extended by com.wrq.vhi.script.api.EntityEventHandler
All Implemented Interfaces:
EventHandler

public abstract class EntityEventHandler
extends java.lang.Object
implements EventHandler

Abstract base class for an entity event handler. All classes that extend this class appear as entity event handlers in the VHI design tool.


Field Summary
 
Fields inherited from interface com.wrq.vhi.script.api.EventHandler
DEFAULT_TIMEOUT
 
Constructor Summary
EntityEventHandler()
           
 
Method Summary
 void entityArrival(EntityArrivalEvent event)
          Called when a new entity is recognized and validated as defined in the model.
 void entityDeparture(EntityDepartureEvent event)
          Called when the current entity is no longer recognized.
 void moveCursor(EntityMoveCursorEvent event)
          Called when the cursor needs to move to a specific location on the terminal screen.
 void writeAttributes(WriteAttributesEvent event)
          Called when when a client or procedure requests to write one or more attributes on the entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityEventHandler

public EntityEventHandler()
Method Detail

entityArrival

public void entityArrival(EntityArrivalEvent event)
                   throws ApptrieveException
Called when a new entity is recognized and validated as defined in the model.

Any exception thrown from this event will cause the currently running operation, if any, to fail.

Parameters:
event - the event instance
Throws:
ApptrieveException

entityDeparture

public void entityDeparture(EntityDepartureEvent event)
                     throws ApptrieveException
Called when the current entity is no longer recognized. If another entity is not recognized, this event can override the departure and stay at the previously recognized entity. When departure is overridden, this event will fire again the next time data is received from the host.

Any exception thrown from this event will cause the currently running operation, if any, to fail.

Parameters:
event - the event instance
Throws:
ApptrieveException

moveCursor

public void moveCursor(EntityMoveCursorEvent event)
                throws ApptrieveException
Called when the cursor needs to move to a specific location on the terminal screen. This event will fire in repsonse to the following commands if the cursor is not already at the requested location:

If no method to move the cursor forward or backward is defined for a character mode model, this event will fire to position the cursor at each attribute and field before writing.

If the cursor is not positioned at the specified location upon returning from the event, VHI will fail the current client request.

Any exception thrown from this event will cause the current command to fail.

Parameters:
event - the event instance
Throws:
ApptrieveException

writeAttributes

public void writeAttributes(WriteAttributesEvent event)
                     throws ApptrieveException
Called when when a client or procedure requests to write one or more attributes on the entity. In addition, the event is fired in response to the following commands:

This event is not fired when an attribute or field is written with one of the following commands:

The intended usage of this event is to orchestrate the order of attribute writes and the cursor movement between them. The actual writing of each attribute to the terminal can be done, but its recommended to use WriteAttributesEvent.writeAttribute(java.lang.String, java.lang.String) to write each attribute. This method ensures that the appropriate AttributeEventHandler.writeAttribute(com.wrq.vhi.script.api.WriteAttributeEvent) event handler, if any, is called.

Any exception thrown from this event will cause the write request to fail.

Parameters:
event - the event instance
Throws:
ApptrieveException