no.gar.glink.api
Class GlinkFields

java.lang.Object
  extended by no.gar.glink.api.GlinkFields

public class GlinkFields
extends java.lang.Object

GlinkFields contains a collection of the fields in the virtual screen. It provides methods to iterate through the fields, find fields based on location, and find fields containing a given string. Each element of the collection is an instance of GlinkField.

GlinkFields can be accessed through GlinkApi using the getFields() or getVariableFields methods. GlinkFields is a static view of the virtual screen and does not reflect changes made to the virtual screen after its construction. The field list can be updated with a new view of the virtual screen using the refresh() method.

Note:All Field objects returned by methods in this class are invalidated when Refresh() is called.

See Also:
GlinkField, GlinkApi.getFields(), GlinkApi.getVariableFields()

Constructor Summary
GlinkFields(java.lang.Object object, boolean variableOnly, boolean simFld)
           
 
Method Summary
 GlinkField findByPosition(java.awt.Point targetPosition)
          Searches the collection for the target position and returns the GlinkField object containing that position.
 GlinkField findByString(java.lang.String string, java.awt.Point startPos, int length, int dir, boolean caseSensitive)
          Searches the collection for the string and returns the GlinkField object containing that string.
 int getCount()
          Returns the number of GlinkField objects contained in the current form.
 int getFieldIndex(GlinkField glField)
          Returns the index of a GlinkField object within the collection.
 GlinkField item(int fieldIndex)
          Returns the GlinkField object at the given index.
 void refresh()
          Updates the collection of GlinkField objects.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlinkFields

public GlinkFields(java.lang.Object object,
                   boolean variableOnly,
                   boolean simFld)
Method Detail

findByPosition

public GlinkField findByPosition(java.awt.Point targetPosition)
Searches the collection for the target position and returns the GlinkField object containing that position.

Parameters:
targetPosition - The target row and column.
Returns:
If found, a GlinkField object containing the target position. If not found, returns a null.

findByString

public GlinkField findByString(java.lang.String string,
                               java.awt.Point startPos,
                               int length,
                               int dir,
                               boolean caseSensitive)
Searches the collection for the string and returns the GlinkField object containing that string. The string must be totally contained within the field to be considered a match.

Parameters:
string - The string to search for.
startPos - The row and column on which to start. The position is inclusive (for example, row 1, col 1 means that position 1,1 will be used as the starting location and 1,1 will be included in the search).
length - The length from startPos to include in the search.
dir - Search direction value:

Constant Value Description
SEARCH_FORWARD 0 Forward (beginning towards end)
SEARCH_BACKWARD 1 Backward (end towards beginning)
caseSensitive - Indicates whether the search is to be case sensitive. True means the search will be case sensitive.
Returns:
If found, a GlinkField object containing the search string. If not found, returns a null.

getCount

public int getCount()
Returns the number of GlinkField objects contained in the current form.

Returns:
The number of GlinkField objects

getFieldIndex

public int getFieldIndex(GlinkField glField)
Returns the index of a GlinkField object within the collection. Indexes start at 1.

Parameters:
glField - The field
Returns:
The index of the field, or 0 if the field is not in the collection.

item

public GlinkField item(int fieldIndex)
Returns the GlinkField object at the given index. The first GlinkField is at index 1.

Parameters:
fieldIndex - The index of the target field
Returns:
The GlinkField object at the given index position.
See Also:
GlinkField

refresh

public void refresh()
Updates the collection of GlinkField objects. All GlinkField objects in the current virtual screen are added to the collection. Indexing of GlinkField objects will not be preserved across refreshes.