AttributeFormatting
Class CurrencyAttributeHandler

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

public class CurrencyAttributeHandler
extends com.wrq.vhi.script.api.AttributeEventHandler

This example illustrates how to use an event handler to read and reformat an attribute before it is sent to the client application. This is done by:

  1. Using the defaultReadAttribute method provided by the event object to read the attribute as it is displayed by the host application, and
  2. Sending the attribute value to a static method in a CurrencyFormatter class to reformat the value into the desired form.

The source code for the CurrencyFormatter class is stored in the shared examples directory. The Jar file containing the class is copied into this example's lib directory by the ant build file.

As you look at the source code for the reformat method, notice that the only data it manipulates is a method parameter. This means that this method can be safely called from any number of host sessions simultaneously (the method is ”thread safe”).


Field Summary
static java.lang.String description
           
 
Fields inherited from interface com.wrq.vhi.script.api.EventHandler
DEFAULT_TIMEOUT
 
Constructor Summary
CurrencyAttributeHandler()
           
 
Method Summary
 java.lang.String readAttribute(com.wrq.vhi.script.api.ReadAttributeEvent event)
          Called by the Host Integrator server to read the attribute.
 
Methods inherited from class com.wrq.vhi.script.api.AttributeEventHandler
writeAttribute
 
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
Constructor Detail

CurrencyAttributeHandler

public CurrencyAttributeHandler()
Method Detail

readAttribute

public java.lang.String readAttribute(com.wrq.vhi.script.api.ReadAttributeEvent event)
                               throws com.wrq.apptrieve.agent.ApptrieveException
Called by the Host Integrator server to read the attribute.

Overrides:
readAttribute in class com.wrq.vhi.script.api.AttributeEventHandler
Parameters:
event - the event instance
Returns:
the attribute value
Throws:
com.wrq.apptrieve.agent.ApptrieveException