HATS 7.5.1 Web API Reference

Publicly accessible methods not documented here are for IBM internal use only and may change in a future release of the product.

com.ibm.hats.transform.components
Class Component

java.lang.Object
  extended by com.ibm.hats.transform.components.Component
All Implemented Interfaces:
ICustomPropertySupplier
Direct Known Subclasses:
AbstractTableComponent, DialogComponent, EnptuiScrollbarComponent, EnptuiSelectionFieldComponent, FieldComponent, FunctionKeyComponent, HtmlDDSComponent, InputComponent, ItemSelectionComponent, PatternComponent, SelectionListComponent, SelectorPenComponent, SubfileComponentV6, TextComponent, URLComponent

public abstract class Component
extends Object
implements ICustomPropertySupplier

The Component class is the superclass of all component classes. Components are responsible for recognizing specific host screen patterns and returning those as logical component element objects. A component class should only recognize one type of host screen pattern. For example, the FunctionKeyComponent class is responsible for recognizing function keys.

A HsrScreen object, which represents a host screen, must be passed to the constructor of each component instance. This host screen will be used by the component to recognize components in the specified region and with the specified settings.

The two recognize() methods are marked as abstract and must be overridden. These methods are responsible for recognizing components in the specified region and with the specified settings. Note: The recognize() method which accepts a LinearScreenRegion object is currently not supported by default or custom rendering requests. You can implement this method if you plan on calling it from your own implementation.


Field Summary
static String CLASS_NAME
           
protected  ContextAttributes contextAttributes
           
protected  boolean flag
           
protected  HsrScreen hostScreen
           
 
Fields inherited from interface com.ibm.hats.common.ICustomPropertySupplier
CLASSNAME
 
Constructor Summary
Component(HsrScreen hostScreen)
          Component object constructor method.
 
Method Summary
static int convertPosToCol(int pos, int numColumns)
          Convenience method to convert a linear host screen position (from 1 to (number of rows * number of columns)) to its column value.
static int convertPosToRow(int pos, int numColumns)
          Convenience method to convert a linear host screen position (from 1 to (number of rows * number of columns)) to its row value.
static int convertRowColToPos(int row, int col, int numColumns)
          Convenience method to convert a row/column position into a linear (1-based) position on the host screen.
static int[] findFirstDelimiterIndex(String str, String[] delimiters, int startPos)
          Method to find the index in the string of the highest priority delimiter.
static int[] findFirstIndexOf(char[] buffer, String[] lookFor)
           
static int[] findFirstIndexOf(String str, String[] lookFor)
           
static int[] findFirstIndexOf(String str, String[] lookFor, int startPos)
          Method to find the first index in the specified string in the set of "lookfor" strings.
static int findFirstNonWhitespaceIndex(char[] str, int startIndex)
           
static int findFirstNonWhitespaceIndex(String str)
          Convenience method which returns the index (0-based) of the first non-whitespace (space, character 0x20 in this implementation) character.
static int findFirstNonWhitespaceIndex(String str, int startIndex)
          Convenience method which returns the index (0-based) of the first non-whitespace (space, character 0x20 in this implementation) character starting at the specified index.
 Object getContextAttribute(String name)
          Returns the value of the specified context attribute.
 ContextAttributes getContextAttributes()
          Returns the table of context attributes.
 Class getCustomComposite()
          Returns a Class object (assignable from com.ibm.hats.studio.composites.BasePropertiesComposite) if a custom composite is to be used to represent the customizable properties for this object or null if dynamic GUI is to be used.
 Vector getCustomProperties(int iPageNumber, Properties properties, ResourceBundle bundle)
          Returns a list of this object's custom properties.
 Properties getDefaultValues(int iPageNumber)
          Returns this object's default property values.
 HsrScreen getHostScreen()
          Returns the host screen object used by this component.
 int getPropertyPageCount()
          Returns the number of property pages associated with this object.
static int getTrailingSpaceCount(String str)
          Returns the number of trailing spaces in a String.
static Component newInstance(String className, ClassLoader classLoader, HsrScreen hs)
          Convenience method to create a new instance of the specified className component object.
abstract  ComponentElement[] recognize(BlockScreenRegion region, Properties settings)
          Method to recognize components in the specified BlockScreenRegion using the specified settings.
abstract  ComponentElement[] recognize(com.ibm.hats.transform.regions.LinearScreenRegion region, Properties settings)
          Currently not implemented.
 ComponentElement[] recognize(ScreenRegion region, Properties settings)
          Currently not implemented.
 void setContextAttribute(String name, Object value)
          Method to set the value of a context attribute.
 void setContextAttributes(ContextAttributes contextAttributes)
          Sets the contextAttributes.
 void setHostScreen(HsrScreen hostScreen)
          Method to set the HostScreen object used by this component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME

public static final String CLASS_NAME
See Also:
Constant Field Values

hostScreen

protected HsrScreen hostScreen

contextAttributes

protected ContextAttributes contextAttributes

flag

protected boolean flag
Constructor Detail

Component

public Component(HsrScreen hostScreen)
Component object constructor method. Initialization, based on the specified host screen, should be performed in the setHostScreen() method (which is called by default from this default constructor).

Parameters:
hostScreen -
Method Detail

recognize

public abstract ComponentElement[] recognize(BlockScreenRegion region,
                                             Properties settings)
Method to recognize components in the specified BlockScreenRegion using the specified settings.

This method must be implemented if the base class is subclassed.

Parameters:
region - BlockScreenRegion to search in
settings - recognition settings
Returns:
an array of ComponentElement objects.

recognize

public abstract ComponentElement[] recognize(com.ibm.hats.transform.regions.LinearScreenRegion region,
                                             Properties settings)
Currently not implemented.

This method must be implemented if the base class is subclassed.


recognize

public ComponentElement[] recognize(ScreenRegion region,
                                    Properties settings)
Currently not implemented.


setContextAttribute

public void setContextAttribute(String name,
                                Object value)
Method to set the value of a context attribute. Context attributes are objects such as ServletContext, HttpServletRequest, etc.

Parameters:
name -
value -
See Also:
ContextAttributes

getContextAttribute

public Object getContextAttribute(String name)
Returns the value of the specified context attribute.

Parameters:
name - The name of the context attribute.
Returns:
The value of the specified context attribute.
See Also:
ContextAttributes

convertPosToRow

public static final int convertPosToRow(int pos,
                                        int numColumns)
Convenience method to convert a linear host screen position (from 1 to (number of rows * number of columns)) to its row value.

Parameters:
pos - linear (1-based) position on the host screen
numColumns - number of columns on the host screen (required to calculate row value)
Returns:
int row number of the linear position

convertPosToCol

public static final int convertPosToCol(int pos,
                                        int numColumns)
Convenience method to convert a linear host screen position (from 1 to (number of rows * number of columns)) to its column value.

Parameters:
pos - linear position on the host screen
numColumns - number of columns on the host screen (required to calculate)
Returns:
int column number of the linear position.

convertRowColToPos

public static final int convertRowColToPos(int row,
                                           int col,
                                           int numColumns)
Convenience method to convert a row/column position into a linear (1-based) position on the host screen.

Parameters:
row - row number (1-based) of the position
col - column number (1-based) of the position
numColumns - number of columns on the host screen (required to calculate)
Returns:
int linear (1-based) position of the row/column pair

setHostScreen

public void setHostScreen(HsrScreen hostScreen)
Method to set the HostScreen object used by this component. Initialization of private fields, dependent on the host screen object, should be performed in this method.

Parameters:
hostScreen -

getHostScreen

public HsrScreen getHostScreen()
Returns the host screen object used by this component.

Returns:
The host screen object used by this component.

getPropertyPageCount

public int getPropertyPageCount()
Description copied from interface: ICustomPropertySupplier
Returns the number of property pages associated with this object.

Note: Currently only 0 or 1 pages are supported.

Specified by:
getPropertyPageCount in interface ICustomPropertySupplier
Returns:
the number of defined property pages used to configure this object, or 0 if there are none

getCustomProperties

public Vector getCustomProperties(int iPageNumber,
                                  Properties properties,
                                  ResourceBundle bundle)
Description copied from interface: ICustomPropertySupplier
Returns a list of this object's custom properties. Items must be of type com.ibm.hats.common.HCustomProperty.

Specified by:
getCustomProperties in interface ICustomPropertySupplier
Parameters:
iPageNumber - page number containing desired properties
properties - existing values for properties defined here
bundle - ResourceBundle containing NLS descriptions for the properties
Returns:
Vector containing all the custom properties for this object, or null if there are none
See Also:
HCustomProperty

getCustomComposite

public Class getCustomComposite()
Description copied from interface: ICustomPropertySupplier
Returns a Class object (assignable from com.ibm.hats.studio.composites.BasePropertiesComposite) if a custom composite is to be used to represent the customizable properties for this object or null if dynamic GUI is to be used. Note: this function only applies to HATS Studio

Specified by:
getCustomComposite in interface ICustomPropertySupplier
Returns:
custom composite (of type BasePropertiesComposite) or null if dynamic GUI should be used
See Also:
BasePropertiesComposite

getDefaultValues

public Properties getDefaultValues(int iPageNumber)
Description copied from interface: ICustomPropertySupplier
Returns this object's default property values.

Specified by:
getDefaultValues in interface ICustomPropertySupplier
Parameters:
iPageNumber - page for which to retrieve default properties
Returns:
object's default properties

newInstance

public static Component newInstance(String className,
                                    ClassLoader classLoader,
                                    HsrScreen hs)
Convenience method to create a new instance of the specified className component object. Example:
     FunctionKeyComponent fkc = Component.newInstance("com.ibm.hats.transform.components.FunctionKeyComponent", classLoader, hostScreen);
 

Parameters:
className - Fully package-qualified name of the class name to use to create a new instance.
classLoader - The classloader.
hs - The HostScreen object to be used as the single constructor parameter of the new object.
Returns:
The newly created component object.

getContextAttributes

public ContextAttributes getContextAttributes()
Returns the table of context attributes. Context attributes act as a container for objects (such as the HttpServletRequest, ServletContext, Global variables) which may be needed by a component during recognition.

Returns:
ContextAttributes

setContextAttributes

public void setContextAttributes(ContextAttributes contextAttributes)
Sets the contextAttributes.

Parameters:
contextAttributes - the contextAttributes to set

findFirstIndexOf

public static int[] findFirstIndexOf(String str,
                                     String[] lookFor)

findFirstIndexOf

public static int[] findFirstIndexOf(String str,
                                     String[] lookFor,
                                     int startPos)
Method to find the first index in the specified string in the set of "lookfor" strings.

Returns an array:
index 0: index in the "str" of the first found item in "lookFor"
index 1: index in "lookFor" that was found first in the string.

Parameters:
str - The String to be searched.
lookFor - The array of items to look for in the specified string.
startPos - The linear (0-based) position in the string to start searching for "lookFor" strings.

findFirstIndexOf

public static int[] findFirstIndexOf(char[] buffer,
                                     String[] lookFor)

findFirstDelimiterIndex

public static int[] findFirstDelimiterIndex(String str,
                                            String[] delimiters,
                                            int startPos)
Method to find the index in the string of the highest priority delimiter. returns an array: index 0: index in the "str" of the first found item in "delimiter" index 1: index in "delimiter" that was found first in the string.


findFirstNonWhitespaceIndex

public static int findFirstNonWhitespaceIndex(String str)
Convenience method which returns the index (0-based) of the first non-whitespace (space, character 0x20 in this implementation) character.

Parameters:
str - String to search in
Returns:
index

findFirstNonWhitespaceIndex

public static int findFirstNonWhitespaceIndex(String str,
                                              int startIndex)
Convenience method which returns the index (0-based) of the first non-whitespace (space, character 0x20 in this implementation) character starting at the specified index.

Parameters:
str - The String to be searched.
startIndex - The index (0-based) of the specified string specifying where to commence the search.
Returns:
The index (0-based) of the first non-whitespace (space, character 0x20 in this implementation) character starting at the specified index.

findFirstNonWhitespaceIndex

public static int findFirstNonWhitespaceIndex(char[] str,
                                              int startIndex)

getTrailingSpaceCount

public static int getTrailingSpaceCount(String str)
Returns the number of trailing spaces in a String.

Parameters:
str - String to count the number of trailing spaces in
Returns:
number of trailing spaces (ie number of spaces at the end of the string)

HATS 7.5.1 (201005110649)