Package com.iizix.term
Class HostScreen
java.lang.Object
com.iizix.term.HostScreen
This class does everything required for a host screen.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Blink attribute.static final int
Bold attribute.static final int
Underline attribute.Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(HostScreenListener newListener) Add an additional ownervoid
Analyzes the host pop-up windows.void
append
(SendTransaction trans, boolean doFields, boolean doPopupWindows) Appends the host fields and possibly the pop-up windows.void
Adds the entire host screen definition in a transaction that will cause the client to display a new terminal window.void
clear()
Clears the entire screen.int[]
Gets the attribute data for the screen.char
getCharAbsolute
(int pos) Gets a character from a position.char
getCharAbsolute
(int xx, int yy) Gets a character from a X/Y position.char[]
Gets the character data for the screen.int
getColorAbsolute
(int pos) Gets a CGA color from a position.int
getColorAbsolute
(int xx, int yy) Gets a CGA color from a position.int
getColorRelative
(int xx, int yy) Gets the CGA color from a relative position.Gets the current host pop-up window.int
Gets the current index of the pop-up window.int
Gets the current offset in X for a pop-up window.int
Gets the current offset in Y for a pop-up window.Gets the current absolute cursor position on the screen, without taking into account any current host pop-up window.Gets the current relative cursor position on the screen, taking into account any current host pop-up window.getFieldAbsolute
(int pos) Gets a host field from a position.getFieldAbsolute
(int x, int y) Gets the host field from a X/Y position.getFieldRelative
(int x, int y) Gets the host field from a X/Y position relative to the current pop-up window.Gets all the host fields.getFirstFieldAbsolute
(int pos) Gets the first host field from a position.getFirstFieldAbsolute
(int x, int y) Gets the first host field from a X/Y position.getFirstFieldRelative
(int x, int y) Gets the first host field from a X/Y position.int
Gets the height of the screen.getHiddenStringAbsolute
(int xx, int yy, int length) Gets a text string from host at an absolute position on the screen.getHiddenStringRelative
(int xx, int yy, int length) Gets a text string from host at a relative position.int
getLengthExclusive
(int beginPos, int endPos) Calculates the length between two positions with support for screen wrapping.int
getLengthExclusive
(int xBegin, int yBegin, int xEnd, int yEnd) Calculates the length between two positions with support for screen wrapping.int
getLengthInclusive
(int beginPos, int endPos) Calculates the length between two positions with support for screen wrapping.int
getLengthInclusive
(int xBegin, int yBegin, int xEnd, int yEnd) Calculates the length between two positions with support for screen wrapping.The lock object to synchronize on when processing e.g.getPopupWindow
(int index) Gets the pop-up window at an index.int
Checks how many pop-up windows exist.Rect[]
Gets the pop-up windows.int
getPosition
(int x, int y) Gets the position.Gets the entire screen, blanking out hidden characters and replacing box drawing characters (to +-|) and null (to space).getStringAbsolute
(int xx, int yy, int length) Gets a text string from host at an absolute position on the screen.getStringAbsolute
(int xx, int yy, int length, boolean doGetHidden) Gets a text string from host at an absolute position on the screen.getStringRelative
(int xx, int yy, int length) Gets a text string from host at a relative position.getStringRelative
(int xx, int yy, int length, boolean doGetHidden) Gets a text string from host at a relative position.int
getWidth()
Gets the width of the screen.void
initialize
(ReadTransaction trans) Initializes the host fields and/or the pop-up windows from a transaction.boolean
isEmpty()
Checks if all characters on the screen (except the last line) are spaces.boolean
Checks if this host screen is field formatted.char
mapBoxChar
(char ch, int pos) Routine to map special Unicode box drawing characters to printable Ansi "+-|" characters.void
onHostScreenChange
(HostSession hostSession, int beginPos, int endPos) Gets new character and attribute data from the host session.void
removeListener
(HostScreenListener oldListener) Remove the additional ownervoid
setCurrentPopupWindow
(int index) Sets the current pop-up window.void
setCursor
(int x, int y) Changes cursor position.void
setSize
(int cx, int cy) Sets the current screen size.
Field Details
ATTR_BOLD
public static final int ATTR_BOLDBold attribute.- See Also:
ATTR_BLINK
public static final int ATTR_BLINKBlink attribute.- See Also:
ATTR_UNDERLINE
public static final int ATTR_UNDERLINEUnderline attribute.- See Also:
Constructor Details
HostScreen
public HostScreen()Creates a new screen of size 80 x 24.
Method Details
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
Add an additional owner- Parameters:
newListener
- The listener.
removeListener
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
Gets the pop-up windows. Do not modify the rectangles returned!getPopupWindow
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
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
Appends the host fields and possibly the pop-up windows.initialize
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
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
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
Gets a host field from a position.- Returns:
- null if no host field exists in the position.
getFieldAbsolute
Gets the host field from a X/Y position.- Returns:
- null if no host field exists in the position.
getFieldRelative
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
Gets the first host field from a position.- Returns:
- null if no host field exists in the position.
getFirstFieldAbsolute
Gets the first host field from a X/Y position.- Returns:
- null if no host field exists in the position.
getFirstFieldRelative
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
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
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
Gets a text string from host at an absolute position on the screen. No provision for host pop-up windows are made.getStringRelative
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
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
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
Gets the current absolute cursor position on the screen, without taking into account any current host pop-up window.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
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
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.