Class Screen5250
- java.lang.Object
-
- org.tn5250j.framework.tn5250.Screen5250
-
public class Screen5250 extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description booleancursorActivebooleancursorShowninthomePosprotected ScreenPlanesplanes
-
Constructor Summary
Constructors Constructor Description Screen5250()
-
Method Summary
Modifier and Type Method Description protected voidaddField(int attr, int len, int ffw1, int ffw2, int fcw1, int fcw2)Add a field to the field format table.voidaddScreenListener(ScreenListener listener)Add a ScreenListener to the listener list.protected voidadvancePos()Change the screen position by one columnprotected voidchangePos(int i)Change position of the screen by the increment of parameter passed.booleancheckHotSpots()protected voidclearAll()This routine clears the screen, resets row and column to 0, resets the last attribute to 32, clears the fields, turns insert mode off, clears/initializes the screen character array.protected voidclearGuiStuff()Clear the gui constructsprotected voidclearScreen()Clear the screen by setting the initial character and initial attribute to all the positions on the screenprotected voidclearTable()Clear the fields tablejava.lang.StringcopyText(Rect area)Copy and Paste supportjava.lang.StringcopyTextField(int position)Copy and Paste supportprotected voidcreateScrollBar(int flag, int totalRowScrollable, int totalColScrollable, int sliderRowPos, int sliderColPos, int sbSize)Creates a scroll bar on the screen using the parameters provided. ** we only support vertical scroll bars at the time.protected voidcreateWindow(int depth, int width, int type, boolean gui, int monoAttr, int colorAttr, int ul, int upper, int ur, int left, int right, int ll, int bottom, int lr)protected voiddrawField(ScreenField screenField)Draws the field on the screen.protected voiddrawFields()Redraw the fields on the screen.voiddumpScreen()boolean[]getActiveAidKeys()char[]getCharacters()intgetCol(int pos)intgetColumns()Get the number of columns available.intgetCurrentCol()Get the current column where the cursor isintgetCurrentPos()Current position is based on offsets of 1,1 not 0,0 of the current position of the screenintgetCurrentRow()Get the current row where the cursor ischar[]getData(int startRow, int startCol, int endRow, int endCol, int plane)java.lang.StringgetDumpScreen()protected intgetErrorLine()Returns the current error line numberjava.lang.StringBuffergetHSBottom()Hotspot Bottom stringjava.lang.StringBuffergetHSMore()Hotspot More... stringjava.lang.StringgetKeys()protected intgetLastPos()The last position of the cursor on the screen - Note - position is based 0,0ScreenOIAgetOIA()protected ScreenPlanesgetPlanes()intgetPos(int row, int col)This routine is 0 based offset.intgetRow(int pos)intgetRows()Get the number or rows available.intGetScreen(char[] buffer, int bufferLength, int plane)GetScreen retrieves the various planes associated with the presentation space.intGetScreen(char[] buffer, int bufferLength, int from, int length, int plane)GetScreen retrieves the various planes associated with the presentation space.intGetScreen(char[] buffer, int bufferLength, int row, int col, int length, int plane)GetScreen retrieves the various planes associated with the presentation space.char[]getScreenAsAllChars()Return the whole screen represented as a character arraychar[]getScreenAsChars()Return the screen represented as a character arrayScreenFieldsgetScreenFields()Return the fields that are contained in the Field Format TableintgetScreenLength()Gets the length of the screen - number of rows times number of columnsintGetScreenRect(char[] buffer, int bufferLength, int startPos, int endPos, int plane)GetScreenRect retrieves data from the various planes associated with the presentation space.intGetScreenRect(char[] buffer, int bufferLength, int startRow, int startCol, int endRow, int endCol, int plane)GetScreenRect retrieves data from the various planes associated with the presentation space.protected voidgoHome()protected voidgoto_XY(int pos)booleangotoField(int f)Set the current working field to the field number specified.protected booleangotoField(ScreenField screenField)Convenience method to set the field object passed as the currect working screen fieldbooleanisCursorActive()booleanisCursorShown()protected booleanisInField()Convinience class to return if the cursor is in a field or not.booleanisInField(int pos)Convinience class to return if the position that is passed is in a field or not.booleanisInField(int pos, boolean chgToField)Convinience class to return if the position that is passed is in a field or not.booleanisInField(int row, int col)Convinience class to return if the position at row and column that is passed is in a field or not.booleanisInField(int row, int col, boolean chgToField)Convinience class to return if the position at row and column that is passed is in a field or not.protected booleanisStatusErrorCode()booleanisUsingGuiInterface()booleanmoveCursor(int pos)This will move the screen cursor based on the mouse event.voidpasteText(java.lang.String content, boolean special)Copy and Paste supportvoidremoveScreenListener(ScreenListener listener)Remove a ScreenListener from the listener list.voidrepaintScreen()Utility method to share the repaint behaviour between setBounds() and updateScreen.protected voidresetError()Restores the error line and sets the error mode off.protected voidrestoreErrorLine()Restores the error line characters from the save buffer.protected voidrestoreScreen()protected voidrollScreen(int direction, int topLine, int bottomLine)Roll the screen up or down.protected voidsaveErrorLine()Saves off the current error line characters to be used later.voidsendAid(int aidKey)The sendAid method sends an "aid" keystroke to the virtual screen.voidsendKeys(java.lang.String text)The sendKeys method sends a string of keys to the virtual screen.voidsendKeys(KeyMnemonic keyMnemonic)protected voidsetAttr(int cByte)voidsetBackspaceError(boolean onError)protected voidsetChar(int cByte)voidsetCursor(int row, int col)This routine is based on offset 1,1 not 0,0 it will translate to offset 0,0 and call the goto_XY(int pos) it is mostly used from external classes that use the 1,1 offsetvoidsetCursorActive(boolean activate)Activate the cursor on screenvoidsetCursorOff()voidsetCursorOn()protected voidsetDirty(int pos)protected voidsetEndingAttr(int cByte)protected voidsetErrorLine(int line)Set the error line number to that of number passed.protected voidsetFieldHighlighted(ScreenField sf)Set the field to be displayed as highlighted.protected voidsetPendingInsert(boolean flag)protected voidsetPendingInsert(boolean flag, int icX, int icY)protected voidsetPrehelpState(boolean setErrorCode, boolean lockKeyboard, boolean unlockIfLocked)voidsetResetRequired(boolean reset)protected voidsetRowsCols(int rows, int cols)protected voidsetScreenCharAndAttr(char right, int colorAttr, boolean isAttr)protected voidsetScreenCharAndAttr(char right, int colorAttr, int whichGui, boolean isAttr)protected voidsetScreenData(java.lang.String text, int location)protected voidsetStatus(byte attr, byte value, java.lang.String s)voidsetUseGUIInterface(boolean gui)voidsetVT(tnvt v)protected booleansimulateKeyStroke(char c)protected booleansimulateMnemonic(int mnem)java.util.Vector<java.lang.Double>sumThem(boolean formatOption, Rect area)voidtoggleGUIInterface()protected voidunsetFieldHighlighted(ScreenField sf)Draw the field as un higlighted.protected voidupdateDirty()Draw or redraw the dirty parts of the screen and display them.voidupdateScreen()This method does a complete refresh of the screen.protected voidwriteWindowTitle(int pos, int depth, int width, byte orientation, int monoAttr, int colorAttr, java.lang.StringBuffer title)
-
-
-
Field Detail
-
cursorActive
public boolean cursorActive
-
cursorShown
public boolean cursorShown
-
homePos
public int homePos
-
planes
protected ScreenPlanes planes
-
-
Method Detail
-
getPlanes
protected ScreenPlanes getPlanes()
-
getOIA
public final ScreenOIA getOIA()
-
setRowsCols
protected final void setRowsCols(int rows, int cols)
-
isCursorActive
public boolean isCursorActive()
-
isCursorShown
public boolean isCursorShown()
-
setUseGUIInterface
public void setUseGUIInterface(boolean gui)
-
toggleGUIInterface
public void toggleGUIInterface()
-
setResetRequired
public void setResetRequired(boolean reset)
-
setBackspaceError
public void setBackspaceError(boolean onError)
-
copyText
public final java.lang.String copyText(Rect area)
Copy and Paste support- Parameters:
area- a rectangle area- Returns:
- a string, holding the text
-
pasteText
public final void pasteText(java.lang.String content, boolean special)Copy and Paste support- Parameters:
content- the contentspecial- a flag
-
copyTextField
public final java.lang.String copyTextField(int position)
Copy and Paste support- Parameters:
position- start number- Returns:
- a copied text
-
sumThem
public final java.util.Vector<java.lang.Double> sumThem(boolean formatOption, Rect area)- Parameters:
formatOption- formatting option to usearea- a rect angle- Returns:
- vector string of numberic values
-
moveCursor
public boolean moveCursor(int pos)
This will move the screen cursor based on the mouse event. I do not think the checks here for the gui characters should be here but will leave them here for now until we work out the interaction. This should be up to the gui frontend in my opinion.- Parameters:
pos- a position to move to- Returns:
- flag
-
setVT
public void setVT(tnvt v)
-
setPrehelpState
protected void setPrehelpState(boolean setErrorCode, boolean lockKeyboard, boolean unlockIfLocked)
-
setCursorActive
public void setCursorActive(boolean activate)
Activate the cursor on screen- Parameters:
activate- a flag
-
setCursorOn
public void setCursorOn()
-
setCursorOff
public void setCursorOff()
-
getKeys
public java.lang.String getKeys()
-
sendKeys
public void sendKeys(KeyMnemonic keyMnemonic)
-
sendKeys
public void sendKeys(java.lang.String text)
The sendKeys method sends a string of keys to the virtual screen. This method acts as if keystrokes were being typed from the keyboard. The keystrokes will be sent to the location given. The string being passed can also contain mnemonic values such as [enter] enter key,[tab] tab key, [pf1] pf1 etc... These will be processed as if you had pressed these keys from the keyboard. All the valid special key values are contained in the MNEMONIC enumeration. See alsoKeyMnemonic- Parameters:
text- The string of characters to be sent- See Also:
sendAid(int)
-
sendAid
public void sendAid(int aidKey)
The sendAid method sends an "aid" keystroke to the virtual screen. These aid keys can be thought of as special keystrokes, like the Enter key, PF1-24 keys or the Page Up key. All the valid special key values are contained in the AID_ enumeration:- Parameters:
aidKey- The aid key to be sent to the host
-
resetError
protected void resetError()
Restores the error line and sets the error mode off.
-
simulateMnemonic
protected boolean simulateMnemonic(int mnem)
-
simulateKeyStroke
protected boolean simulateKeyStroke(char c)
-
getRow
public int getRow(int pos)
-
getCol
public int getCol(int pos)
-
getPos
public int getPos(int row, int col)This routine is 0 based offset. So to get row 20,1 then pass row 19,0- Parameters:
row- number of the rowcol- number of the column- Returns:
- number of the position
-
getCurrentPos
public int getCurrentPos()
Current position is based on offsets of 1,1 not 0,0 of the current position of the screen- Returns:
- int the current position
-
isUsingGuiInterface
public boolean isUsingGuiInterface()
-
isInField
protected boolean isInField()
Convinience class to return if the cursor is in a field or not.- Returns:
- true or false
-
isInField
public boolean isInField(int pos, boolean chgToField)Convinience class to return if the position that is passed is in a field or not. If it is then the chgToField parameter will change the current field to this field where the position indicates- Parameters:
pos- numberchgToField- flag- Returns:
- true or false
-
isInField
public boolean isInField(int pos)
Convinience class to return if the position that is passed is in a field or not. If it is then the field at this position becomes the current working field- Parameters:
pos- number of position- Returns:
- true or false
-
isInField
public boolean isInField(int row, int col)Convinience class to return if the position at row and column that is passed is in a field or not. If it is then the field at this position becomes the current working field.- Parameters:
row- number of the rowcol- number of the column- Returns:
- true or false
-
isInField
public boolean isInField(int row, int col, boolean chgToField)Convinience class to return if the position at row and column that is passed is in a field or not. If it is then the chgToField parameter will change the current field to this field where the row and column indicates.- Parameters:
row- number of the rowcol- number of the columnchgToField- flag- Returns:
- true or false
-
getScreenLength
public int getScreenLength()
Gets the length of the screen - number of rows times number of columns- Returns:
- int value of screen length
-
getRows
public int getRows()
Get the number or rows available.- Returns:
- number of rows
-
getColumns
public int getColumns()
Get the number of columns available.- Returns:
- number of columns
-
getCurrentRow
public int getCurrentRow()
Get the current row where the cursor is- Returns:
- the cursor current row position 1,1 based
-
getCurrentCol
public int getCurrentCol()
Get the current column where the cursor is- Returns:
- the cursor current column position 1,1 based
-
getLastPos
protected int getLastPos()
The last position of the cursor on the screen - Note - position is based 0,0- Returns:
- last position
-
getHSMore
public java.lang.StringBuffer getHSMore()
Hotspot More... string- Returns:
- string literal of More...
-
getHSBottom
public java.lang.StringBuffer getHSBottom()
Hotspot Bottom string- Returns:
- string literal of Bottom
-
getScreenAsAllChars
public char[] getScreenAsAllChars()
Return the whole screen represented as a character array- Returns:
- character array containing the text Added by Luc - LDC Note to KJP - Have to ask what the difference is between this method and the other
-
getScreenAsChars
public char[] getScreenAsChars()
Return the screen represented as a character array- Returns:
- character array containing the text
-
getData
public char[] getData(int startRow, int startCol, int endRow, int endCol, int plane)
-
GetScreen
public int GetScreen(char[] buffer, int bufferLength, int plane)GetScreen retrieves the various planes associated with the presentation space. The data is returned as a linear array of character values in the array provided. The array is not terminated by a null character except when data is retrieved from the text plane, in which case a single null character is appended.
The application must supply a buffer for the returned data and the length of the buffer. Data is returned starting from the beginning of the presentation space and continuing until the buffer is full or the entire plane has been copied. For text plane data, the buffer must include one extra position for the terminating null character.
- Parameters:
buffer- character bufferbufferLength- lengthplane- plane- Returns:
- The number of characters copied to the buffer
-
GetScreen
public int GetScreen(char[] buffer, int bufferLength, int from, int length, int plane)GetScreen retrieves the various planes associated with the presentation space. The data is returned as a linear array of character values in the array provided. The array is not terminated by a null character except when data is retrieved from the text plane, in which case a single null character is appended.
The application must supply a buffer for the returned data and the length of the buffer. Data is returned starting from the given position and continuing until the specified number of characters have been copied, the buffer is full or the entire plane has been copied. For text plane data, the buffer must include one extra position for the terminating null character.
- Parameters:
buffer- bufferbufferLength- lengthfrom- where to beginlength- lengthplane- plane- Returns:
- The number of characters copied to the buffer
-
GetScreen
public int GetScreen(char[] buffer, int bufferLength, int row, int col, int length, int plane)GetScreen retrieves the various planes associated with the presentation space. The data is returned as a linear array of character values in the array provided. The array is not terminated by a null character except when data is retrieved from the text plane, in which case a single null character is appended.
The application must supply a buffer for the returned data and the length of the buffer. Data is returned starting from the given coordinates and continuing until the specified number of characters have been copied, the buffer is full, or the entire plane has been copied. For text plane data, the buffer must include one extra position for the terminating null character.
- Parameters:
buffer- bufferbufferLength- lengthrow- number of rowcol- number of columnlength- lengthplane- plane- Returns:
- The number of characters copied to the buffer.
-
GetScreenRect
public int GetScreenRect(char[] buffer, int bufferLength, int startPos, int endPos, int plane)GetScreenRect retrieves data from the various planes associated with the presentation space. The data is returned as a linear array of character values in the buffer provided.
The application supplies two positions that represent opposing corners of a rectangle within the presentation space. The starting and ending positions can have any spatial relationship to each other. The data returned starts from the row containing the upper-most point to the row containing the lower-most point, and from the left-most column to the right-most column.
The specified buffer must be at least large enough to contain the number of characters in the rectangle. If the buffer is too small, no data is copied and zero is returned by the method. Otherwise, the method returns the number of characters copied.
- Parameters:
buffer- nufferbufferLength- lengthstartPos- where to startendPos- where to endplane- plane- Returns:
- The number of characters copied to the buffer
-
GetScreenRect
public int GetScreenRect(char[] buffer, int bufferLength, int startRow, int startCol, int endRow, int endCol, int plane)GetScreenRect retrieves data from the various planes associated with the presentation space. The data is returned as a linear array of character values in the buffer provided. The buffer is not terminated by a null character.
The application supplies two coordinates that represent opposing corners of a rectangle within the presentation space. The starting and ending coordinates can have any spatial relationship to each other. The data returned starts from the row containing the upper-most point to the row containing the lower-most point, and from the left-most column to the right-most column.
The specified buffer must be at least large enough to contain the number of characters in the rectangle. If the buffer is too small, no data is copied and zero is returned by the method. Otherwise, the method returns the number of characters copied.
- Parameters:
buffer- bufferbufferLength- lengthstartRow- row to startstartCol- column to startendRow- row to endendCol- column to endplane- plane- Returns:
- The number characters copied to the buffer
-
getActiveAidKeys
public boolean[] getActiveAidKeys()
-
setScreenData
protected void setScreenData(java.lang.String text, int location)
-
setCursor
public void setCursor(int row, int col)This routine is based on offset 1,1 not 0,0 it will translate to offset 0,0 and call the goto_XY(int pos) it is mostly used from external classes that use the 1,1 offset- Parameters:
row- number of rowcol- number of column
-
goto_XY
protected void goto_XY(int pos)
-
gotoField
public boolean gotoField(int f)
Set the current working field to the field number specified.- Parameters:
f- - numeric field number on the screen- Returns:
- true or false whether it was sucessful
-
gotoField
protected boolean gotoField(ScreenField screenField)
Convenience method to set the field object passed as the currect working screen field- Parameters:
screenField- a screen field object- Returns:
- true or false whether it was sucessful
-
createWindow
protected void createWindow(int depth, int width, int type, boolean gui, int monoAttr, int colorAttr, int ul, int upper, int ur, int left, int right, int ll, int bottom, int lr)
-
createScrollBar
protected void createScrollBar(int flag, int totalRowScrollable, int totalColScrollable, int sliderRowPos, int sliderColPos, int sbSize)Creates a scroll bar on the screen using the parameters provided. ** we only support vertical scroll bars at the time.- Parameters:
flag- - type to draw - vertical or horizontaltotalRowScrollable- numbertotalColScrollable- numbersliderRowPos- numbersliderColPos- numbersbSize- number
-
writeWindowTitle
protected void writeWindowTitle(int pos, int depth, int width, byte orientation, int monoAttr, int colorAttr, java.lang.StringBuffer title)
-
rollScreen
protected void rollScreen(int direction, int topLine, int bottomLine)Roll the screen up or down. Byte 1: Bit 0 0 = Roll up 1 = Roll down Bits 1-2 Reserved Bits 3-7 Number of lines that the designated area is to be rolled Byte 2: Bits 0-7 Line number defining the top line of the area that will participate in the roll. Byte 3: Bits 0-7 Line number defining the bottom line of the area that will participate in the roll.- Parameters:
direction- directiontopLine- number of top linebottomLine- number of bottom line
-
dumpScreen
public void dumpScreen()
-
getDumpScreen
public java.lang.String getDumpScreen()
-
addField
protected void addField(int attr, int len, int ffw1, int ffw2, int fcw1, int fcw2)Add a field to the field format table.- Parameters:
attr- - Field attributelen- - length of fieldffw1- - Field format word 1ffw2- - Field format word 2fcw1- - Field control word 1fcw2- - Field control word 2
-
getScreenFields
public ScreenFields getScreenFields()
Return the fields that are contained in the Field Format Table- Returns:
- ScreenFields object
-
drawFields
protected void drawFields()
Redraw the fields on the screen. Used for gui enhancement to redraw the fields when toggling
-
drawField
protected void drawField(ScreenField screenField)
Draws the field on the screen. Used to redraw or change the attributes of the field.- Parameters:
screenField- Field to be redrawn
-
setFieldHighlighted
protected void setFieldHighlighted(ScreenField sf)
Set the field to be displayed as highlighted.- Parameters:
sf- - Field to be highlighted
-
unsetFieldHighlighted
protected void unsetFieldHighlighted(ScreenField sf)
Draw the field as un higlighted. This is used to reset the field presentation on the screen after the field is exited.- Parameters:
sf- - Field to be unhighlighted
-
checkHotSpots
public boolean checkHotSpots()
-
setChar
protected void setChar(int cByte)
-
setEndingAttr
protected void setEndingAttr(int cByte)
-
setAttr
protected void setAttr(int cByte)
-
setScreenCharAndAttr
protected void setScreenCharAndAttr(char right, int colorAttr, boolean isAttr)
-
setScreenCharAndAttr
protected void setScreenCharAndAttr(char right, int colorAttr, int whichGui, boolean isAttr)
-
updateDirty
protected void updateDirty()
Draw or redraw the dirty parts of the screen and display them. Rectangle dirty holds the dirty area of the screen to be updated. If you want to change the screen in anyway you need to set the screen attributes before calling this routine.
-
setDirty
protected void setDirty(int pos)
-
advancePos
protected void advancePos()
Change the screen position by one column
-
changePos
protected void changePos(int i)
Change position of the screen by the increment of parameter passed. If the position change is under the minimum of the first screen position then the position is moved to the last row and column of the screen. If the position change is over the last row and column of the screen then cursor is moved to first position of the screen.- Parameters:
i- position
-
goHome
protected void goHome()
-
setPendingInsert
protected void setPendingInsert(boolean flag, int icX, int icY)
-
setPendingInsert
protected void setPendingInsert(boolean flag)
-
setErrorLine
protected void setErrorLine(int line)
Set the error line number to that of number passed.- Parameters:
line- number of the line
-
getErrorLine
protected int getErrorLine()
Returns the current error line number- Returns:
- current error line number
-
saveErrorLine
protected void saveErrorLine()
Saves off the current error line characters to be used later.
-
restoreErrorLine
protected void restoreErrorLine()
Restores the error line characters from the save buffer.
-
setStatus
protected void setStatus(byte attr, byte value, java.lang.String s)
-
isStatusErrorCode
protected boolean isStatusErrorCode()
-
clearAll
protected void clearAll()
This routine clears the screen, resets row and column to 0, resets the last attribute to 32, clears the fields, turns insert mode off, clears/initializes the screen character array.
-
clearTable
protected void clearTable()
Clear the fields table
-
clearGuiStuff
protected void clearGuiStuff()
Clear the gui constructs
-
clearScreen
protected void clearScreen()
Clear the screen by setting the initial character and initial attribute to all the positions on the screen
-
restoreScreen
protected void restoreScreen()
-
updateScreen
public final void updateScreen()
This method does a complete refresh of the screen.
-
addScreenListener
public void addScreenListener(ScreenListener listener)
Add a ScreenListener to the listener list.- Parameters:
listener- The ScreenListener to be added
-
removeScreenListener
public void removeScreenListener(ScreenListener listener)
Remove a ScreenListener from the listener list.- Parameters:
listener- The ScreenListener to be removed
-
repaintScreen
public void repaintScreen()
Utility method to share the repaint behaviour between setBounds() and updateScreen.
-
getCharacters
public char[] getCharacters()
-
-