AttributeFormatting
Class CurrencyAttributeHandler
java.lang.Object
com.wrq.vhi.script.api.AttributeEventHandler
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:
- Using the
defaultReadAttribute
method provided
by the event object to read the attribute as it is displayed
by the host application, and
- 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”).
Fields inherited from interface com.wrq.vhi.script.api.EventHandler |
DEFAULT_TIMEOUT |
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 |
description
public static final java.lang.String description
- See Also:
- Constant Field Values
CurrencyAttributeHandler
public CurrencyAttributeHandler()
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