Class ScreenFieldProp

java.lang.Object
com.iizix.prop.GProp<GProp<?>[]>
com.iizix.prop.PropCnr
com.iizix.term.prop.ScreenFieldProp
All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, IVSColumnBestValueListener, IVSColumnListener, IVSComponentListener, IVSComponentReferenceProvider, IVSComponentState, IVSFieldListener, Cloneable
Direct Known Subclasses:
EditorScreenFieldProp

public class ScreenFieldProp extends PropCnr implements IVSComponentReferenceProvider, IVSFieldListener, IVSColumnListener
This Screen Field property container for a terminal host screen.
  • Field Details

  • Constructor Details

    • ScreenFieldProp

      public ScreenFieldProp()
      Creates the Screen Field property container without a name. The name must be set in all cases using the setPropertyAtom call.
    • ScreenFieldProp

      public ScreenFieldProp(Atom propertyAtom)
      Creates the Screen Field property container with the specified name. All system-reserved names for components begins with "$".
      Parameters:
      propertyAtom - the name of the component, unique within it's parent.
  • Method Details

    • getTypeString

      public static String getTypeString(int type)
      Gets the string for a field type.
    • usesPropIndex

      public boolean usesPropIndex()
      This property is index based.
      Specified by:
      usesPropIndex in interface IPropCnr
      Overrides:
      usesPropIndex in class PropCnr
      Returns:
      true.
    • clone

      Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.

      Cloning is used for "virtualization" of a property tree in the server. Client property classes will therefore throw CloneNotSupportedException.

      Once a tree has been cloned, the change-flag is reset, and the create-flag is set. All listeners are also removed! The new cloned property is an orphan, i.e. has no parent set. All children properties are also (deep) cloned.

      Note that the cloning process is done WITHOUT thread synchronization for performance reasons, thus no modifications should be done to the tree!

      Overrides:
      clone in class PropCnr
      Throws:
      CloneNotSupportedException - If a subclass doesn't allow cloning, e.g. the client properties.
    • updateCachedValues

      protected void updateCachedValues()
      Updates the cached values.
    • getType

      public int getType()
      Gets the type.
    • getTypeString

      public String getTypeString()
      Gets the field type string.
    • isDynamic

      public boolean isDynamic()
      Gets the definition of the dynamic property "snap".
      Returns:
      true if defined as dynamic screen field, false otherwise.
    • isWrappingAllowed

      public boolean isWrappingAllowed()
      Gets the definition of the dynamic property "wrap".
      Returns:
      true if dynamic screen fields are allowed to wrap, false otherwise.
    • isContinued

      public boolean isContinued()
      Checks if the field is continued, i.e. if there is a next-continued field.
    • getNextContinued

      public ScreenFieldProp getNextContinued()
      Gets the next continued field.
      Returns:
      null for none.
    • isContinuation

      public boolean isContinuation()
      Checks if this field is a continuation of a field, i.e. a "child" field.
    • getScreen

      public ScreenProp getScreen()
      Gets the screen property.
    • doesScreenMatch

      public boolean doesScreenMatch(HostScreen screen)
      Checks if this host field belongs to a screen that is currently matching or not.
    • doesScreenMatch

      public boolean doesScreenMatch(HostSession hostSession)
      Checks if this host field belongs to a screen that is currently matching or not.
    • getX

      public int getX()
      Get the horizontal position.
    • getY

      public int getY()
      Get the vertical position.
    • getCX

      public int getCX()
      Get the width.
    • getCY

      public int getCY()
      Get the height.
    • getWidth

      public int getWidth(int line)
      Gets the with of a specific line in the host field. If the index is negative, the total with is returned.
      Returns:
      -1 if not found, otherwise the width.
      See Also:
    • getTotalWidth

      public int getTotalWidth()
      Get this field total width. If the field is continued or has multiple lines, the entire size is calculated. This size is mostly used for e.g. an entry field that is connected to a host field that wraps over the screen (and is therefore continued).
    • getTotalWidth

      public int getTotalWidth(HostScreen screen, boolean isDynamic)
      Get this field total width. If the field is continued or has multiple lines, the entire size is calculated. This size is mostly used for e.g. an entry field that is connected to a host field that wraps over the screen (and is therefore continued).
    • getTotalWidth

      public int getTotalWidth(HostScreen screen, boolean isDynamic, boolean dontWrap)
      Get this field total width. If the field is continued or has multiple lines, the entire size is calculated. This size is mostly used for e.g. an entry field that is connected to a host field that wraps over the screen (and is therefore continued).

      The "dontWrap" flag is only valid when the flag "isDynamic" is true.

    • isScreenNonCurrentPopup

      public boolean isScreenNonCurrentPopup()
      Check if data is to be retrieved from this screen and it's not the current pop-up screen, rather a "main screen" behind, then methods fetching data using "relative" methods should use "absolute" ones instead.

      Typically his would be used when e,g, REXX used HostGetFld('MAINSCREEN','SOMEFLD') and without this method it wouldn't work.

      Returns:
      true if this PhantomScreen is not a pop-up.
    • getLineCount

      public int getLineCount()
      Gets the line count in this host field.
    • getHostString

      public String getHostString(HostScreen screen)
      Gets the contents of this host field. Hidden characters are returned as spaces.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHostString

      public String getHostString(HostScreen screen, int line)
      Gets the contents of this host field. Hidden characters are returned as spaces.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHostString

      public String getHostString(HostScreen screen, boolean doGetHidden)
      Gets the contents of this host field.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHostString

      public String getHostString(HostScreen screen, boolean doGetHidden, boolean isDynamic)
      Gets the contents of this host field.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHostString

      public String getHostString(HostScreen screen, boolean doGetHidden, boolean isDynamic, boolean dontWrap, boolean doCheckMatch)
      Gets the contents of this host field.

      The "dontWrap" flag is only valid when "isDynamic" is true.

      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHostString

      public String getHostString(HostScreen screen, boolean doGetHidden, int line)
      Gets the contents of this host field at a certain line.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHostString

      public String getHostString(HostScreen screen, boolean doGetHidden, int line, boolean doCheckMatch)
      Gets the contents of this host field at a certain line.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHiddenHostString

      public String getHiddenHostString(HostScreen screen)
      Gets the contents of this host field.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHiddenHostString

      public String getHiddenHostString(HostScreen screen, boolean isDynamic)
      Gets the contents of this host field.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHiddenHostString

      public String getHiddenHostString(HostScreen screen, boolean isDynamic, boolean dontWrap)
      Gets the contents of this host field.

      The "dontWrap" flag is only valid when "isDynamic" is true.

      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getHiddenHostString

      public String getHiddenHostString(HostScreen screen, int line)
      Gets the contents of this host field.
      Returns:
      null if the host field is not inside screen (because there has been a screen change).
    • getColor

      public int getColor(HostScreen screen)
      Gets the CGA color of this field.
      Returns:
      -1 if the host field is not inside screen (because there has been a screen change).
    • getColor2

      public int getColor2(HostScreen screen, boolean doCheckMatch)
      Gets the CGA color of this field.
      Returns:
      -1 if the host field is not inside screen (because there has been a screen change).
    • getColor

      public int getColor(HostScreen screen, boolean isDynamic)
      Gets the CGA color of this field.
      Returns:
      -1 if the host field is not inside screen (because there has been a screen change).
    • getColor

      public int getColor(HostScreen screen, int line)
      Gets the CGA color of a line in this field.
      Returns:
      -1 if the host field is not inside screen (because there has been a screen change).
    • getColor

      public int getColor(HostScreen screen, int line, boolean doCheckMatch)
      Gets the CGA color of a line in this field.
      Returns:
      -1 if the host field is not inside screen (because there has been a screen change).
    • getHostField

      public HostField getHostField(HostScreen screen)
      Gets the corresponding host field on the current host screen.
      Returns:
      null if the host field is not found. or if the host field is not inside screen (because there has been a screen change).
    • getHostField

      public HostField getHostField(HostScreen screen, boolean isDynamic)
      Gets the corresponding host field on the current host screen.
      Returns:
      null if the host field is not found. or if the host field is not inside screen (because there has been a screen change).
    • getHostField

      public HostField getHostField(HostScreen screen, int line)
      Gets the corresponding host field on the current host screen. The line number indicates the Y offset in the Phantom Host Field.
      Returns:
      null if the host field is not found. or if the host field is not inside screen (because there has been a screen change).
    • setCursor

      public boolean setCursor(HostSession hostSession, int line)
      Set cursor to the position of this field with line offset. If line offset is larger than field height, search for continue field.
      Returns:
      false if cursor cannot be set or if line is invalid.
    • setCursor

      public boolean setCursor(HostSession hostSession, int line, int charpos)
      Set cursor to the position of this field with line offset and the character offset. If line offset is larger than field height, search for continue field.
      Returns:
      false if cursor cannot be set or if line is invalid.
    • setCursor

      public boolean setCursor(HostSession hostSession)
      Set cursor to the position of this field, first line.
      Returns:
      false if cursor cannot be set in the host session.
    • setCursor

      public boolean setCursor(HostSession hostSession, boolean isDynamic)
      Set cursor to the position of this field, first line.
      Returns:
      false if cursor cannot be set in the host session.
    • setHostField

      public String setHostField(HostSession hostSession, String text)
      Sets the corresponding host field on the current host screen to the specified string.
      Returns:
      null for success, otherwise an error message.
    • setHostField

      public String setHostField(HostSession hostSession, String text, boolean isDynamic)
      Sets the corresponding host field on the current host screen to the specified string.
      Returns:
      null for success, otherwise an error message.
    • setHostField

      public String setHostField(HostSession hostSession, String text, int line)
      Sets the corresponding host field on the current host screen to the specified string.

      The line number indicates the Y offset in the Phantom Host Field.

      Returns:
      null for success, otherwise an error message.
    • getHiddenHostFieldColumn

      public HostFieldColumnCell[] getHiddenHostFieldColumn(HostScreen screen)
      Gets an array of all host field cells in a column. This is typically used with list boxes and business graphics.
      Returns:
      null if the host session is not the current one.
    • getHostFieldColumn

      public HostFieldColumnCell[] getHostFieldColumn(HostScreen screen)
      Gets an array of all host field cells in a column. This is typically used with list boxes and business graphics.
      Returns:
      null if the host session is not the current one.
    • getHostFieldColumn

      public HostFieldColumnCell[] getHostFieldColumn(HostScreen screen, boolean doGetHidden)
      Gets an array of all host field cells in a column. This is typically used with list boxes and business graphics.
      Returns:
      null if the host session is not the current one.
    • hasRelateVirtualSpaceConnection

      public boolean hasRelateVirtualSpaceConnection()
      Checks for connection to VS.
    • getVSRelativeReference

      public VSRelativeReference<?> getVSRelativeReference()
      Gets the relative VS connection.
    • getFieldClassReference

      public ClassReference getFieldClassReference()
      Gets the class reference for the field processing used to getting/setting host field and providing conversion/mapping/translation support. The class implements the IHostFieldData interface.
      Returns:
      The ClassReference, or null for none.
    • getIHostFieldData

      public IHostFieldData getIHostFieldData()
      Gets the IHostFieldData instance.

      The instance is created if one is present.

      Returns:
      The IHostFieldData instance or null for none.
    • getCurrentHostSession

      public HostSession getCurrentHostSession(String logMsg)
      Gets the current host session from the Application properties.
      Parameters:
      logMsg - Message to prepend an error in the host session, null to avoid logging.
      Returns:
      The current host session, or null for none (always null when not running in Server or Server Development modes).
    • getVSComponentReferenceClasses

      public Class<?>[] getVSComponentReferenceClasses(VSComponentReference ref)
      Gets the possible component classes for the references, i.e. combination of VSTable, VSColumnHeader, VSField.
      Specified by:
      getVSComponentReferenceClasses in interface IVSComponentReferenceProvider
      Parameters:
      ref - The reference holder.
      Returns:
      An array of the valid classes.
    • isVSComponentReferenceValid

      public boolean isVSComponentReferenceValid(Atom refAtom, VSComponent component)
      Validates the VS component reference that has been looked up when the reference property doesn't exist.
      Specified by:
      isVSComponentReferenceValid in interface IVSComponentReferenceProvider
      Parameters:
      refAtom - The reference holder's atom.
      component - The VS component to validate.
      Returns:
      true if valid, false otherwise.
    • getReferenceType

      public IPropReference.RefType getReferenceType(VSComponentReference ref)
      Gets the reference Type.
      Specified by:
      getReferenceType in interface IVSComponentReferenceProvider
      Parameters:
      ref - The reference holder.
      Returns:
      The reference type, generally a value from the enum IPropReference.RefType, otherwise a static final implementation of the reference type with locale support. Returns e.g. RefType.VSField or RefType.VSTable.
    • getVSComponentReference

      public VSComponentReference getVSComponentReference()
      Gets the VSComponentReference.
      Returns:
      The reference instance, or null for none.
    • getBestVSFieldValueType

      public Value.Type getBestVSFieldValueType(VSRelativeReference<?> reference)
      Requests the value type that would best suit the listener.
      Specified by:
      getBestVSFieldValueType in interface IVSFieldListener
      Parameters:
      reference - The VSRelativeReference instance holding the reference.
      Returns:
      null if none is available.
    • getVSField

      public VSField getVSField()
      Gets the VS Field connected to the screen field.
      Returns:
      The field, or null for none.
    • onResolved

      public void onResolved(VSRelativeReference<?> reference, VSField field)
      Called when the property reference has been resolved. UI components use this method to set its state according to the field.
      Specified by:
      onResolved in interface IVSFieldListener
      Parameters:
      reference - The VSRelativeReference instance holding the reference.
      field - The target reference.
    • onBroken

      public void onBroken(VSRelativeReference<?> reference, VSField field)
      Called when the property reference has been broken, i.e. unresolved.
      Specified by:
      onBroken in interface IVSFieldListener
      Parameters:
      reference - The VSRelativeReference instance holding the reference.
      field - The target reference.
    • onStateChanged

      public void onStateChanged(VSField field, IVSComponentState.State state, boolean on)
      Called when the field changes state.
      Specified by:
      onStateChanged in interface IVSFieldListener
      Parameters:
      field - The VS field.
      state - The state change.
      on - New state.
    • onValueChanged

      public void onValueChanged(VSField field, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
      Called when the field value is set.
      Specified by:
      onValueChanged in interface IVSFieldListener
      Parameters:
      field - The VS field.
      value - The value, never null, but value.isNull() could be true.
      trigger - The trigger property that may be null.
      postProcessing - Post-processing instance.
    • getBestVSColumnHeaderValueType

      public Value.Type getBestVSColumnHeaderValueType(VSRelativeReference<?> reference)
      Requests the value type that would best suit the listener.
      Specified by:
      getBestVSColumnHeaderValueType in interface IVSColumnBestValueListener
      Parameters:
      reference - The VSRelativeReference instance holding the reference.
      Returns:
      null if none is available.
    • getVSColumnHeader

      public VSColumnHeader getVSColumnHeader()
      Gets the VS Column Header connected to the screen field.
      Returns:
      The column header, or null for none.
    • onResolved

      public void onResolved(VSRelativeReference<?> reference, VSColumnHeader column)
      Called when the property reference has been resolved. UI components use this method to set its state according to the field.
      Specified by:
      onResolved in interface IVSColumnListener
      Parameters:
      reference - The VSRelativeReference instance holding the reference.
      column - The target reference.
    • onBroken

      public void onBroken(VSRelativeReference<?> reference, VSColumnHeader column)
      Called when the property reference has been broken, i.e. unresolved.
      Specified by:
      onBroken in interface IVSColumnListener
      Parameters:
      reference - The VSRelativeReference instance holding the reference.
      column - The target reference.
    • onStateChanged

      public void onStateChanged(VSColumnHeader table, IVSComponentState.State state, boolean on)
      Called when the table changes state.
      Specified by:
      onStateChanged in interface IVSColumnListener
      Parameters:
      table - The VS table column.
      state - The state change.
      on - New state.
    • onParentStateChanged

      public void onParentStateChanged(IVSComponent parent, IVSComponentState.State state, boolean on)
      Called when the column changes state.
      Specified by:
      onParentStateChanged in interface IVSComponentListener
      Parameters:
      parent - The parent who's state was changed.
      state - The state change, possible values PARENT_ENABLED, PARENT_READONLY, PARENT_VISIBLE.
      on - New state.
    • onSingleSelectionChanged

      public void onSingleSelectionChanged(VSColumnHeader column, int rowIndex)
      Called when the row selection in table single-selection mode is changed to forward to column listeners.
      Specified by:
      onSingleSelectionChanged in interface IVSColumnListener
      Parameters:
      column - The column.
      rowIndex - The row index selected, -1 for none.
    • onSelectionChanged

      public void onSelectionChanged(VSColumnHeader column, VSRow row, int rowIndex, boolean isSelected)
      Called when the row selection is changed to forward to column listeners.
      Specified by:
      onSelectionChanged in interface IVSColumnListener
      Parameters:
      column - The column.
      row - The row that was changed.
      rowIndex - The row index.
      isSelected - The selected state.
    • onRowAdded

      public void onRowAdded(VSColumnHeader column, VSRow row, int rowIndex)
      Called when a row has been added to the table.
      Specified by:
      onRowAdded in interface IVSColumnListener
      Parameters:
      column - The column.
      row - The row that was added.
      rowIndex - The row index where it was inserted.
    • onRowRemoved

      public void onRowRemoved(VSColumnHeader column, VSRow row, int rowIndex)
      Called when a row has been removed from the table.
      Specified by:
      onRowRemoved in interface IVSColumnListener
      Parameters:
      column - The column.
      row - The row that was removed.
      rowIndex - The row index before removal.
    • onStateChanged

      public void onStateChanged(VSColumnHeader column, VSField cell, IVSComponentState.State state, boolean on)
      Called when a cell in the column changes state.
      Specified by:
      onStateChanged in interface IVSColumnListener
      Parameters:
      column - The VS column.
      cell - The VS field.
      state - The state change.
      on - New state.
    • onCellValueChanged

      public void onCellValueChanged(VSColumnHeader column, VSField cell, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
      Called when the cell value is set in the column.
      Specified by:
      onCellValueChanged in interface IVSColumnListener
      Parameters:
      column - The VS column.
      cell - The VS field.
      value - The value, never null, but value.isNull() could be true.
      trigger - The trigger property that may be null.
      postProcessing - Post-processing instance.