fieldformatting
Class CurrencyFieldHandler
java.lang.Object
com.wrq.vhi.script.api.FieldEventHandler
fieldformatting.CurrencyFieldHandler
- All Implemented Interfaces:
- com.wrq.vhi.script.api.EventHandler
public class CurrencyFieldHandler
- extends com.wrq.vhi.script.api.FieldEventHandler
This example illustrates how to use an event handler to read and
reformat a recordset field before it is sent to the client application.
This is done by:
- Using the
defaultReadField
method provided
by the event object to read the field as it is displayed
by the host application, and
- Sending the field 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 |
readField(com.wrq.vhi.script.api.ReadFieldEvent event)
Read a currency-valued field and return it in standard format. |
Methods inherited from class com.wrq.vhi.script.api.FieldEventHandler |
writeField |
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
CurrencyFieldHandler
public CurrencyFieldHandler()
readField
public java.lang.String readField(com.wrq.vhi.script.api.ReadFieldEvent event)
throws com.wrq.apptrieve.agent.ApptrieveException
- Read a currency-valued field and return it in standard format.
- Overrides:
readField
in class com.wrq.vhi.script.api.FieldEventHandler
- Parameters:
event
- the event instance
- Returns:
- the field value
- Throws:
com.wrq.apptrieve.agent.ApptrieveException