Using the HATS bidirectional API

Note:
There is no bidirectional support for standard portlet Integration Objects, global variable overrides, portlet communication, Web Services for Remote Portlets, and Light pen (attention) and Light pen (selection) host components.

If you create HATS applications that use bidirectional (Arabic or Hebrew) code pages, and you add business logic or create your own custom components or widgets, you can use the bidirectional API to handle the recognition of host components and the presentation of widgets on the Web page. This chapter describes this API. Before using the material in this chapter you should be familiar with the bidirectional concepts described in HATS User's and Administrator's Guide.

Data Conversion APIs

Two APIs for handling text conversion from visual to logical and vice versa are included in the HostScreen class. You can use these APIs when creating custom widgets and components to handle the extraction of data.

ConvertVisualToLogical

public java.lang.String ConvertVisualToLogical(java.lang.String inputBuffer, boolean isleft-to-rightVisual,
boolean isleft-to-rightImplicit)

Converts the given string from visual to implicit format and returns the implicit format of the string.

inputBuffer
The input string in visual format.
isleft-to-rightVisual
If true, inputBuffer is in visual left-to-right form.
isleft-to-rightImplicit
If true, the output buffer is in implicit left-to-right form.

ConvertLogicalToVisual

public java.lang.String ConvertLogicalToVisual(java.lang.String inputBuffer, boolean isleft-to-rightImplicit,
boolean isleft-to-rightVisual)

Converts the given string from implicit to visual format and returns the visual format of the string.

inputBuffer
The input string in implicit format.
isleft-to-rightImplicit
If true, inputBuffer is in implicit left-to-right form.
isleft-to-rightVisual
If true, the output buffer is in visual left-to-right form.

Global Variable APIs

There are two getter methods that you can use to get the value of global variables. Using these methods you can get the global variable value either in implicit format or in visual format. These two methods are in class com.ibm.hats.common.BaseInfo.

getGlobalVariable

public IGlobalVariable getGlobalVariable(String name, boolean createIfNotExist,boolean bidiImplicit)

Gets the named global variable, optionally creating it if it does not already exist.

createIfNotExist
Indicates whether or not to create a nonexistent global variable.
bidiImplicit
Indicates whether to get the global variable value in implicit format if true, or in visual format if false.

getSharedGlobalVariable

public IGlobalVariable getSharedGlobalVariable(String name, boolean createIfNotExist,boolean bidiImplicit)

Gets the named shared global variable, optionally creating it if it does not already exist.

createIfNotExist
Indicates whether or not to create a nonexistent global variable
bidiImplicit
Indicates whether to get the global variable value in implicit format if true, or in visual format if false.

BIDI OrderBean

You can use the methods of the BIDI OrderBean for the correct display of bidirectional data. It contains the following parameters:

BidiString
String. Contains bidirectional text
FromTextVisual
Boolean. Indicates whether the source bidirectional text is visual. Default is true.
FromOriLTR
Boolean. Indicates whether the orientation of the source bidirectional text is LTR. Default is true.
ToTextVisual
Boolean. Indicates whether the target bidirectional text is visual. Default is true.
ToOriLTR
Boolean. Indicates whether the orientation of the target bidirectional text is LTR. Default is true.
NeedShape
Boolean. Indicates whether bidirectional text is Arabic text and whether it needs shaping. Default is false.
CharSet
String. Defines the character encoding for the JSP.
NumShape
String. Defines the numerals shaping method. Default is Nominal.
SymSwap
Boolean. Indicates whether symmetric swapping is on. Default is false.

BIDI OrderBean methods

setBidiString
public void setBidiString (String BdString)

Sets the bidirectional text to be reordered to the given string. The only parameter is BdString, which is the bidirectional string that needs reordering.

getBidiString
public String getBidiString ()

Gets the bidirectional text. Returns the bidirectional string that needs reordering.

setFromTextVisual
public void setFromTextVisual (boolean on)

Sets the source bidirectional text type as visual. The only parameter is on. If true, defines this source bidirectional text as visual. If false, defines this source bidirectional text as implicit.

setFromOriLTR
public void setfromOriLTR (boolean on)

Sets the source bidirectional text orientation as LTR. The only parameter is on. If true, defines this source bidirectional text as LTR. If false, defines this source bidirectional text as RTL.

setToTextVisual
public void setToTextVisual (boolean on)

Sets the target bidirectional text type as visual. The only parameter is on. If true, defines this target bidirectional text as visual. If false, defines this target bidirectional text as implicit.

setToOriLTR
public void setToOriLTR (boolean on)

Sets the target bidirectional text orientation as LTR. The only parameter is on. If true, defines this target bidirectional text as LTR. If false, defines this target bidirectional text as RTL.

setEncoding
public void setEncoding (String CharSet)

Sets the encoding character set. The only parameter is CharSet, which is a character-encoding name.

setNeedShape
public void setNeedShape (boolean on)

Sets the need to perform shaping. The only parameter is on. If true, indicates the need to perform shaping on the bidirectional text.

Order
public void Order ()

Performs the ordering of the bidirectional text. There are no parameters.

CompressLamAlef
public String CompressLamAlef(String input,boolean direction)

Returns a string in which a Lam character followed by an Alef character is replaced by one LamAlef character. Parameters are:

ExpandLamAlef
public String ExpandLamAlef(String input,boolean direction)

Returns a string in which a Lam Alef character is replaced by a Lam followed by one Alef character. Parameters are:

setNumerals
public void setNumerals(String NumShape)

Sets the numerals shape of the output buffer. The only parameter is:

setSymSwap
public void setSymSwap (boolean on)

Sets the Symmetric swapping option with Visual RTL orientation. The only parameter is on. If true, symmetric swapping is enabled for swapping characters in RTL screens. If false (the default), symmetric swapping is disabled for swapping characters in RTL screens.

ShapeArabicData
public String ShapeArabicData(String strInBuffer,boolean isLTRVisual, boolean EnableNumSwap)

Returns a string in which Arabic data is shaped. Parameters are:

DeshapeArabicData
public String DeshapeArabicData (String strInBuffer,boolean isLTRVisual,boolean EnableNumSwap)

Returns a string in which Arabic data is deshaped. Parameters are:

ConvertLogicalToVisual
public java.lang.String ConvertLogicalToVisual(java.lang.String inputBuffer, boolean isLTRimplicit,
boolean isLTRVisual)

Converts the given string from implicit to visual format and returns the visual format of the string. Parameters are:

ConvertVisualToLogical
public java.lang.String ConvertVisualToLogical(java.lang.String inputBuffer, boolean isLTRVisual,
boolean isLTRimplicit)

Converts the given string from visual to implicit format and returns the implicit format of the string. Parameters are: