Package com.rs.seagull.emulator.api
Interface BareScreen
-
- All Known Subinterfaces:
Screen
public interface BareScreen
A BareScreen represents a host screen. It is rectangular in shape. A screen contains text arranged in equal sized rows or lines. You can retrieve specific portions of the text, addressing it by either x,y coordinates (upper left is 0,0) or by character offsets. The text can be treated as one contiguous "flow" where the last character of one line is immediately followed by the first character of the next line. Or it can be treated as a list of lines.- Version:
- $Id$
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
createScreenShot(OutputStream outputStream)
Write this screen to the providedOutputStream
in XML format.void
createScreenShot(OutputStream outputStream, String exename, String buildnumber, String exeversion, String productName, String modelVersion)
Write this screen to the providedOutputStream
in XML format.String
getAllText()
Returns the entire screen text with no line-endings.Cell
getCell(int offset)
Returns theCell
at a location of the screen.Cell
getCell(int x, int y)
Returns theCell
at a location of the screen.Cell
getCell(com.seagullsw.common.toolbox.geometry.Point at)
Returns theCell
at a location of the screen.List<Cell>
getCellList(int start, int length)
Returns a collection ofCell
s.List<Cell>
getCellList(int x, int y, int length)
Returns a collection ofCell
s.List<Cell>
getCellList(com.seagullsw.common.toolbox.geometry.Point at, int length)
Returns a collection ofCell
s.List<Cell>
getCellList(com.seagullsw.common.toolbox.geometry.Rectangle r)
Returns a collection ofCell
s of a rectangular portion of the screen.long
getChangeCount()
Get the change count.BareCursor
getCursor()
Returns the cursor for the screen.List<BareCursor>
getCursorList()
Get a collection with all cursors of this screen.String
getEmulatorName()
Get the name that identifies the emulator.com.seagullsw.common.emulator.physical.base.screen.EmulatorState
getEmulatorState()
Get the input state of the client.BareField
getHostField(com.seagullsw.common.toolbox.geometry.Point at)
Returns the host-defined field at the given location.List<BareField>
getHostFields()
Returns a list of the host-defined fields.Keyboard
getKeyboard()
Returns the keyboard for the screen.int
getKeyboardRestoreCount()
Get the keyboard restore count.com.seagullsw.common.toolbox.geometry.Dimension
getSize()
Returns the size of the screen.BareScreen
getSnapshot()
Returns an immutable snapshot, created (if necessary) from thisBareScreen
.String
getText(int start, int length)
Returns the text content of a portion of the screen.String
getText(int x, int y, int length)
Returns the text content of a portion of the screen.String
getText(com.seagullsw.common.toolbox.geometry.Point at, int length)
Returns the text content of a portion of the screen.String
getTextLine(int line)
Returns a single line of text content.List<String>
getTextLines(com.seagullsw.common.toolbox.geometry.Point at, int length)
Returns the text content of a portion of the screen, divided into individual lines matching the lines on the screen.List<String>
getTextLines(com.seagullsw.common.toolbox.geometry.Rectangle r)
Returns the text content of a rectangular portion of the screen, divided into individual lines matching the lines on the screen.boolean
isInputInhibit()
Check if the input inhibit flag is raised.boolean
isReverse()
Check if the colors on theBareScreen
are reversed.boolean
isSnapshot()
Tests if thisBareScreen
is an immutable snapshot.String
toDebugString(boolean includeHidden)
Return a string representation of the screen suitable for inclusion in debug logging.int
toOffset(com.seagullsw.common.toolbox.geometry.Point point)
Convert a screen coordinate to a character offset.com.seagullsw.common.toolbox.geometry.Point
toPoint(int offset)
Convert a character offset to a screen coordinate.
-
-
-
Method Detail
-
getSize
com.seagullsw.common.toolbox.geometry.Dimension getSize()
Returns the size of the screen.- Returns:
- the size of the screen.
-
getSnapshot
BareScreen getSnapshot()
Returns an immutable snapshot, created (if necessary) from thisBareScreen
. The implementation possibly returns thisBareScreen
, if it is already an immutable snapshot.- Returns:
- an immutable snapshot, created (if necessary) from this
BareScreen
.
-
isSnapshot
boolean isSnapshot()
Tests if thisBareScreen
is an immutable snapshot.- Returns:
true
if thisBareScreen
is an immutable snapshot.
-
createScreenShot
void createScreenShot(OutputStream outputStream) throws IOException
Write this screen to the providedOutputStream
in XML format. The outputStream will not be closed, it is up to the caller to close the outputStream.- Parameters:
outputStream
- the providedOutputStream
- Throws:
IOException
- thrown when there is a problem generating the screen shot
-
createScreenShot
void createScreenShot(OutputStream outputStream, String exename, String buildnumber, String exeversion, String productName, String modelVersion) throws IOException
Write this screen to the providedOutputStream
in XML format. The outputStream will not be closed, it is up to the caller to close the outputStream.- Parameters:
outputStream
- the providedOutputStream
exename
- value for the exename attribute of the VersionInfo processing instruction, if null a default is supplied.buildnumber
- value for the buildnumber attribute of the VersionInfo processing instruction, if null a default is supplied.exeversion
- value for the exeversion attribute of the VersionInfo processing instruction, if null a default is supplied.productName
- value for the productName attribute of the VersionInfo processing instruction, if null it is omitted.modelVersion
- value for the modelVersion attribute of the VersionInfo processing instruction, if null it is omitted.- Throws:
IOException
- thrown when there is a problem generating the screen shot
-
getText
String getText(com.seagullsw.common.toolbox.geometry.Point at, int length)
Returns the text content of a portion of the screen. If the prescribed portion crosses a line boundary, the text returned is contiguous - there are no line break characters.- Parameters:
at
- the screen location of the beginning of the string to retrieve.length
- the number of characters to retrieve.- Returns:
- the text content of the specified portion of the screen.
-
getText
String getText(int start, int length)
Returns the text content of a portion of the screen. If the prescribed portion crosses a line boundary, the text returned is contiguous - there are no line break characters.- Parameters:
start
- the zero-based character offset of the beginning of the text to retrieve.length
- the number of characters to retrieve.- Returns:
- the text content of the specified portion of the screen.
-
getText
String getText(int x, int y, int length)
Returns the text content of a portion of the screen. If the prescribed portion crosses a line boundary, the text returned is contiguous - there are no line break characters.- Parameters:
x
- the horizontal screen coordinate of the beginning of the text to retrieve.y
- the vertical screen coordinate of the beginning of the text to retrieve.length
- the number of characters to retrieve.- Returns:
- the text content of the specified portion of the screen.
-
getTextLine
String getTextLine(int line)
Returns a single line of text content.- Parameters:
line
- the line number, the top line is 0.- Returns:
- a single line of text content
-
getTextLines
List<String> getTextLines(com.seagullsw.common.toolbox.geometry.Point at, int length)
Returns the text content of a portion of the screen, divided into individual lines matching the lines on the screen. So the first and last lines in the list will be less than full width unless the prescribed portion starts exactly at the left edge and ends at the right.- Parameters:
at
- the screen location of the beginning of the lines to retrieve.length
- the number of characters to retrieve.- Returns:
- a list of strings, one for each line included in specified screen portion.
-
getTextLines
List<String> getTextLines(com.seagullsw.common.toolbox.geometry.Rectangle r)
Returns the text content of a rectangular portion of the screen, divided into individual lines matching the lines on the screen.- Parameters:
r
- the rectangle to retrieve.- Returns:
- a list of strings, one for each line.
-
getAllText
String getAllText()
Returns the entire screen text with no line-endings. End of one line is immediately followed by start of next line. Empty areas are filled with blanks.- Returns:
- the entire screen text.
-
toPoint
com.seagullsw.common.toolbox.geometry.Point toPoint(int offset)
Convert a character offset to a screen coordinate.- Parameters:
offset
- the character offset to convert.- Returns:
- the screen coordinate of the offset.
-
toOffset
int toOffset(com.seagullsw.common.toolbox.geometry.Point point)
Convert a screen coordinate to a character offset.- Parameters:
point
- the screen coordinate to convert.- Returns:
- the character offset of the screen coordinate.
-
getKeyboard
Keyboard getKeyboard()
Returns the keyboard for the screen.- Returns:
- the keyboard for the screen.
-
getCursor
BareCursor getCursor()
Returns the cursor for the screen.- Returns:
- the cursor.
-
getCursorList
List<BareCursor> getCursorList()
Get a collection with all cursors of this screen.- Returns:
- a collection with all cursors of this screen
-
getCell
Cell getCell(com.seagullsw.common.toolbox.geometry.Point at)
Returns theCell
at a location of the screen.
-
getCellList
List<Cell> getCellList(com.seagullsw.common.toolbox.geometry.Point at, int length)
Returns a collection ofCell
s.
-
getCellList
List<Cell> getCellList(com.seagullsw.common.toolbox.geometry.Rectangle r)
Returns a collection ofCell
s of a rectangular portion of the screen.- Parameters:
r
- the rectangle to retrieve.- Returns:
- the collection of
Cell
s
-
isReverse
boolean isReverse() throws UnsupportedOperationException
Check if the colors on theBareScreen
are reversed.- Returns:
true
if the colors on theBareScreen
are reversed- Throws:
UnsupportedOperationException
- when the emulator does not support reverse screens
-
isInputInhibit
boolean isInputInhibit() throws UnsupportedOperationException
Check if the input inhibit flag is raised.- Returns:
true
if the input inhibit flag is raised- Throws:
UnsupportedOperationException
- when the emulator does not support the input inhibit flag
-
getKeyboardRestoreCount
int getKeyboardRestoreCount() throws UnsupportedOperationException
Get the keyboard restore count.- Returns:
- the keyboard restore count
- Throws:
UnsupportedOperationException
- when the emulator does not support the keyboard restore count
-
getEmulatorState
com.seagullsw.common.emulator.physical.base.screen.EmulatorState getEmulatorState() throws UnsupportedOperationException
Get the input state of the client.- Returns:
- the input state of the client
- Throws:
UnsupportedOperationException
- when the emulator does not support the 'emulator state' property
-
getChangeCount
long getChangeCount()
Get the change count.- Returns:
- the change count
-
getEmulatorName
String getEmulatorName()
Get the name that identifies the emulator. Possible values are described in theNAME
constants ofEmulators.Ibm5250
,Emulators.Ibm3270
andEmulators.AnsiPlus
.- Returns:
- the name that identifies the emulator
-
getHostFields
List<BareField> getHostFields()
Returns a list of the host-defined fields.- Returns:
- a list of the host-defined fields.
- Throws:
UnsupportedOperationException
- when the emulator does not support fields (e.g. VT).
-
getHostField
BareField getHostField(com.seagullsw.common.toolbox.geometry.Point at)
Returns the host-defined field at the given location.- Parameters:
at
- a screen location anywhere within the desired host-defined field.- Returns:
- if there is a host-defined field at the given location, return it, else return null.
-
toDebugString
String toDebugString(boolean includeHidden)
Return a string representation of the screen suitable for inclusion in debug logging.- Parameters:
includeHidden
- if true, hidden cells (e.g. password fields) are included, else they are replaced by blanks.- Returns:
- a string representation of the screen suitable for inclusion in debug logging.
-
-