writeattributes
Class AddressEdit

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

public class AddressEdit
extends com.wrq.vhi.script.api.EntityEventHandler

Entity event listener.

This event handler implements the Write Attributes event. The purpose of this event is to allow an event handler with special knowledge of how to move around the screen to choose the order in which attributes are written.

In this case the attributes are sorted into the order they have on the screen using a priority queue. The event handler iterates through the set of attributes to be written, binds each attribute name with its position on the screen in an AddressEdit object, and tells the priority queue to add the attribute in tab order. Then the writeAttributes handler compares the current cursor position with the first and last attributes to be written, chooses the closest one, and uses an iterator to write the attributes in tab order.

This kind of an optimization is illustrated here only to show that doing this kind of ordering complicates the event handler a bit: it is worth the effort only when it speeds host access considerably.


Nested Class Summary
private  class AddressEdit.AttributeRegion
          Pair binding an attribute name to its position on the screen.
private  class AddressEdit.PriorityQueue
          Priority queue used to order the writing of attributes.
 
Field Summary
static java.lang.String description
           
static int entityArrivalTimeout
          Timeout in seconds for the entityArrival() event.
static int entityDepartureTimeout
          Timeout in seconds for the entityDeparture() event.
private static int errWaitForHostDataTimeout
          Event timeout error code.
static int moveCursorTimeout
          Timeout in seconds for the moveCursor() event.
static int writeAttributesTimeout
          Timeout in seconds for the writeAttributes() event.
 
Fields inherited from interface com.wrq.vhi.script.api.EventHandler
DEFAULT_TIMEOUT
 
Constructor Summary
AddressEdit()
           
 
Method Summary
 void writeAttributes(com.wrq.vhi.script.api.WriteAttributesEvent event)
          Write one or more attributes to the terminal screen in optimal order.
 
Methods inherited from class com.wrq.vhi.script.api.EntityEventHandler
entityArrival, entityDeparture, moveCursor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

public static final java.lang.String description
See Also:
Constant Field Values

errWaitForHostDataTimeout

private static final int errWaitForHostDataTimeout
Event timeout error code.

See Also:
Constant Field Values

entityArrivalTimeout

public static final int entityArrivalTimeout
Timeout in seconds for the entityArrival() event. A value of DEFAULT_TIMEOUT means the event will use the model defined default event timeout.

See Also:
Constant Field Values

entityDepartureTimeout

public static final int entityDepartureTimeout
Timeout in seconds for the entityDeparture() event. A value of DEFAULT_TIMEOUT means the event will use the model defined default event timeout.

See Also:
Constant Field Values

moveCursorTimeout

public static final int moveCursorTimeout
Timeout in seconds for the moveCursor() event. A value of DEFAULT_TIMEOUT means the event will use the model defined default event timeout.

See Also:
Constant Field Values

writeAttributesTimeout

public static final int writeAttributesTimeout
Timeout in seconds for the writeAttributes() event. A value of DEFAULT_TIMEOUT means the event will use the model defined default event timeout.

See Also:
Constant Field Values
Constructor Detail

AddressEdit

public AddressEdit()
Method Detail

writeAttributes

public void writeAttributes(com.wrq.vhi.script.api.WriteAttributesEvent event)
                     throws com.wrq.apptrieve.agent.ApptrieveException
Write one or more attributes to the terminal screen in optimal order.

Overrides:
writeAttributes in class com.wrq.vhi.script.api.EntityEventHandler
Parameters:
event - the event instance
Throws:
com.wrq.apptrieve.agent.ApptrieveException