unikix.clientapis.emulator
Class KixEmulator

java.lang.Object
  |
  +--java.awt.Component
        |
        +--unikix.clientapis.emulator.KixEmulator

public class KixEmulator
extends Component
implements Kix3270Constants

A 3270 terminal emulator. It exposes a set of methods for direct emulator manipulation, along with methods for interrogating and setting the emulators appearance.

Also defined are the constants, which consists of the following groups:

This class can either be used as a standard visible 3270 emulator, or as an invisible 3270 emulator. If it is used as an invisible emulator, there is a performance advantage since it is not necessary to draw any updates to the screen.

The visibility of the emulator is rarely ever directly specified, but a KixEmulator becomes 'visible' when it is added to a Component hierarchy within a graphical java application/applet.

Programming Notes

Method Usage

The KixEmulator class has a large number of methods that are used to control the complete details of its operation. These methods can be summarized into the following categories.

Connection Control

These methods allow the control of the various aspects of the connection to the TN3270 host. The methods, in general, will throw an IllegalStateException if the terminal is not in a reasonable state to perform the operation.

Using these methods at their most basic level, a connection can be established using code similar to the example below:
...
KixEmulator ke = new KixEmulator();
ke.setTN3270Host(myHost);
ke.setTN3270Port(myPort);
ke.connect();
ke.waitUntilConnected();
...

Emulator Interaction

There are several methods that allow the programmer to 'interact' with the emulator. The methods provided map closely to the thought processes used by a operator of a real 3270 device. This means that there are calls such as pressPF(3), and typeString("Something") can be used to simulate the operations that would normally be performed by the terminal operator.

There are also methods that do the 'waiting' that a real 3270 terminal operator has to do.

This functionality is best described in an example:
...
ke.tab();
ke.typeString("Something");
ke.tab();
ke.typeString("SomethingElse");
ke.pressEnter();
ke.waitUntilKeyboardUnlocked();
ke.pressPF(3);
ke.waitUntilKeyboardUnlocked();
...

These methods, in general, will throw an IllegalStateException if the terminal is not in a reasonable state to perform the operation.

Emulator Interrogation

A wide variety of mechanisms are available for querying the contents of the 3270 screen. The 3270 screen can be viewed as:

Visible Emulator Configuration

If you choose to display a KixEmulator, its appearance can be extensively customized. Such things as the font, text and background colors, etc can all be configured. For example:
...
ke.setBackground(Color.red);
ke.setFont(new Font("Monospaced",Font.PLAIN,15));
...

Modes of operation

The KixEmulator is primarily designed as a TN3270 client, and as such deals primarily with 3270 datastreams. However, it is possible for the KixEmulator to deal with non-3270 datastreams. This non-3270 mode of operation is required in the following circumstances:

When the KixEmulator is dealing with these non-3270 datastreams, it is deemed to be a Network Virtual Terminal (NVT). The programmer can determine this scenario by examining the terminal mode property of the KixEmulator. Whilst the datastreams are completely hidden from the programmer, some methods are not available when in NVT mode.

The majority of applications need not worry about the mode of operation since they will be communicating exclusively in 3270 mode.

DBCS Considerations

When a KixEmulator is to be used to access a DBCS host, the programmer must take this into consideration. In particular, the valid characters that can be 'typed' into the KixEmulator varies according to the attributes of the field into which it is being typed. Details of the DBCS requirements can be found in the details of the methods such as typeString().


Field Summary
static String CODEPAGE_DEFAULT
           
static String CODEPAGE_IBM037
           
static String CODEPAGE_IBM1025
           
static String CODEPAGE_IBM1026
           
static String CODEPAGE_IBM1047
           
static String CODEPAGE_IBM1140
           
static String CODEPAGE_IBM1141
           
static String CODEPAGE_IBM1142
           
static String CODEPAGE_IBM1143
           
static String CODEPAGE_IBM1144
           
static String CODEPAGE_IBM1145
           
static String CODEPAGE_IBM1146
           
static String CODEPAGE_IBM1147
           
static String CODEPAGE_IBM1148
           
static String CODEPAGE_IBM1149
           
static String CODEPAGE_IBM273
           
static String CODEPAGE_IBM277
           
static String CODEPAGE_IBM278
           
static String CODEPAGE_IBM280
           
static String CODEPAGE_IBM284
           
static String CODEPAGE_IBM285
           
static String CODEPAGE_IBM297
           
static String CODEPAGE_IBM500
           
static String CODEPAGE_IBM870
           
static String CODEPAGE_IBM875
           
static String CODEPAGE_IBM930
           
static String CODEPAGE_IBM933
           
static String CODEPAGE_IBM935
           
static String CODEPAGE_IBM937
           
static String CODEPAGE_IBM939
           
static int CONNECTION_STATE_CONNECTED
           
static int CONNECTION_STATE_CONNECTING
           
static int CONNECTION_STATE_DISCONNECTED
           
static int CONNECTION_STATE_DISCONNECTING
           
static int CURSOR_BLOCK
           
static int CURSOR_INVERSE
           
static int CURSOR_SIDELINE
           
static int CURSOR_UNDERLINE
           
static int DISC_REASON_DEVICE_IN_USE
           
static int DISC_REASON_DROPPED
           
static int DISC_REASON_INV_DEVICE_TYPE
           
static int DISC_REASON_INV_NAME
           
static int DISC_REASON_NEVER_CONNECTED
           
static int DISC_REASON_NO_CONNECTION_ESTABLISHED
           
static int DISC_REASON_NOT_TN3270_HOST
          Deprecated. Non-3270 communication is now allowed, so this is never generated.
static int DISC_REASON_SECURITY_FAILURE
           
static int DISC_REASON_STOPPED_BY_USER
           
static int DISC_REASON_TIMED_OUT
           
static int DISC_REASON_TYPE_NAME_ERROR
           
static int DISC_REASON_UNKNOWN_ERROR
           
static int DISC_REASON_UNSUPPORTED_REQ
           
static int MODEL_3278_2
           
static int MODEL_3278_2_E
           
static int MODEL_3278_3
           
static int MODEL_3278_3_E
           
static int MODEL_3278_4
           
static int MODEL_3278_4_E
           
static int MODEL_3278_5
           
static int MODEL_3278_5_E
           
static int PRINTSTYLE_BLACK_ON_WHITE
           
static int PRINTSTYLE_NORMAL
           
static int PRINTSTYLE_REVERSE
           
static int PRINTSTYLE_WHITE_ON_BLACK
           
static int TERMINAL_MODE_3270_NORMAL
           
static int TERMINAL_MODE_3270_SUSPEND
           
static int TERMINAL_MODE_NONE
           
static int TERMINAL_MODE_NVT
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
KixEmulator()
          Construct a KixEmulator.
KixEmulator(KixEmulator source)
          Construct a KixEmulator.
 
Method Summary
 void addHighlightArea(int offset, int length, Color color)
          Add an area of the 3270 display to be highlighted in the given Color.
 void addHighlightAreas(int[] offset, int[] length, Color[] color)
          Add multiple areas of the 3270 display to be highlighted in the given Colors.
 void addKixEmulatorListener(KixEmulatorListener l)
          Add a KixEmulatorListener.
 void addNotify()
           
 void addPropertyChangeListener(PropertyChangeListener l)
          Add a PropertyChangeListener to the listener list.
 void backspace()
          Simulates the pressing of the backspace key on the keyboard.
 void backtab()
          Simulates the pressing of the backtab key on the keyboard.
 int columnFromOffset(int offset)
          Gets the column from a given offset.
 void connect()
          Attempts to establish a connection to the specified host system.
 void cursorDown()
          Moves the cursor down one character position.
 void cursorLeft()
          Moves the cursor one character position to the left.
 void cursorRight()
          Moves the cursor one character position to the right.
 void cursorUp()
          Moves the cursor up one character position.
 void delete()
          Simulates the pressing of the delete key on the keyboard.
 void disconnect()
          Disconnects from the currently connected system.
 void disconnect(String msg)
          Disconnects from the currently connected system.
 void dispose()
          Disposes of the emulator and releases any resources that it is using.
 void dump(OutputStream os)
          Perform a diagnostic dump of the state of the Emulator.
 void dump(PrintWriter pw)
          Perform a diagnostic dump of the state of the Emulator.
 void eraseEndOfField()
          Simulates the pressing of the EOF key on the keyboard.
 void eraseInput()
          Simulates the pressing of the Erase Input key on the keyboard.
 KixField findField(int offset)
          Get the field that contains the given offset.
 void firePropertyChange(String propertyName, Object oldValue, Object newValue)
           
 Color getBackground()
          Get the Background Color of the terminal.
 Insets getBoundary()
          Returns an Insets object representing the 'freespace' around the emulator.
 short[] getCharSetBuffer()
          Gets a copy of the charset buffer.
 char[] getColorBuffer()
          Gets a copy of the color buffer.
 int getColumns()
          Get the number of columns of the terminal.
 int getColumnWidth()
          Returns the width of a single column of the emulator in pixels.
 int getConnectionState()
          Gets the connection state of the terminal.
 String getCopyrightString()
          This method returns the Sun Copyright String.
 int getCursorColumn()
          Get the column of the emulator containing the cursor.
 int getCursorOffset()
          Get the offset of the cursor in the current 3270 buffer.
 int getCursorRow()
          Get the row of the emulator containing the cursor.
 char[] getDisplayBuffer()
          Gets a copy of the display buffer.
 int getDisplaySize()
          Get the display size of the terminal in characters.
 char[] getExtendedAttributeBuffer()
          Gets a copy of the extended attribute buffer.
 Color[] getExtendedColors()
          Get the Extended Color Map.
 Color getExtendedColors(int index)
          Get a single extended Color Map entry.
 Vector getFields()
          Gets a Vector that contains representations of the fields.
 Font getFont()
          Gets the font of the terminal.
 boolean getForceEWA()
          Gets the boolean value of whether ForceEWA is set or not.
 String getHostCodepage()
          Gets the EBCDIC codepage used for conversion of characters to and from the 3270 host system.
 String getIdentifierString()
          This method returns a String that identifies the version and build level of this Bean.
 Color getInsertCursorColor()
          Get the Insert Cursor Color.
 int getInsertCursorStyle()
          Get the Insert Cursor Style.
 boolean getKeyHandling()
          Determine if the emulator is to use the default keyboard handling.
 int getLastDisconnectionReason()
          Gets the reason for the last disconnection of the terminal.
 String getLastDisconnectionString()
          Gets the reason for the last disconnection of the terminal as a String.
 int getMaximumColumns()
          Get the maximum number of columns of the terminal.
 int getMaximumDisplaySize()
          Get the maximum display size of the terminal in characters.
 int getMaximumRows()
          Get the maximum number of rows of the terminal.
 Dimension getMinimumSize()
           
 int getModel()
          Get the Model of the terminal.
 String getNetname()
          Get the Netname used for the current 3270 session.
 int getNetworkInactivityTimeout()
          Get the Network Inactivity Timeout for the remote connection.
 boolean getNumericInputValidation()
          Determine whether validation is performed of characters typed in numeric fields
 Color getOvertypeCursorColor()
          Get the Overtype Cursor Color.
 int getOvertypeCursorStyle()
          Get the Overtype Cursor Style.
 String getPreferredNetname()
          When connecting to a TN3270E server, it is possible to specify a netname that a terminal wishes to connect as.
 Dimension getPreferredSize()
           
 int getPrintStyle()
          Get the style of printing.
 Color getProtectedIntenseColor()
          Get the Protected Intense Color.
 Color getProtectedNormalColor()
          Get the Protected Normal Color of the terminal.
 String getReadableString(int offset, int length)
          Get a portion of the screen as a human readable string.
 int getRowHeight()
          Returns the height of a single row of the emulator in pixels.
 int getRows()
          Get the number of rows of the terminal.
 Color getStatusBarBackground()
          Get the Status Bar Background.
 Color getStatusBarForeground()
          Get the Status Bar Foreground.
 int getTerminalMode()
          Gets the current terminal mode.
 String getTN3270Host()
          Gets the TN3270 Host value of the terminal.
 int getTN3270Port()
          Get the TN3270 Port value of the terminal.
 Color getUnprotectedIntenseColor()
          Get the Unprotected Intense Color of the terminal.
 Color getUnprotectedNormalColor()
          Get the Unprotected Normal Color of the terminal.
 void home()
          Simulates the pressing of the home key on the keyboard.
 boolean isCapturingData()
          Determine if the emulator is to capture histories of data for use in dumping at a future time.
 boolean isCharFlashing(int offset)
          Return true if the character is flashing.
 boolean isCharFlashing(int row, int column)
          Return true if the character is flashing.
 boolean isCharReversed(int offset)
          Return true if the character is reversed.
 boolean isCharReversed(int row, int column)
          Return true if the character is reversed.
 boolean isCharUnderlined(int offset)
          Return true if the character is underlined.
 boolean isCharUnderlined(int row, int column)
          Return true if the character is underlined.
 boolean isConnected()
          Return true if the terminal is in a connected state.
 boolean isConnecting()
          Return true if the terminal is in a connecting state.
 boolean isDisconnected()
          Return true if the terminal is in a disconnected state.
 boolean isDisconnecting()
          Return true if the terminal is in a disconnecting state.
 boolean isFormatted()
          Return true if the terminal display is formatted.
 boolean isInsertCursorFlashing()
          Determine whether the Insert Cursor should flash or not.
 boolean isInserting()
          Return true if insert mode is operational.
 boolean isKeyboardInitiallyUnlocked()
          This determines whether to unlock the keyboard on receiving the first datastream from the host.
 boolean isKeyboardLocked()
          Return true if the keyboard is locked.
 boolean isOvertypeCursorFlashing()
          Determine whether the Overtype Cursor should flash or not.
 boolean isStatusBarShowing()
          Determine whether the visible emulator should have a Status Bar on it.
 boolean isSysreqAllowed()
          This method is used to determine if the use of pressSysreq() is allowed.
 boolean isTN3270EAllowed()
          Allow the KixEmulator to use the TN3270E protocol (as defined in RFC 1647 and RFC 2355).
 void moveCursorToOffset(int offset)
          Moves the cursor to the specified offset on the screen.
 void moveCursorToRowColumn(int row, int column)
          Moves the cursor to the specified row,column on the screen.
 void newline()
          Simulates the pressing of the newline key on the keyboard.
 int offsetFromPoint(int x, int y)
          Return the offset value given the x,y screen pixel position.
 int offsetFromPoint(Point p)
          Return the offset value given a Point p screen pixel position.
 int offsetFromRowColumn(int row, int column)
          Return the offset value given a row, column pair.
 void paint(Graphics g)
           
 void pressATTN()
          Simulate the pressing of the ATTN key.
 void pressClear()
          Simulates the pressing of the clear key on the keyboard.
 void pressCursorSelect()
          Simulates the pressing of the Cursor Select key on the keyboard.
 void pressDUP()
          Simulates the pressing of the DUP key on the keyboard.
 void pressEnter()
          Simulates the pressing of the enter key on the keyboard.
 void pressFieldMark()
          Simulates the pressing of the Field Mark key on the keyboard.
 void pressPA(int key)
          Simulates the pressing of the specified PA key on the keyboard.
 void pressPF(int key)
          Simulates the pressing of the specified PF key on the keyboard.
 void pressReset()
          Simulates the pressing of the Reset key on the keyboard.
 void pressSysreq()
          Simulate the pressing of the SYSREQ key.
 void print(Graphics g)
           
 void printAll(Graphics g)
           
 void removeAllHighlightAreas()
          Remove all the highlighted areas from the screen.
 void removeKixEmulatorListener(KixEmulatorListener l)
          Remove a KixEmulatorListener.
 void removeNotify()
           
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a PropertyChangeListener from the listener list.
 int rowFromOffset(int offset)
          Gets the row from a given offset.
 void setBackground(Color c)
          Sets the terminal Background Color to the specified color.
 void setBounds(int x, int y, int w, int h)
           
 void setCapturingData(boolean b)
          Define if the emulator is to capture histories of data for use in dumping at a future time.
 void setDebugDestination(PrintWriter pw)
          Output debug information to the supplied PrintWriter
 void setEnabled(boolean b)
           
 void setExtendedColors(Color[] c)
          Set a the colors in the color map for the colors as defined by the extended attributes on the screen.
 void setExtendedColors(int index, Color c)
          Set a single color in the color map for the colors as defined by the extended attributes on the screen.
 void setFont(Font NewFont)
          Sets the terminal font to the specified font.
 void setForceEWA(boolean b)
          Treat all datastreams that come in as being for the alternate screen size.
 void setForceInitialEW(boolean b)
          This method causes a datastream to be generated internally that clears the screen and frees the keyboard.
 void setHostCodepage(String s)
          Sets the EBCDIC codepage to use for conversion of characters to and from the 3270 host system.
 void setInsertCursorColor(Color c)
          Set the Insert Cursor Color.
 void setInsertCursorFlashing(boolean b)
          Set whether the Insert Cursor should flash or not.
 void setInsertCursorStyle(int style)
          Set the Insert Cursor Style.
 void setInserting(boolean insertMode)
          Set the insert mode.
 void setKeyboardInitiallyUnlocked(boolean b)
          This determines whether to unlock the keyboard on receiving the first datastream from the host.
 void setKeyHandling(boolean b)
          Set whether the emulator is to use the default keyboard handling or not.
 void setModel(int newModel)
          Set the Model to the specified int.
 void setNetworkInactivityTimeout(int seconds)
          Set the Network Inactivity Timeout for the remote connection.
 void setNumericInputValidation(boolean b)
          Control whether validation is performed of characters typed in numeric fields
 void setOvertypeCursorColor(Color c)
          Set the overtype cursor color.
 void setOvertypeCursorFlashing(boolean b)
          Set whether the Overtype Cursor should flash or not.
 void setOvertypeCursorStyle(int style)
          Set the Overtype Cursor Style.
 void setPreferredNetname(String name)
          When connecting to a TN3270E server, it is possible to specify a netname that a terminal wishes to connect as.
 void setPrintStyle(int style)
          Set the style of printing to be used.
 void setProtectedIntenseColor(Color c)
          Set the Protected Intense Color to the specified color.
 void setProtectedNormalColor(Color c)
          Sets the Protected Normal Color to the specified color.
 void setStatusBarBackground(Color c)
          Set the Status Bar Background to the specified color.
 void setStatusBarForeground(Color c)
          Set the Status Bar Foreground to the specified color.
 void setStatusBarShowing(boolean displayValue)
          Set whether the visible emulator should have a Status Bar on it.
 void setTN3270EAllowed(boolean b)
          Allow the KixEmulator to use the TN3270E protocol (as defined in RFC 1647 and RFC 2355).
 void setTN3270Host(String newHost)
          Set the TN3270 Host to the specified String.
 void setTN3270Port(int newPort)
          Set the TN3270 Port to the specified int.
 void setUnprotectedIntenseColor(Color c)
          Set the Unprotected Intense Color to the specified color.
 void setUnprotectedNormalColor(Color c)
          Sets the terminal Unprotected Normal Color to the specified color.
 void tab()
          Simulates the pressing of the tab key on the keyboard.
 void typeChar(char c)
          Types a character on the emulator at the current cursor position.
 void typeCharNVT(char c)
          Types a character on the emulator at the current cursor position.
 void typeString(String s)
          Types a string on the emulator at the current cursor position.
 void update(Graphics g)
           
 void waitHeuristic(int timeInMillis)
          Wait for a response from the host in a heuristic manner.
 void waitUntilConnected()
          Wait until the emulator is connected.
 void waitUntilDisconnected()
          Wait until the emulator is disconnected.
 void waitUntilKeyboardUnlocked()
          Wait until the emulator keyboard is unlocked.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, getAlignmentX, getAlignmentY, getBounds, getColorModel, getComponentAt, getComponentAt, getCursor, getFontMetrics, getForeground, getGraphics, getLocale, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, invalidate, isEnabled, isFocusTraversable, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBounds, setCursor, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MODEL_3278_2

public static final int MODEL_3278_2

MODEL_3278_2_E

public static final int MODEL_3278_2_E

MODEL_3278_3

public static final int MODEL_3278_3

MODEL_3278_3_E

public static final int MODEL_3278_3_E

MODEL_3278_4

public static final int MODEL_3278_4

MODEL_3278_4_E

public static final int MODEL_3278_4_E

MODEL_3278_5

public static final int MODEL_3278_5

MODEL_3278_5_E

public static final int MODEL_3278_5_E

CONNECTION_STATE_CONNECTED

public static final int CONNECTION_STATE_CONNECTED

CONNECTION_STATE_CONNECTING

public static final int CONNECTION_STATE_CONNECTING

CONNECTION_STATE_DISCONNECTED

public static final int CONNECTION_STATE_DISCONNECTED

CONNECTION_STATE_DISCONNECTING

public static final int CONNECTION_STATE_DISCONNECTING

TERMINAL_MODE_NONE

public static final int TERMINAL_MODE_NONE

TERMINAL_MODE_NVT

public static final int TERMINAL_MODE_NVT

TERMINAL_MODE_3270_NORMAL

public static final int TERMINAL_MODE_3270_NORMAL

TERMINAL_MODE_3270_SUSPEND

public static final int TERMINAL_MODE_3270_SUSPEND

PRINTSTYLE_NORMAL

public static final int PRINTSTYLE_NORMAL

PRINTSTYLE_REVERSE

public static final int PRINTSTYLE_REVERSE

PRINTSTYLE_WHITE_ON_BLACK

public static final int PRINTSTYLE_WHITE_ON_BLACK

PRINTSTYLE_BLACK_ON_WHITE

public static final int PRINTSTYLE_BLACK_ON_WHITE

CURSOR_BLOCK

public static final int CURSOR_BLOCK

CURSOR_INVERSE

public static final int CURSOR_INVERSE

CURSOR_UNDERLINE

public static final int CURSOR_UNDERLINE

CURSOR_SIDELINE

public static final int CURSOR_SIDELINE

DISC_REASON_NEVER_CONNECTED

public static final int DISC_REASON_NEVER_CONNECTED

DISC_REASON_NO_CONNECTION_ESTABLISHED

public static final int DISC_REASON_NO_CONNECTION_ESTABLISHED

DISC_REASON_STOPPED_BY_USER

public static final int DISC_REASON_STOPPED_BY_USER

DISC_REASON_DROPPED

public static final int DISC_REASON_DROPPED

DISC_REASON_TIMED_OUT

public static final int DISC_REASON_TIMED_OUT

DISC_REASON_NOT_TN3270_HOST

public static final int DISC_REASON_NOT_TN3270_HOST
Deprecated. Non-3270 communication is now allowed, so this is never generated.

DISC_REASON_SECURITY_FAILURE

public static final int DISC_REASON_SECURITY_FAILURE

DISC_REASON_DEVICE_IN_USE

public static final int DISC_REASON_DEVICE_IN_USE

DISC_REASON_INV_NAME

public static final int DISC_REASON_INV_NAME

DISC_REASON_INV_DEVICE_TYPE

public static final int DISC_REASON_INV_DEVICE_TYPE

DISC_REASON_TYPE_NAME_ERROR

public static final int DISC_REASON_TYPE_NAME_ERROR

DISC_REASON_UNKNOWN_ERROR

public static final int DISC_REASON_UNKNOWN_ERROR

DISC_REASON_UNSUPPORTED_REQ

public static final int DISC_REASON_UNSUPPORTED_REQ

CODEPAGE_DEFAULT

public static final String CODEPAGE_DEFAULT

CODEPAGE_IBM037

public static final String CODEPAGE_IBM037

CODEPAGE_IBM273

public static final String CODEPAGE_IBM273

CODEPAGE_IBM277

public static final String CODEPAGE_IBM277

CODEPAGE_IBM278

public static final String CODEPAGE_IBM278

CODEPAGE_IBM280

public static final String CODEPAGE_IBM280

CODEPAGE_IBM284

public static final String CODEPAGE_IBM284

CODEPAGE_IBM285

public static final String CODEPAGE_IBM285

CODEPAGE_IBM297

public static final String CODEPAGE_IBM297

CODEPAGE_IBM500

public static final String CODEPAGE_IBM500

CODEPAGE_IBM870

public static final String CODEPAGE_IBM870

CODEPAGE_IBM875

public static final String CODEPAGE_IBM875

CODEPAGE_IBM930

public static final String CODEPAGE_IBM930

CODEPAGE_IBM933

public static final String CODEPAGE_IBM933

CODEPAGE_IBM935

public static final String CODEPAGE_IBM935

CODEPAGE_IBM937

public static final String CODEPAGE_IBM937

CODEPAGE_IBM939

public static final String CODEPAGE_IBM939

CODEPAGE_IBM1025

public static final String CODEPAGE_IBM1025

CODEPAGE_IBM1026

public static final String CODEPAGE_IBM1026

CODEPAGE_IBM1047

public static final String CODEPAGE_IBM1047

CODEPAGE_IBM1140

public static final String CODEPAGE_IBM1140

CODEPAGE_IBM1141

public static final String CODEPAGE_IBM1141

CODEPAGE_IBM1142

public static final String CODEPAGE_IBM1142

CODEPAGE_IBM1143

public static final String CODEPAGE_IBM1143

CODEPAGE_IBM1144

public static final String CODEPAGE_IBM1144

CODEPAGE_IBM1145

public static final String CODEPAGE_IBM1145

CODEPAGE_IBM1146

public static final String CODEPAGE_IBM1146

CODEPAGE_IBM1147

public static final String CODEPAGE_IBM1147

CODEPAGE_IBM1148

public static final String CODEPAGE_IBM1148

CODEPAGE_IBM1149

public static final String CODEPAGE_IBM1149
Constructor Detail

KixEmulator

public KixEmulator()
Construct a KixEmulator. This no-parameter constructor is the standard Bean entry point.

KixEmulator

public KixEmulator(KixEmulator source)
Construct a KixEmulator. This constructor takes as a parameter an already existent KixEmulator object, and constructs a another emulator from that that reflects the same connection(s) to the host.

Operations of a non-display oriented nature on one of the KixEmulator objected will be reflected by the other.

Operations of a display oriented nature on one will not be reflected by the other.

Parameters:
source - The KixEmulator upon which the new one is to be based.
Method Detail

update

public void update(Graphics g)
Overrides:
update in class Component

paint

public void paint(Graphics g)
Overrides:
paint in class Component

print

public void print(Graphics g)
Overrides:
print in class Component

printAll

public void printAll(Graphics g)
Overrides:
printAll in class Component

removeNotify

public void removeNotify()
Overrides:
removeNotify in class Component

addNotify

public void addNotify()
Overrides:
addNotify in class Component

getCopyrightString

public String getCopyrightString()
This method returns the Sun Copyright String.
Returns:
The Sun Copyright String

getIdentifierString

public String getIdentifierString()
This method returns a String that identifies the version and build level of this Bean.
Returns:
An identifying String

isKeyboardLocked

public boolean isKeyboardLocked()
Return true if the keyboard is locked.
Returns:
boolean The keyboard lock state

setTN3270Host

public void setTN3270Host(String newHost)
Set the TN3270 Host to the specified String. The String is a representation of the remote TCP host, either specified as a host name or an IP address. The default value is "localhost".
Parameters:
newHost - The TN3270 Host
See Also:
getTN3270Host()

getTN3270Host

public String getTN3270Host()
Gets the TN3270 Host value of the terminal.
Returns:
The TN3270 Host.
See Also:
setTN3270Host(java.lang.String)

setTN3270Port

public void setTN3270Port(int newPort)
Set the TN3270 Port to the specified int. The int is the number of the port to connect to. The default value is 2001.
Parameters:
newPort - The TN3270 port
See Also:
getTN3270Port()

getTN3270Port

public int getTN3270Port()
Get the TN3270 Port value of the terminal.
Returns:
The TN3270 port
See Also:
setTN3270Port(int)

setModel

public void setModel(int newModel)
Set the Model to the specified int. The default value is MODEL_3278_2_E.
Parameters:
newModel - The TN3270 model - this should be to one of the MODEL_XXXX constant values defined in this class.
See Also:
getModel()

getModel

public int getModel()
Get the Model of the terminal.
Returns:
An int representing the TN3270 model - this will be one of the MODEL_XXXX constant values defined in this class.
See Also:
setModel(int)

setNetworkInactivityTimeout

public void setNetworkInactivityTimeout(int seconds)
Set the Network Inactivity Timeout for the remote connection. A value of 0 indicates that no timeout will occur. The default timeout value is 300 seconds (5 minutes).

IMPORTANT NOTE: The calling of this method when the KixEmulator is CONNECTED is known to be unreliable in some Java environments. It is highly recommended that this method is only called when the KixEmulator is DISCONNECTED. This restriction may be imposed by this method in a future release.

Parameters:
seconds - The Network Inactivity Timeout value in seconds after which the connection to the remote system may be dropped if no activity has occurred.
See Also:
getNetworkInactivityTimeout()

getNetworkInactivityTimeout

public int getNetworkInactivityTimeout()
Get the Network Inactivity Timeout for the remote connection. A value of 0 indicates that no timeout will occur.
Returns:
The Network Inactivity Timeout Value in seconds
See Also:
setNetworkInactivityTimeout(int)

getMaximumRows

public int getMaximumRows()
Get the maximum number of rows of the terminal.
Returns:
The maximum number of rows

getMaximumColumns

public int getMaximumColumns()
Get the maximum number of columns of the terminal.
Returns:
The maximum number of columns

getMaximumDisplaySize

public int getMaximumDisplaySize()
Get the maximum display size of the terminal in characters. This is equal to maximumRows * maximumColumns.
Returns:
The maximum display size

getRows

public int getRows()
Get the number of rows of the terminal. This is dependant on the model.
Returns:
The number of rows

getColumns

public int getColumns()
Get the number of columns of the terminal. This is dependant on the model.
Returns:
The number of columns

getDisplaySize

public int getDisplaySize()
Get the display size of the terminal in characters. This is dependant on the model.
Returns:
The display size

getConnectionState

public int getConnectionState()
Gets the connection state of the terminal.
Returns:
An int representing the connection state - this will be one of the CONNECTION_STATE_XXXX constant values defined in this class.

isConnected

public boolean isConnected()
Return true if the terminal is in a connected state.
Returns:
The connected state
See Also:
isConnecting(), isDisconnected(), isDisconnecting()

isConnecting

public boolean isConnecting()
Return true if the terminal is in a connecting state.
Returns:
The connecting state
See Also:
isConnected(), isDisconnected(), isDisconnecting()

isDisconnected

public boolean isDisconnected()
Return true if the terminal is in a disconnected state.
Returns:
The disconnected state
See Also:
isConnected(), isConnecting(), isDisconnecting()

isDisconnecting

public boolean isDisconnecting()
Return true if the terminal is in a disconnecting state.
Returns:
The disconnecting state
See Also:
isConnected(), isConnecting(), isDisconnected()

getLastDisconnectionReason

public int getLastDisconnectionReason()
Gets the reason for the last disconnection of the terminal.
Returns:
an int representing the Disconnection Reason - this corrolates to one of the DISC_REASON_XXXX constant values defined in this class.

getLastDisconnectionString

public String getLastDisconnectionString()
Gets the reason for the last disconnection of the terminal as a String.
Returns:
an String representing the Disconnection Reason

connect

public void connect()
Attempts to establish a connection to the specified host system. Uses the values set in TN3270Host and TN3270Port.
Throws:
IllegalStateException - This exception is thrown if the emulator is already connected to a host, or if this is an EVALUATION copy of the KixEmulator Bean which has expired.
See Also:
disconnect(), disconnect(java.lang.String)

disconnect

public void disconnect()
Disconnects from the currently connected system. This is the equivalent of disconnect(null).
Throws:
IllegalStateException - if the emulator is not connected to a host
See Also:
disconnect(java.lang.String), connect()

disconnect

public void disconnect(String msg)
Disconnects from the currently connected system.
Parameters:
msg - The string to be displayed in the disconnection message on a visible KixEmulator. If null then the default message is used.
Throws:
IllegalStateException - if the emulator is not connected to a host
See Also:
disconnect(), connect()

getCursorRow

public int getCursorRow()
Get the row of the emulator containing the cursor.
Returns:
The emulator row

getCursorColumn

public int getCursorColumn()
Get the column of the emulator containing the cursor.
Returns:
The emulator column

getCursorOffset

public int getCursorOffset()
Get the offset of the cursor in the current 3270 buffer.
Returns:
The offset value

getFields

public Vector getFields()
Gets a Vector that contains representations of the fields. The elements in the Vector will be KixFields and they will be in ascending start offset order.

If this method is performed on an unformatted screen, an empty vector is returned.

Returns:
Vector of KixFields
See Also:
findField(int)

isFormatted

public boolean isFormatted()
Return true if the terminal display is formatted. A screen is defined as formatted if it possessing fields.
Returns:
The formatted state

isCharUnderlined

public boolean isCharUnderlined(int offset)
Return true if the character is underlined. The value is taken from the extended attribute of the character position of its associated field.
Parameters:
offset - The offset position
Returns:
The underlined state of the character
See Also:
isCharUnderlined(int, int)

isCharUnderlined

public boolean isCharUnderlined(int row,
                                int column)
Return true if the character is underlined. The value is taken from the extended attribute of the character position of its associated field.
Parameters:
row - The row of the character
column - The column of the character
Returns:
The underlined state of the character
See Also:
isCharUnderlined(int)

isCharReversed

public boolean isCharReversed(int offset)
Return true if the character is reversed. The value is taken from the extended attribute of the character position of its associated field.
Parameters:
offset - The offset position
Returns:
True if the character at the specified offset is reversed.
See Also:
isCharReversed(int, int)

isCharReversed

public boolean isCharReversed(int row,
                              int column)
Return true if the character is reversed. The value is taken from the extended attribute of the character position of its associated field.
Parameters:
row - The row of the character
column - The column of the character
Returns:
True if the character at the specified row,column is reversed.
See Also:
isCharReversed(int)

isCharFlashing

public boolean isCharFlashing(int offset)
Return true if the character is flashing. The value is taken from the extended attribute of the character position of its associated field.
Parameters:
offset - The offset position
Returns:
The flashing state of the character
See Also:
isCharFlashing(int, int)

isCharFlashing

public boolean isCharFlashing(int row,
                              int column)
Return true if the character is flashing. The value is taken from the extended attribute of the character position of its associated field.
Parameters:
row - The row of the character
column - The column of the character
Returns:
The flashing state of the character
See Also:
isCharFlashing(int)

setInserting

public void setInserting(boolean insertMode)
Set the insert mode.
Parameters:
insertMode - The insert mode
See Also:
isInserting()

isInserting

public boolean isInserting()
Return true if insert mode is operational.
Returns:
The insert mode
See Also:
setInserting(boolean)

cursorLeft

public void cursorLeft()
Moves the cursor one character position to the left. This will wrap around the boundaries of the terminal screen.
See Also:
cursorRight(), cursorDown(), cursorUp()

cursorRight

public void cursorRight()
Moves the cursor one character position to the right. This will wrap around the boundaries of the terminal screen.
See Also:
cursorLeft(), cursorDown(), cursorUp()

cursorUp

public void cursorUp()
Moves the cursor up one character position. This will wrap around the boundaries of the terminal screen.

DBCS Considerations: If an attempt is made to move the cursor up onto the second display position of a DBCS character, then this fact is logged and the cursor is moved onto the first character of the DBCS character. If the cursor is subsequently moved off the DBCS character, this cursor-adjustment is undone where appropriate, e.g. if the cursor is moved back down.

See Also:
cursorLeft(), cursorRight(), cursorDown()

cursorDown

public void cursorDown()
Moves the cursor down one character position. This will wrap around the boundaries of the terminal screen.

DBCS Considerations: If an attempt is made to move the cursor down onto the second display position of a DBCS character, then this fact is logged and the cursor is moved onto the first character of the DBCS character. If the cursor is subsequently moved off the DBCS character, this cursor-adjustment is undone where appropriate, e.g. if the cursor is moved back up.

See Also:
cursorLeft(), cursorRight(), cursorUp()

tab

public void tab()
Simulates the pressing of the tab key on the keyboard. In the simple case, this will move the cursor to the first character position of the next unprotected field after the cursor position.
See Also:
backtab()

backtab

public void backtab()
Simulates the pressing of the backtab key on the keyboard. In the simple case, this will move the cursor to the first character position of the previous unprotected field before the cursor position.
See Also:
tab()

newline

public void newline()
Simulates the pressing of the newline key on the keyboard.

home

public void home()
Simulates the pressing of the home key on the keyboard.

typeChar

public void typeChar(char c)
Types a character on the emulator at the current cursor position. It is not valid to call this method when the Terminal Mode is NVT.

When not in insert mode, this succeeds if the cursor is in an unprotected field.

When in insert mode it succeeds if it is an an unprotected field and there is space for the extra character.

If it succeeds, the cursor position is normally moved right by one character. However, if the field is ASKIP and the cursor position is the last available position in the field, then the cursor ends up at the first character position of the next unprotected field.

DBCS Considerations:

Parameters:
c - The character to be typed on the emulator

typeCharNVT

public void typeCharNVT(char c)
Types a character on the emulator at the current cursor position. It is only valid to call this method when the Terminal Mode is NVT.

The operation of this method is as if the character were typed from a keyboard. There are however, some characters that have a special meaning:

0x00
A 'null' character is ignored.
0x0d ('\r')
A CR is treated as a transmit operation.
0x0a ('\n')
A NL is ignored.
Parameters:
c - The character to be typed on the emulator
Since:
1.3

typeString

public void typeString(String s)
Types a string on the emulator at the current cursor position. This method simply calls typeChar() for each character in the String.

Calls to this method are not valid when the Terminal Mode is NVT.

DBCS Considerations:

Parameters:
s - The String to be typed on the emulator

eraseEndOfField

public void eraseEndOfField()
Simulates the pressing of the EOF key on the keyboard. It sets the characters in the current unprotected field from the cursor position to the end of the field to null values. The cursor position is not affected by this action.

eraseInput

public void eraseInput()
Simulates the pressing of the Erase Input key on the keyboard. It sets the characters in all unprotected field to null values. The cursor is positioned at the first unprotected character position on the screen.

delete

public void delete()
Simulates the pressing of the delete key on the keyboard.

backspace

public void backspace()
Simulates the pressing of the backspace key on the keyboard.

getDisplayBuffer

public char[] getDisplayBuffer()
Gets a copy of the display buffer. Since the buffer exposed is a copy, modification of it has no effect on the workings of the terminal.
Returns:
The display buffer, which is the characters on the screen

getReadableString

public String getReadableString(int offset,
                                int length)
Get a portion of the screen as a human readable string. Any display buffer positions that appear to a human to be spaces, such as attribute bytes or nulls, are coerced to spaces.

DBCS Considerations:

Parameters:
offset - The start offset of the desired display area
length - The length of the desired display area
Returns:
A 'human readable' version of the positions on the screen.
See Also:
typeString(java.lang.String)

getExtendedAttributeBuffer

public char[] getExtendedAttributeBuffer()
Gets a copy of the extended attribute buffer. Since the buffer exposed is a copy, modification of it has no effect on the workings of the terminal.
Returns:
The extended attribute buffer, which is the extended attributes of the screen

getColorBuffer

public char[] getColorBuffer()
Gets a copy of the color buffer. Since the buffer exposed is a copy, modification of it has no effect on the workings of the terminal.
Returns:
The color buffer, which is the extended colors of the screen positions.

getCharSetBuffer

public short[] getCharSetBuffer()
Gets a copy of the charset buffer. Since the buffer exposed is a copy, modification of it has no effect on the workings of the terminal.
Returns:
The charset buffer, which contains the charset of each screen position

pressEnter

public void pressEnter()
Simulates the pressing of the enter key on the keyboard.

This method is not valid when the terminal is in NVT mode. typeCharNVT() should be used in that case.

Throws:
IllegalStateException - if the terminal is not connected, the keyboard is locked, or the terminal is in NVT mode.

pressPF

public void pressPF(int key)
Simulates the pressing of the specified PF key on the keyboard.
Parameters:
key - PF key to press
Throws:
IllegalArgumentException - if key is not in the range 1 to 24
IllegalStateException - if the terminal is not connected, the keyboard is locked, or the terminal is in NVT mode.

pressPA

public void pressPA(int key)
Simulates the pressing of the specified PA key on the keyboard.
Parameters:
key - PA key to press
Throws:
IllegalArgumentException - if key is not in the range 1 to 3
IllegalStateException - if the terminal is not connected, the keyboard is locked, or the terminal is in NVT mode.

pressClear

public void pressClear()
Simulates the pressing of the clear key on the keyboard.
Throws:
IllegalStateException - if the terminal is not connected, the keyboard is locked, or the terminal is in NVT mode.

pressCursorSelect

public void pressCursorSelect()
Simulates the pressing of the Cursor Select key on the keyboard.

The Cursor Select operation can only succeed if the field in which the cursor is situated is Cursor Select Capable, and the first character in that field is one of:

This method can be used in conjunction with the moveCursorToOffset() method to simulate a light-pen.

Throws:
IllegalStateException - if the terminal is not connected, the keyboard is locked, the field is not not valid for CursorSelect.

setFont

public void setFont(Font NewFont)
Sets the terminal font to the specified font.
Parameters:
newFont - The font
Overrides:
setFont in class Component
See Also:
getFont()

getFont

public Font getFont()
Gets the font of the terminal.
Returns:
The font
Overrides:
getFont in class Component
See Also:
setFont(java.awt.Font)

setBackground

public void setBackground(Color c)
Sets the terminal Background Color to the specified color.
Parameters:
c - The Background Color
Overrides:
setBackground in class Component
See Also:
getBackground()

getBackground

public Color getBackground()
Get the Background Color of the terminal.
Returns:
The Background Color
Overrides:
getBackground in class Component
See Also:
setBackground(java.awt.Color)

setUnprotectedNormalColor

public void setUnprotectedNormalColor(Color c)
Sets the terminal Unprotected Normal Color to the specified color.
Parameters:
c - The Unprotected Normal Color
See Also:
getUnprotectedNormalColor()

getUnprotectedNormalColor

public Color getUnprotectedNormalColor()
Get the Unprotected Normal Color of the terminal.
Returns:
The Unprotected Normal Color
See Also:
setUnprotectedNormalColor(java.awt.Color)

setProtectedNormalColor

public void setProtectedNormalColor(Color c)
Sets the Protected Normal Color to the specified color.
Parameters:
c - The Protected Normal Color
See Also:
getProtectedNormalColor()

getProtectedNormalColor

public Color getProtectedNormalColor()
Get the Protected Normal Color of the terminal.
Returns:
The Protected Normal Color
See Also:
setProtectedNormalColor(java.awt.Color)

setUnprotectedIntenseColor

public void setUnprotectedIntenseColor(Color c)
Set the Unprotected Intense Color to the specified color.
Parameters:
c - The Unprotected Intense Color
See Also:
getUnprotectedIntenseColor()

getUnprotectedIntenseColor

public Color getUnprotectedIntenseColor()
Get the Unprotected Intense Color of the terminal.
Returns:
The Unprotected Intense Color
See Also:
setUnprotectedIntenseColor(java.awt.Color)

setProtectedIntenseColor

public void setProtectedIntenseColor(Color c)
Set the Protected Intense Color to the specified color.
Parameters:
c - The Protected Intense Color
See Also:
getProtectedIntenseColor()

getProtectedIntenseColor

public Color getProtectedIntenseColor()
Get the Protected Intense Color.
Returns:
The Protected Intense Color
See Also:
setProtectedIntenseColor(java.awt.Color)

setStatusBarBackground

public void setStatusBarBackground(Color c)
Set the Status Bar Background to the specified color.
Parameters:
c - The Status Bar Background Color
See Also:
getStatusBarBackground()

getStatusBarBackground

public Color getStatusBarBackground()
Get the Status Bar Background.
Returns:
The Status Bar Background Color
See Also:
setStatusBarBackground(java.awt.Color)

setStatusBarForeground

public void setStatusBarForeground(Color c)
Set the Status Bar Foreground to the specified color.
Parameters:
c - The Status Bar Foreground color
See Also:
getStatusBarForeground()

getStatusBarForeground

public Color getStatusBarForeground()
Get the Status Bar Foreground.
Returns:
The Status Bar Foreground color
See Also:
setStatusBarForeground(java.awt.Color)

setExtendedColors

public void setExtendedColors(Color[] c)
Set a the colors in the color map for the colors as defined by the extended attributes on the screen.
Parameters:
c - The extended color map.
See Also:
getExtendedColors()

setExtendedColors

public void setExtendedColors(int index,
                              Color c)
Set a single color in the color map for the colors as defined by the extended attributes on the screen.
Parameters:
index - The index
c - The Color
See Also:
getExtendedColors(int)

getExtendedColors

public Color[] getExtendedColors()
Get the Extended Color Map.
Returns:
The array of colors
See Also:
setExtendedColors(java.awt.Color[])

getExtendedColors

public Color getExtendedColors(int index)
Get a single extended Color Map entry.
Parameters:
index - The index into the extended color map.
Returns:
The color
See Also:
setExtendedColors(int,java.awt.Color)

setPrintStyle

public void setPrintStyle(int style)
Set the style of printing to be used. The PRINTSTYLE_XXXX values describe a set of ways that printing can be handled.
Parameters:
style - The PrintStyle - an int that should corrolate to one of the PRINTSTYLE constant values defined in this class.
See Also:
getPrintStyle()

getPrintStyle

public int getPrintStyle()
Get the style of printing.
Returns:
an int representing the PrintStyle - this corrolates to one of the PRINTSTYLE constant values defined in this class.
See Also:
setPrintStyle(int)

setStatusBarShowing

public void setStatusBarShowing(boolean displayValue)
Set whether the visible emulator should have a Status Bar on it.
Parameters:
displayValue - The status bar showing value
See Also:
isStatusBarShowing()

isStatusBarShowing

public boolean isStatusBarShowing()
Determine whether the visible emulator should have a Status Bar on it.
Returns:
true if the Status Bar is showing
See Also:
setStatusBarShowing(boolean)

setOvertypeCursorStyle

public void setOvertypeCursorStyle(int style)
Set the Overtype Cursor Style.
Parameters:
style - The Overtype Cursor Style - an int that should corrolate to one of the Cursor constant values defined in this class.
See Also:
getOvertypeCursorStyle()

getOvertypeCursorStyle

public int getOvertypeCursorStyle()
Get the Overtype Cursor Style.
Returns:
an int representing the Overtype Cursor Style - this corrolates to one of the Cursor constant values defined in this class.
See Also:
setOvertypeCursorStyle(int)

setOvertypeCursorColor

public void setOvertypeCursorColor(Color c)
Set the overtype cursor color.
Parameters:
c - The Overtype Cursor Color
See Also:
getOvertypeCursorColor()

getOvertypeCursorColor

public Color getOvertypeCursorColor()
Get the Overtype Cursor Color.
Returns:
The Overtype Cursor Color
See Also:
setOvertypeCursorColor(java.awt.Color)

setOvertypeCursorFlashing

public void setOvertypeCursorFlashing(boolean b)
Set whether the Overtype Cursor should flash or not.
Parameters:
b - True to make the cursor flash.
See Also:
isOvertypeCursorFlashing()

isOvertypeCursorFlashing

public boolean isOvertypeCursorFlashing()
Determine whether the Overtype Cursor should flash or not.
Returns:
True if the cursor is flashing
See Also:
setOvertypeCursorFlashing(boolean)

setInsertCursorStyle

public void setInsertCursorStyle(int style)
Set the Insert Cursor Style.
Parameters:
style - The Insert Cursor Style - this should be one of the CURSOR_XXXX constant values defined in this class.
See Also:
getInsertCursorStyle()

getInsertCursorStyle

public int getInsertCursorStyle()
Get the Insert Cursor Style.
Returns:
an int representing the Overtype Cursor Style - this should be one of the CURSOR_XXXX constant values defined in this class.
See Also:
setInsertCursorStyle(int)

setInsertCursorColor

public void setInsertCursorColor(Color c)
Set the Insert Cursor Color.
Parameters:
c - The Insert Cursor Color
See Also:
getInsertCursorColor()

getInsertCursorColor

public Color getInsertCursorColor()
Get the Insert Cursor Color.
Returns:
The insert cursor color
See Also:
setInsertCursorColor(java.awt.Color)

setInsertCursorFlashing

public void setInsertCursorFlashing(boolean b)
Set whether the Insert Cursor should flash or not.
Parameters:
b - True to make the cursor flash.
See Also:
isInsertCursorFlashing()

isInsertCursorFlashing

public boolean isInsertCursorFlashing()
Determine whether the Insert Cursor should flash or not.
Returns:
True if the cursor is flashing
See Also:
setInsertCursorFlashing(boolean)

findField

public KixField findField(int offset)
Get the field that contains the given offset.

This method returns null if the screen is unformatted.

Parameters:
offset - the offset value
Returns:
KixField
See Also:
getFields()

offsetFromRowColumn

public int offsetFromRowColumn(int row,
                               int column)
Return the offset value given a row, column pair.

The row and column are specified such that a value of 1,1 is the top left corner of the screen.

Parameters:
row - The given row value
column - The given column value
Returns:
the offset
See Also:
rowFromOffset(int), columnFromOffset(int)

rowFromOffset

public int rowFromOffset(int offset)
Gets the row from a given offset.

The row is specified such that a value of 1 is the top row on the screen.

Parameters:
offset - The given offset
Returns:
the row
See Also:
offsetFromRowColumn(int,int), columnFromOffset(int)

columnFromOffset

public int columnFromOffset(int offset)
Gets the column from a given offset.

The column is specified such that a value of 1 is the left most column on the screen.

Parameters:
offset - The given offset
Returns:
the column
See Also:
offsetFromRowColumn(int,int), rowFromOffset(int)

offsetFromPoint

public int offsetFromPoint(int x,
                           int y)
Return the offset value given the x,y screen pixel position. If there is no visible screen an IllegalStateException is thrown.
Parameters:
x - The x screen pixel position
y - The y screen pixel position
Returns:
the offset
Throws:
IllegalStateException - if the emulator screen is not visible
See Also:
offsetFromPoint(java.awt.Point)

offsetFromPoint

public int offsetFromPoint(Point p)
Return the offset value given a Point p screen pixel position. If there is no visible screen an IllegalStateException is thrown.
Parameters:
p - The screen pixel position
Returns:
the offset
Throws:
IllegalStateException - if the emulator screen is not visible
See Also:
offsetFromPoint(int, int)

addHighlightArea

public void addHighlightArea(int offset,
                             int length,
                             Color color)
Add an area of the 3270 display to be highlighted in the given Color.
Parameters:
offset - The start offset of the area
length - The length of the area
color - The color of the area
See Also:
removeAllHighlightAreas()

addHighlightAreas

public void addHighlightAreas(int[] offset,
                              int[] length,
                              Color[] color)
Add multiple areas of the 3270 display to be highlighted in the given Colors. This is the same as calling addHighlightArea multiple times, but has a performance advantage.
Parameters:
offset - An array of start offsets of each area
length - An array of lengths of each area
color - An array of colors of each area
See Also:
removeAllHighlightAreas()

removeAllHighlightAreas

public void removeAllHighlightAreas()
Remove all the highlighted areas from the screen.
See Also:
addHighlightArea(int, int, java.awt.Color)

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Overrides:
setBounds in class Component

getMinimumSize

public Dimension getMinimumSize()
Overrides:
getMinimumSize in class Component

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class Component

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Add a PropertyChangeListener to the listener list.
Parameters:
l - The PropertyChangeListener to be added
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Remove a PropertyChangeListener from the listener list.
Parameters:
l - The PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener)

firePropertyChange

public void firePropertyChange(String propertyName,
                               Object oldValue,
                               Object newValue)

addKixEmulatorListener

public void addKixEmulatorListener(KixEmulatorListener l)
Add a KixEmulatorListener.
Parameters:
l - The KixEmulatorListener to be added
See Also:
removeKixEmulatorListener(unikix.clientapis.emulator.KixEmulatorListener)

removeKixEmulatorListener

public void removeKixEmulatorListener(KixEmulatorListener l)
Remove a KixEmulatorListener.
Parameters:
l - The KixEmulatorListener to be removed
See Also:
addKixEmulatorListener(unikix.clientapis.emulator.KixEmulatorListener)

setKeyHandling

public void setKeyHandling(boolean b)
Set whether the emulator is to use the default keyboard handling or not.
Parameters:
b - True to use the default key handling
See Also:
getKeyHandling()

getKeyHandling

public boolean getKeyHandling()
Determine if the emulator is to use the default keyboard handling.
Returns:
true if default key handling is to be used.
See Also:
setKeyHandling(boolean)

setEnabled

public void setEnabled(boolean b)
Overrides:
setEnabled in class Component

setForceEWA

public void setForceEWA(boolean b)
Treat all datastreams that come in as being for the alternate screen size.

CAUTION:
This method is intended to allow connection to the small number of TN3270 hosts (such as CICS/6000) that always send their data in ALTERNATE mode, without sending the normal EWA bytes.

Do not use this call unless you have such a host and you fully understand the implications of doing so.

Parameters:
b - Force or Not
See Also:
getForceEWA()

getForceEWA

public boolean getForceEWA()
Gets the boolean value of whether ForceEWA is set or not.
Returns:
The ForceEWA status
See Also:
setForceEWA(boolean)

setForceInitialEW

public void setForceInitialEW(boolean b)
This method causes a datastream to be generated internally that clears the screen and frees the keyboard. This datastream is generated the first time the terminal has successfully entered 3270 mode, and is treated as if the datastream arrived from the 3270 host.

CAUTION:
This method is intended to allow connection to the small number of TN3270 hosts that do not initially send any data to the terminal, but expect the first data flow to be from terminal to server.

Do not use this call unless you have such a host and you fully understand the implications of doing so.

This method should be called before calling the connect() method.

Parameters:
b - Force or Not

pressDUP

public void pressDUP()
Simulates the pressing of the DUP key on the keyboard.
Throws:
IllegalStateException - is thrown if this operation is performed when any one of the following conditions is true:
  • The cursor is at a field attribute location.
  • The cursor is within a protected field.
  • The keyboard is locked.
  • The cursor is in a field which is full and we are in insert mode.

pressFieldMark

public void pressFieldMark()
Simulates the pressing of the Field Mark key on the keyboard.
Throws:
IllegalStateException - is thrown if this operation is performed when any one of the following conditions is true:
  • The cursor is at a field attribute location.
  • The cursor is within a protected field.
  • The keyboard is locked.
  • The cursor is in a field which is full and we are in insert mode.

pressReset

public void pressReset()
Simulates the pressing of the Reset key on the keyboard.

moveCursorToOffset

public void moveCursorToOffset(int offset)
Moves the cursor to the specified offset on the screen.
Parameters:
offset - The cursor offset

DBCS Considerations: If an attempt is made to move the cursor onto the second display position of a DBCS character, then this fact is logged and the cursor is moved onto the first character of the DBCS character. If the cursor is subsequently moved off the DBCS character, this cursor-adjustment is undone where appropriate, e.g. if the cursor is moved up or down.

Throws:
IllegalArgumentException - If the supplied offset is greater than the maximum size of the screen, or if the offset is negative.

moveCursorToRowColumn

public void moveCursorToRowColumn(int row,
                                  int column)
Moves the cursor to the specified row,column on the screen.

DBCS Considerations: If an attempt is made to move the cursor onto the second display position of a DBCS character, then this fact is logged and the cursor is moved onto the first character of the DBCS character. If the cursor is subsequently moved off the DBCS character, this cursor-adjustment is undone where appropriate, e.g. if the cursor is moved up or down.

Parameters:
row - The cursor row
column - The cursor column
Throws:
IllegalArgumentException - If the supplied row or column is beyond the boundaries of the screen.

waitUntilConnected

public void waitUntilConnected()
Wait until the emulator is connected. A call to this method should only be made after a connect() is issued.
Throws:
IllegalStateException - This exception is thrown if the emulator is in DISCONNECTED state when this call is made, or if the emulator enters DISCONNECTED state during the wait.
See Also:
connect()

waitUntilDisconnected

public void waitUntilDisconnected()
Wait until the emulator is disconnected.

waitUntilKeyboardUnlocked

public void waitUntilKeyboardUnlocked()
Wait until the emulator keyboard is unlocked.
Throws:
IllegalStateException - This exception is thrown if this method is called when the emulator is not in connected state, or if the emulator leaves connected state during the wait.

waitHeuristic

public void waitHeuristic(int timeInMillis)
Wait for a response from the host in a heuristic manner. A call to this method blocks (waits) until the following conditions are true:
  1. The keyboard is unlocked, AND
  2. There has been no host activity (i.e. sends from host to terminal) for the timeout period.
This is useful when dealing with poorly behaved 3270 applications which send a single 'screen' of information which is built up from multiple sends to the terminal, but where the keyboard is unlocked BEFORE the last datastream is sent.
Parameters:
timeInMillis - The time to wait for host activity before concluding that no further sends from the host are going to occur.
Throws:
IllegalStateException - This exception is thrown if this method is called when the emulator is not in connected state, or if the emulator leaves connected state during the wait.
IllegalArgumentException - This exception is thrown if the time specified is negative.

dispose

public void dispose()
Disposes of the emulator and releases any resources that it is using. Do not call any other methods in the emulator after it has been disposed.

getRowHeight

public int getRowHeight()
Returns the height of a single row of the emulator in pixels.

This returns 0 if the emulator has not been shown.

Returns:
the row height
See Also:
getColumnWidth()

getColumnWidth

public int getColumnWidth()
Returns the width of a single column of the emulator in pixels.

This returns 0 if the emulator has not been shown.

Returns:
the column width
See Also:
getRowHeight()

getBoundary

public Insets getBoundary()
Returns an Insets object representing the 'freespace' around the emulator.

A negative values for parts of the Insets object represent the emulator requiring more space to display itself properly than has been provided by the setting of the sice of this component.

Returns:
an Insets object

isKeyboardInitiallyUnlocked

public boolean isKeyboardInitiallyUnlocked()
This determines whether to unlock the keyboard on receiving the first datastream from the host. True signifies that it will be unlocked upon receipt of the first datastream. False will leave it locked until a specific 'setKeyboardUnlocked' is received from the host.

The default value is false.

Returns:
The initial keyboard locked state
See Also:
setKeyboardInitiallyUnlocked(boolean)

setKeyboardInitiallyUnlocked

public void setKeyboardInitiallyUnlocked(boolean b)
This determines whether to unlock the keyboard on receiving the first datastream from the host. True signifies that it will be unlocked upon receipt of the first datastream. False will leave it locked until a specific 'setKeyboardUnlocked' is received from the host.

The default value is false.

Parameters:
b - The new initial keyboard locked state
See Also:
isKeyboardInitiallyUnlocked()

setHostCodepage

public void setHostCodepage(String s)
Sets the EBCDIC codepage to use for conversion of characters to and from the 3270 host system. In 3270 terms this is the codepage used to interpret characters defined as char set 0x00.
Parameters:
s - The new codepage. This should be specified as one of the CODEPAGE_XXXX constants.

getHostCodepage

public String getHostCodepage()
Gets the EBCDIC codepage used for conversion of characters to and from the 3270 host system. In 3270 terms this is the codepage used to interpret characters defined as char set 0x00.
Returns:
The codepage. This is one of the CODEPAGE_XXXX constants.

getTerminalMode

public int getTerminalMode()
Gets the current terminal mode. This can be one of the following values
Returns:
The mode.
Since:
1.3

pressSysreq

public void pressSysreq()
Simulate the pressing of the SYSREQ key. The use of this method is only valid in some circumstances. The isSysreqAllowed() method is used to determine if this method is allowed to be invoked.
Since:
1.3
See Also:
isSysreqAllowed()

pressATTN

public void pressATTN()
Simulate the pressing of the ATTN key.
Since:
1.3

isSysreqAllowed

public boolean isSysreqAllowed()
This method is used to determine if the use of pressSysreq() is allowed.
Returns:
Is SYSREQ allowed
Since:
1.3
See Also:
pressSysreq()

getNetname

public String getNetname()
Get the Netname used for the current 3270 session. The Netname is a value supplied by the TN3270 host system when connection is established using the TN3270E protocol. When TN3270E has not been negotiated, then there is no netname available, and this method returns an empty String.
Returns:
The Netname
Since:
1.3
See Also:
setPreferredNetname(java.lang.String)

setPreferredNetname

public void setPreferredNetname(String name)
When connecting to a TN3270E server, it is possible to specify a netname that a terminal wishes to connect as. This method allows you to specify this Netname.

Note that if the server does not request the use of the TN3270E protocol, or if a call to setTN3270EAllowed(false) has been made, then this preferred Netname has no effect.

The actual Netname used is obtained using the getNetname() method.

Parameters:
name - The preferred Netname
Since:
1.3
See Also:
getPreferredNetname()

getPreferredNetname

public String getPreferredNetname()
When connecting to a TN3270E server, it is possible to specify a netname that a terminal wishes to connect as. This method allows you to determine this Netname.

Note that if the server does not request the use of the TN3270E protocol, or if a call to setTN3270EAllowed(false) has been made, then this preferred Netname has no effect.

The actual Netname used is obtained using the getNetname() method.

Returns:
The preferred Netname
Since:
1.3
See Also:
setPreferredNetname(java.lang.String)

setTN3270EAllowed

public void setTN3270EAllowed(boolean b)
Allow the KixEmulator to use the TN3270E protocol (as defined in RFC 1647 and RFC 2355).

The default is true.

Parameters:
b - Allow TN3270E
Throws:
IllegalStateException - This exception is thrown if the emulator is in a DISCONNECTED state when this call is made.
Since:
1.3
See Also:
getPreferredNetname()

isTN3270EAllowed

public boolean isTN3270EAllowed()
Allow the KixEmulator to use the TN3270E protocol (as defined in RFC 1647 and RFC 2355).

The default is true.

Returns:
Allow TN3270E?
Since:
1.3
See Also:
getPreferredNetname()

setDebugDestination

public void setDebugDestination(PrintWriter pw)
Output debug information to the supplied PrintWriter

The information contains information such as a snapshot of the screen after significant events. Debugging can be turned off by supplied a parameter of 'null'.

Parameters:
pw - The PrintWriter to use

getNumericInputValidation

public boolean getNumericInputValidation()
Determine whether validation is performed of characters typed in numeric fields

When this value is true, only a restricted set of characters may be input to a numeric field. When this value is false, any character may be entered into an unprotected numeric field.

Returns:
Whether numeric input validation is performed

setNumericInputValidation

public void setNumericInputValidation(boolean b)
Control whether validation is performed of characters typed in numeric fields

When this value is set to true, only a restricted set of characters may be input to a numeric field. When this value is set to false, any character may be entered into an unprotected numeric field.

Note that setting this value will also set it for any KixEmulators that share the same connection, i.e. those created using the constructor 'public KixEmulator(KixEmulator source)'

Parameters:
b - The new value.

setCapturingData

public void setCapturingData(boolean b)
Define if the emulator is to capture histories of data for use in dumping at a future time.

This method should be used under the direction of the support organization.

Parameters:
true - if data is to be captured.
See Also:
dump(java.io.PrintWriter)

isCapturingData

public boolean isCapturingData()
Determine if the emulator is to capture histories of data for use in dumping at a future time.

This method should be used under the direction of the support organization.

Returns:
true if data is being captured.
See Also:
dump(java.io.PrintWriter)

dump

public void dump(PrintWriter pw)
Perform a diagnostic dump of the state of the Emulator.

The information produced by this dump is primarily intended for use by the 3270 Pathway Support Organization.

This method should be used under the direction of the support organization.

The format and details of the output produced by this command is liable to change and should not be relied upon.

Parameters:
pw - The destination for the dump.

dump

public void dump(OutputStream os)
Perform a diagnostic dump of the state of the Emulator.

The information produced by this dump is primarily intended for use by the 3270 Pathway Support Organization. This method should be used under the direction of the support organization.

The format and details of the output produced by this command is liable to change and should not be relied upon.

Parameters:
os - The destination for the dump.


Copyright (c) 2001 by Sun Microsystems, Inc. All Rights Reserved