public class RW3270 extends Object
| Modifier and Type | Field and Description |
|---|---|
static short |
AID_NO |
static short |
AID_READ_PARTITION |
static short |
AID_SF |
static short |
AID_TRIGGER |
static short |
CLEAR |
static short |
CLEAR_PARTITION |
static short |
ENTER |
static short |
PA1 |
static short |
PA2 |
static short |
PA3 |
static short |
PF1 |
static short |
PF10 |
static short |
PF11 |
static short |
PF12 |
static short |
PF13 |
static short |
PF14 |
static short |
PF15 |
static short |
PF16 |
static short |
PF17 |
static short |
PF18 |
static short |
PF19 |
static short |
PF2 |
static short |
PF20 |
static short |
PF21 |
static short |
PF22 |
static short |
PF23 |
static short |
PF24 |
static short |
PF3 |
static short |
PF4 |
static short |
PF5 |
static short |
PF6 |
static short |
PF7 |
static short |
PF8 |
static short |
PF9 |
static short |
SYSREQ |
| Constructor and Description |
|---|
RW3270(int modelNumber,
RWTnAction client)
Constructor.
|
RW3270(RWTnAction client)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
backspace()
Deletes the current character (by setting it to ' ') and decrements the
cursor position by one.
|
void |
backTab()
This method sets the cursor position to the first character position of
the last unprotected field.
|
void |
clear()
Executes the tn3270 clear command
|
void |
connect(String host,
int port)
This method implements connections directly to a host, bypassing the
SessionServer.
|
void |
connect(String host,
int port,
String host3270,
int port3270,
boolean encryption)
This method attempts to connect this 3270 object to the specified
SessionServer and 3270 Host.
|
boolean |
contains(String search)
Searches the current data buffer (screen) for the specified string.
|
void |
delete()
Deletes the current character (by setting it to ' ').
|
void |
disconnect()
Disconnects this RW3270 object from the current Session.
|
void |
down()
Moves the cursor position 'down' one row from it's current position.
|
void |
enter()
Presses the 'enter' key on the terminal.
|
short |
getAID()
DOCUMENT ME!
|
RW3270Char |
getChar()
This method returns the RW3270Char object at the current cursor
position
|
RW3270Char |
getChar(int i)
This method is useful for retrieving the RW3270 character object at a
particular position on the screen.
|
int |
getCols()
DOCUMENT ME!
|
int |
getCursorPosition()
DOCUMENT ME!
|
RW3270Char[] |
getDataBuffer()
Returns an array of RW3270Char objects representing the data buffer.
|
char[] |
getDisplay()
Gets the current screen's display characters.
|
RW3270Field |
getField()
This method returns the RW3270Field object that the current cursor
position is in.
|
RW3270Field |
getField(int i)
This method returns the RW3270Field object at the specified buffer
address
|
Vector |
getFields()
Returns a vector of fields representing the current 3270 screen.
|
short |
getNextUnprotectedField(int pos)
Returns the first character position of the next unprotected field from
the current cursor position.
|
protected short |
getPreviousUnprotectedField(int pos)
This method returns the first character position of the previous field
from the current cursor position.
|
int |
getRows()
DOCUMENT ME!
|
protected RWTelnet |
getTelnet() |
void |
home()
This method moves the cursor to the first character of the first
unprotected field in the data buffer.
|
boolean |
isKeyboardLocked()
This method is designed to let implementations check to see if the
'keyboard' is currently locked.
|
void |
keyFieldMark() |
void |
keyNewLine() |
void |
left()
Moves the cursor position one character to the left, wrapping when
necessary.
|
protected void |
lockKeyboard() |
void |
PA(int key)
Presses the specified PA Key, as specified in the constants for this
class.
|
void |
PF(int key)
Presses the specified PF Key, as specified in the constants for this
class.
|
void |
reset() |
protected void |
resumeParentThread() |
void |
right()
Moves the cursor position one character to the right, wrapping when
necessary.
|
void |
run() |
void |
setCursorPosition(short newCursorPos)
This method sets the cursor position.
|
void |
setEncryption(boolean encryption)
Sets the encryption setting for the 3270 session...
|
void |
setSessionData(String key,
String value)
Sets session data on the session server
|
void |
sysreq()
Executes the sysreq command
|
void |
tab()
Advances the cursor position to the first character position of the
next unprotected field.
|
String |
toString()
Returns a string representation of the current 3270 screen state.
|
void |
type(char key)
Inserts the specified ASCII character at the current cursor position if
the current field is unprotected, and advances the cursor position by
one.
|
protected void |
unlockKeyboard() |
void |
up()
Moves the cursor position 'up' one row from it's current position.
|
boolean |
waitFor(String search,
int timeout)
Blocks until the specified string is found in the data buffer (screen)
or until the specified timeout is reached.
|
void |
waitForNewData()
Blocks the currently executing thread until new data arrives from the
host.
|
public static final short AID_NO
public static final short AID_SF
public static final short AID_READ_PARTITION
public static final short AID_TRIGGER
public static final short SYSREQ
public static final short PF1
public static final short PF2
public static final short PF3
public static final short PF4
public static final short PF5
public static final short PF6
public static final short PF7
public static final short PF8
public static final short PF9
public static final short PF10
public static final short PF11
public static final short PF12
public static final short PF13
public static final short PF14
public static final short PF15
public static final short PF16
public static final short PF17
public static final short PF18
public static final short PF19
public static final short PF20
public static final short PF21
public static final short PF22
public static final short PF23
public static final short PF24
public static final short PA1
public static final short PA2
public static final short PA3
public static final short CLEAR
public static final short CLEAR_PARTITION
public static final short ENTER
public RW3270(RWTnAction client)
client - RWTnAction interface used for communicating with the
client implementationpublic RW3270(int modelNumber,
RWTnAction client)
2: 24x80
3: 32x80
4: 43x80
5: 27x132
modelNumber - the 3270 model number.client - RWTnAction interface used for communicating with
the client implementation.public void PA(int key)
key - - the key to be pressed, as specified in the constants for
this class.public void PF(int key)
key - - the key to be pressed, as specified in the constants for
this class.public void backTab()
public void backspace()
throws IsProtectedException
IsProtectedException - if the current field is protected.public void clear()
public void connect(String host, int port, String host3270, int port3270, boolean encryption)
IMPORTANT: this setting must match the SessionServer's
encryption setting in order to communicate successfully. the current
encryption setting of the SessionServer can be obtained by calling
>SessionServer<.getEncryption()
host - the hostname or ip address of the SessionServerport - the SessionServer's porthost3270 - the hostname or ip address of the 3270 host. (If using
SessionServer)port3270 - the port of the 3270 hostencryption - true if encryption should be used, false
otherwise.public void connect(String host, int port) throws IOException, UnknownHostException
host - The hostname of the TN3270 host to connect toport - The port on which to connect to the TN3270 hostIOException - DOCUMENT ME!UnknownHostException - DOCUMENT ME!public boolean contains(String search)
search - The string to search the data buffer for.true if the string was found, false
otherwise.public void delete()
throws IsProtectedException
IsProtectedException - if the current field is protected.public void disconnect()
public void down()
For example, in an 80-column screen, calling the down()
mehtod will increase the cursor position by 80. This method will
'wrap' from the last row to the first row
public void enter()
This sets the AID to ENTER, and fires off a Read Modified command on the current buffer.
public short getAID()
public RW3270Char getChar(int i)
i - Screen position of the requested RW3270Char objectpublic RW3270Char getChar()
public int getCols()
public int getCursorPosition()
public RW3270Char[] getDataBuffer()
public char[] getDisplay()
public RW3270Field getField()
public RW3270Field getField(int i)
i - Screen position of the requested RW3270Field Object.public Vector getFields()
public short getNextUnprotectedField(int pos)
pos - DOCUMENT ME!public int getRows()
public void home()
public boolean isKeyboardLocked()
true if the screen is not currently accepting
input, false if it is.public void keyFieldMark()
public void keyNewLine()
public void left()
public void reset()
public void right()
Returns without moving the cursor if the terminal is currently locked.
public void run()
public void setCursorPosition(short newCursorPos)
newCursorPos - The new cursor positionpublic void setEncryption(boolean encryption)
encryption - will turn encryption on, false will turn encryption
offpublic void setSessionData(String key, String value)
key - DOCUMENT ME!value - DOCUMENT ME!public void sysreq()
public void tab()
public String toString()
The returned string is a unique description of the terminal screen contents.
public void type(char key)
throws IsProtectedException
key - keyboard/ASCII character corresponding to the key pressed.IsProtectedException - if the current field is protected.RW3270Fieldpublic void up()
For example, in an 80-column screen, calling the up()
mehtod will decrease the cursor position by 80. This method will
'wrap' from the first row to the last row
public boolean waitFor(String search, int timeout)
This method is extrememly useful when the host may be sending several
screens in response to your request, and you want to block until you
reach the response you're waiting for. For example:
...
// Create a RW3270 object
RW3270 rw = new RW3270(this);
// Connect to the SessionServer and specify a host
rw.connect("3.3.88.3", 6870, "hollis.harvard.edu", 23, true);
// This will block for 30 seconds or until the string
// H A R V A R D is found. it also returns a boolean to
// let us check the results
boolean t = rw.waitFor("H A R V A R D", 30);
// Now we'll execute two different blocks of code depending
// on whether our string was found:
if(t) {
out.print("Got it:");
out.print(new String(rw.getDisplay()));
} else {
out.print("Didn't get it:>");
out.print(new String(rw.getDisplay()));
}
search - the string to wait for.timeout - number of seconds to wait for the search string.true if the string was found, false
if the timeout was reached without finding it.public void waitForNewData()
This method is useful when using stateless client implementations (i.e. HTTP) or when you're scripting through several 3270 screens.
For example:
...
//Set the value of a field and press enter
RW3270Field.setData("My Data");
RW3270.enter();
//Wait for the new screen
RW3270.waitForNewData();
myClient.paintScreen()....
IMPORTANT: This method only blocks until the 3270 engine has received a response from the host and processed it. In the case where the host has sent an EraseAllUnprotected or other Non-Data type command, this method will return normally, even though the DataBuffer (screen) may be empty. Client implementations need to handle any host-specific anomalies such as screen clears, etc.
protected short getPreviousUnprotectedField(int pos)
pos - DOCUMENT ME!protected RWTelnet getTelnet()
protected void lockKeyboard()
protected void resumeParentThread()
protected void unlockKeyboard()
Copyright © 2013. All Rights Reserved.