Class HostScreen

java.lang.Object
com.iizix.term.HostScreen

public class HostScreen extends Object
This class does everything required for a host screen.
Author:
Christopher Mindus
  • Field Details

  • Constructor Details

    • HostScreen

      public HostScreen()
      Creates a new screen of size 80 x 24.
  • Method Details

    • getLockObject

      public Object getLockObject()
      The lock object to synchronize on when processing e.g. screen identifications, used when the host session will update the screen in blocks in a separate thread.
    • addListener

      public void addListener(HostScreenListener newListener)
      Add an additional owner
      Parameters:
      newListener - The listener.
    • removeListener

      public void removeListener(HostScreenListener oldListener)
      Remove the additional owner
      Parameters:
      oldListener - The listener.
    • clear

      public void clear()
      Clears the entire screen.
    • analyzePopupWindows

      public void analyzePopupWindows()
      Analyzes the host pop-up windows.
    • getPopupWindowCount

      public int getPopupWindowCount()
      Checks how many pop-up windows exist.
    • getPopupWindows

      public Rect[] getPopupWindows()
      Gets the pop-up windows. Do not modify the rectangles returned!
    • getPopupWindow

      public Rect getPopupWindow(int index)
      Gets the pop-up window at an index.
      Returns:
      null if index is out of range.
    • getCurrentPopupWindowXOffset

      public int getCurrentPopupWindowXOffset()
      Gets the current offset in X for a pop-up window.
    • getCurrentPopupWindowYOffset

      public int getCurrentPopupWindowYOffset()
      Gets the current offset in Y for a pop-up window.
    • getCurrentPopupWindow

      public Rect getCurrentPopupWindow()
      Gets the current host pop-up window.
      Returns:
      null if none exists or none has been set.
    • getCurrentPopupWindowIndex

      public int getCurrentPopupWindowIndex()
      Gets the current index of the pop-up window.
      Returns:
      The index, or -1 for none.
    • setCurrentPopupWindow

      public void setCurrentPopupWindow(int index)
      Sets the current pop-up window.
    • append

      public void append(SendTransaction trans, boolean doFields, boolean doPopupWindows)
      Appends the host fields and possibly the pop-up windows.
    • initialize

      public void initialize(ReadTransaction trans)
      Initializes the host fields and/or the pop-up windows from a transaction.
      Parameters:
      trans - The transaction with the information.
    • setSize

      public void setSize(int cx, int cy)
      Sets the current screen size.
    • setCursor

      public void setCursor(int x, int y)
      Changes cursor position.
    • onHostScreenChange

      public void onHostScreenChange(HostSession hostSession, int beginPos, int endPos)
      Gets new character and attribute data from the host session.
    • getCharacters

      public char[] getCharacters()
      Gets the character data for the screen. This is mainly used by the screen identification process in order to be quicker.

      Note: While using the returned data, the host screen *must* be synchronized.

    • getAttributes

      public int[] getAttributes()
      Gets the attribute data for the screen. This is mainly used by the server-to-client routines to dispatch changes of screens to several listening parties.

      Note: While using the returned data, the host screen *must* be synchronized.

    • getWidth

      public int getWidth()
      Gets the width of the screen.
    • getHeight

      public int getHeight()
      Gets the height of the screen.
    • getFields

      public HostFields getFields()
      Gets all the host fields.
    • isFieldFormatted

      public boolean isFieldFormatted()
      Checks if this host screen is field formatted. This method is not like the one in HostSession, this one checks for presence of HostFields that the ClientSession has read from the HostSession when the worker thread has queued a host event. Use the HostSession method directly to see if any fields are present.
    • getFieldAbsolute

      public HostField getFieldAbsolute(int pos)
      Gets a host field from a position.
      Returns:
      null if no host field exists in the position.
    • getFieldAbsolute

      public HostField getFieldAbsolute(int x, int y)
      Gets the host field from a X/Y position.
      Returns:
      null if no host field exists in the position.
    • getFieldRelative

      public HostField getFieldRelative(int x, int y)
      Gets the host field from a X/Y position relative to the current pop-up window.
      Returns:
      null if no host field exists in the position.
    • getFirstFieldAbsolute

      public HostField getFirstFieldAbsolute(int pos)
      Gets the first host field from a position.
      Returns:
      null if no host field exists in the position.
    • getFirstFieldAbsolute

      public HostField getFirstFieldAbsolute(int x, int y)
      Gets the first host field from a X/Y position.
      Returns:
      null if no host field exists in the position.
    • getFirstFieldRelative

      public HostField getFirstFieldRelative(int x, int y)
      Gets the first host field from a X/Y position.
      Returns:
      null if no host field exists in the position.
    • getCharAbsolute

      public char getCharAbsolute(int pos)
      Gets a character from a position.
    • getCharAbsolute

      public char getCharAbsolute(int xx, int yy)
      Gets a character from a X/Y position.
    • getColorAbsolute

      public int getColorAbsolute(int pos)
      Gets a CGA color from a position.
    • getColorAbsolute

      public int getColorAbsolute(int xx, int yy)
      Gets a CGA color from a position.
    • getColorRelative

      public int getColorRelative(int xx, int yy)
      Gets the CGA color from a relative position.
    • getStringAbsolute

      public String getStringAbsolute(int xx, int yy, int length)
      Gets a text string from host at an absolute position on the screen. No provision for host pop-up windows are made. The string returns blanks for hidden characters.
    • getStringAbsolute

      public String getStringAbsolute(int xx, int yy, int length, boolean doGetHidden)
      Gets a text string from host at an absolute position on the screen. No provision for host pop-up windows are made. The string returns blanks for hidden characters depending on the flag.
    • getHiddenStringAbsolute

      public String getHiddenStringAbsolute(int xx, int yy, int length)
      Gets a text string from host at an absolute position on the screen. No provision for host pop-up windows are made.
    • getStringRelative

      public String getStringRelative(int xx, int yy, int length)
      Gets a text string from host at a relative position. This position is relative to the current host pop-up window offset. The string returns blanks for hidden characters.
    • getStringRelative

      public String getStringRelative(int xx, int yy, int length, boolean doGetHidden)
      Gets a text string from host at a relative position. This position is relative to the current host pop-up window offset. The string returns blanks for hidden characters.
    • getHiddenStringRelative

      public String getHiddenStringRelative(int xx, int yy, int length)
      Gets a text string from host at a relative position. This position is relative to the current host pop-up window offset. The string returns blanks for hidden characters.
    • isEmpty

      public boolean isEmpty()
      Checks if all characters on the screen (except the last line) are spaces. This is useful during connect to a host session in order to inhibit all panel processing until the connection is done and has a non-empty screen.
    • getCursorAbsolute

      public Position getCursorAbsolute()
      Gets the current absolute cursor position on the screen, without taking into account any current host pop-up window.
    • getCursorRelative

      public Position getCursorRelative()
      Gets the current relative cursor position on the screen, taking into account any current host pop-up window. If no host pop-up window exists, the cursor position will be the same as the absolute cursor position.
    • appendScreen

      public void appendScreen(SendTransaction t)
      Adds the entire host screen definition in a transaction that will cause the client to display a new terminal window.
    • mapBoxChar

      public char mapBoxChar(char ch, int pos)
      Routine to map special Unicode box drawing characters to printable Ansi "+-|" characters.
    • getScreenChars

      public String getScreenChars()
      Gets the entire screen, blanking out hidden characters and replacing box drawing characters (to +-|) and null (to space).
    • getLengthExclusive

      public int getLengthExclusive(int xBegin, int yBegin, int xEnd, int yEnd)
      Calculates the length between two positions with support for screen wrapping. The positions are excluding the ending position.
    • getLengthExclusive

      public int getLengthExclusive(int beginPos, int endPos)
      Calculates the length between two positions with support for screen wrapping. The positions are excluding the ending position.
    • getLengthInclusive

      public int getLengthInclusive(int xBegin, int yBegin, int xEnd, int yEnd)
      Calculates the length between two positions with support for screen wrapping. The positions are excluding the ending position.
    • getLengthInclusive

      public int getLengthInclusive(int beginPos, int endPos)
      Calculates the length between two positions with support for screen wrapping. The positions are including the ending position.
    • getPosition

      public int getPosition(int x, int y)
      Gets the position.