Field

Field

Represents a field within the PresentationSpace.

Methods

getAttributes() → {AttributeSet}

Returns the set of attributes specified for this field instance.

Returns:
  • the attributes for this field instance.
Type
AttributeSet

getForegroundColor() → {Number}

Returns the foreground color for this field

Returns:
  • the foreground color, as defined in the Color object, for this field
Type
Number

getBackgroundColor() → {Number}

Returns the background color for this field

Returns:
  • the background color, as defined in the Color object, for this field.
Type
Number

getStart() → {Position}

Returns the starting position of the field, which is the position of the first character of the field. Some host types use a character position to store field level attributes. In this case, the attribute position is not considered the start position.

Throws:

for zero length fields.

Type
RangeError
Returns:
  • the starting position of the field.
Type
Position

getEnd() → {Position}

Returns the ending position of the field, which is the position in the presentation space containing the last character of the field.

Throws:

for zero length fields.

Type
RangeError
Returns:
  • the ending position of the field.
Type
Position

getLength() → {Number}

Returns the length of the field. For host types that use a character position to store field attributes, the field length does not include the field attribute position.

Returns:
  • the length of the field.
Type
Number

getDataCells() → {Array.<DataCell>}

Obtains the data cells that comprise this field.

Returns:
  • the data cells that comprise this field.
Type
Array.<DataCell>

getText() → {String}

Obtains the text from the field.

Returns:
  • the field text.
Type
String

setText(text)

Sets the field text. For certain host types like VT the text is transmitted to the host right away whereas, in other host types, the text is not transmitted to the host until an aid key is invoked. If the text is shorter than the field, the text is placed in the host field, and the remainder of the field is cleared. If the text is longer than the host field, as much text as fits is placed in the field.

Parameters:
Name Type Description
text String

the text to set on the field.

Throws:

if the field is protected.

Type
Error

clearField()

Clears the current field in an emulation-specific manner.

Throws:

if the field is protected or clear is not supported.

Type
Error

getPresentationSpace() → {PresentationSpace}

Obtains the presentation space which created this field.

Returns:
  • the parent of this field instance.
Type
PresentationSpace

toString() → {String}

Creates a user-friendly description of the field.

Returns:
  • a human-readable rendition of the field.
Type
String