com.sun.emp.pathway.bean
Class Terminal

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bycom.sun.emp.pathway.bean.Terminal
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class Terminal
extends JComponent
implements Accessible

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

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

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

The visibility of the Terminal is rarely ever directly specified, but a Terminal becomes 'visible' when it is added to a Component hierarchy within a graphical Java application or applet.

Programming Notes

Method Usage

The Terminal 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:
...
Terminal aTerminal = new Terminal();
aTerminal.setTN3270Host(myHost);
aTerminal.setTN3270Port(myPort);
aTerminal.connect();
aTerminal.waitUntilConnected();
...

Terminal Interaction

There are several methods that allow the programmer to 'interact' with the Terminal. 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:
...
aTerminal.tab();
aTerminal.typeString("Something");
aTerminal.tab();
aTerminal.typeString("SomethingElse");
aTerminal.pressEnter();
aTerminal.waitUntilKeyboardUnlocked();
aTerminal.pressPF(3);
aTerminal.waitUntilKeyboardUnlocked();
...

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

Terminal Interrogation

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

Visible Terminal Configuration

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

Modes of operation

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

When the Terminal 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 Terminal. 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 Terminal 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 Terminal 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().


Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
static String CODEPAGE_IBM037
          US English, Portuguese, Canadian French
static String CODEPAGE_IBM1025
          Bulgarian, Macedonian, Serbian Cyrillic, Russian
static String CODEPAGE_IBM1026
          Turkish
static String CODEPAGE_IBM1047
          Open Edition
static String CODEPAGE_IBM1140
          US English - Euro
static String CODEPAGE_IBM1141
          German - Euro
static String CODEPAGE_IBM1142
          Danish, Norwegian - Euro
static String CODEPAGE_IBM1143
          Finnish, Swedish - Euro
static String CODEPAGE_IBM1144
          Italian - Euro
static String CODEPAGE_IBM1145
          Spanish - Euro
static String CODEPAGE_IBM1146
          UK English - Euro
static String CODEPAGE_IBM1147
          French - Euro
static String CODEPAGE_IBM1148
          Multilingual - Euro
static String CODEPAGE_IBM1149
          Icelandic - Euro
static String CODEPAGE_IBM273
          German
static String CODEPAGE_IBM277
          Danish, Norwegian
static String CODEPAGE_IBM278
          Finnish, Swedish
static String CODEPAGE_IBM280
          Italian
static String CODEPAGE_IBM284
          Spanish
static String CODEPAGE_IBM285
          UK English
static String CODEPAGE_IBM297
          French
static String CODEPAGE_IBM500
          Belgian, Swiss German
static String CODEPAGE_IBM870
          Hungarian, Polish, Romanian, etc.
static String CODEPAGE_IBM875
          Greek
static String CODEPAGE_IBM930
          Japanese DBCS
static String CODEPAGE_IBM933
          Korean DBCS
static String CODEPAGE_IBM935
          Simplified Chinese DBCS
static String CODEPAGE_IBM937
          Traditional Chinese DBCS
static String CODEPAGE_IBM939
          Japanese DBCS
static byte COLOR_BLACK
           
static byte COLOR_BLUE
           
static byte COLOR_DEEP_BLUE
           
static byte COLOR_DEFAULT
           
static byte COLOR_GREEN
           
static byte COLOR_GREY
           
static byte COLOR_NEUTRAL_0
           
static byte COLOR_NEUTRAL_1
           
static byte COLOR_ORANGE
           
static byte COLOR_PALE_GREEN
           
static byte COLOR_PALE_TURQUOISE
           
static byte COLOR_PINK
           
static byte COLOR_PURPLE
           
static byte COLOR_RED
           
static byte COLOR_TURQUOISE
           
static byte COLOR_WHITE
           
static byte COLOR_YELLOW
           
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_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_COLOR_ON_WHITE
           
static int PRINTSTYLE_NORMAL
           
static int PRINTSTYLE_WHITE_ON_BLACK
           
static int SOSI_DISPLAY_STYLE_ARROWS
           
static int SOSI_DISPLAY_STYLE_BLANKS
           
static int SOSI_DISPLAY_STYLE_LTGT
           
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 javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Terminal()
          Constructs a Terminal.
Terminal(Terminal source)
          Constructs a Terminal from an already existant Terminal.
 
Method Summary
 void addHighlightArea(int offset, int length, Color color)
          Adds an area of the 3270 display to be highlighted in the given color.
 void addHighlightAreas(int[] offset, int[] length, Color[] color)
          Adds multiple areas of the 3270 display to be highlighted in the given colors.
 void addNotify()
           
 void addTerminalListener(TerminalListener l)
          Adds a listener for Terminal events.
 void backspace()
          Simulates the pressing of the Backspace key on a 3270 keyboard.
 void backtab()
          Simulates the pressing of the Backtab key on a 3270 keyboard.
 int columnFromOffset(int offset)
          Gets the column number from a given offset.
 void connect()
          Attempts to establish a connection to the specified host system.
 void cursorDown()
          Moves the cursor one character position down.
 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 one character position up.
 void delete()
          Simulates the pressing of the Delete key on a 3270 keyboard.
 void disconnect()
          Disconnects from the currently connected system.
 void disconnect(String msg)
          Disconnects from the currently connected system.
 void dispose()
          Disposes of the Terminal and releases any resources that it is using.
 void dump(OutputStream os)
          Performs a diagnostic dump of the state of the Terminal.
 void dump(PrintWriter pw)
          Performs a diagnostic dump of the state of the Terminal.
 void eraseEndOfField()
          Simulates the pressing of the EOF key on a 3270 keyboard.
 void eraseInput()
          Simulates the pressing of the Erase Input key on a 3270 keyboard.
 TerminalField findField(int offset)
          Gets the field that contains the given offset.
 AccessibleContext getAccessibleContext()
           
 Color getBackground()
          Gets the background color of the Terminal.
 Insets getBoundary()
          Gets an Insets object representing the 'freespace' around the Terminal.
 byte[] getCharSetBuffer()
          Gets a copy of the charset buffer.
 byte[] getColorBuffer()
          Gets a copy of the color buffer.
 int getColumns()
          Gets the number of columns of the Terminal.
 int getColumnWidth()
          Gets the width of a single column of the Terminal in pixels.
 int getConnectionState()
          Gets the connection state of the Terminal.
 String getCopyrightString()
          Obtains the Sun Microsystems copyright string.
 int getCursorColumn()
          Gets the column number of the Terminal containing the cursor.
 int getCursorOffset()
          Gets the offset of the cursor in the current 3270 buffer.
 int getCursorRow()
          Gets the row number of the Terminal containing the cursor.
 char[] getDisplayBuffer()
          Gets a copy of the display buffer.
 int getDisplaySize()
          Gets the display size of the Terminal in characters.
 byte[] getExtendedAttributeBuffer()
          Gets a copy of the extended attribute buffer.
 Color[] getExtendedColors()
          Gets the extended color map.
 Color getExtendedColors(int index)
          Gets 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()
          Determines whether all datastreams that come in are be treated as if they are for the alternate screen size.
 String getHostCodepage()
          Gets the EBCDIC codepage used for conversion of characters to and from the 3270 host system.
 String getIdentifierString()
          Gets a textual indicator of the version and build level of this Bean.
 Color getInsertCursorColor()
          Gets the color of the insert cursor.
 int getInsertCursorStyle()
          Gets the style of the insert cursor.
 int getLastDisconnectionReason()
          Gets the reason for the last disconnection of the Terminal as an int.
 String getLastDisconnectionString()
          Gets a textual representation of the reason for the last disconnection of the Terminal.
 EventListener[] getListeners(Class listenerType)
           
 int getMaximumColumns()
          Gets the maximum number of columns of the Terminal.
 int getMaximumDisplaySize()
          Gets the maximum display size of the Terminal in characters.
 int getMaximumRows()
          Gets the maximum number of rows of the Terminal.
 Dimension getMinimumSize()
           
 int getModel()
          Gets the model of the Terminal
 String getNetname()
          Gets the netname used for the current 3270 session.
 int getNetworkInactivityTimeout()
          Gets the network inactivity timeout for the remote connection.
 boolean getNumericInputValidation()
          Determines whether validation is performed of characters typed into numeric fields.
 Color getOvertypeCursorColor()
          Gets the color of the overtype cursor.
 int getOvertypeCursorStyle()
          Gets the style of the overtype cursor.
 String getPreferredNetname()
          When connecting to a TN3270E server, it is possible to specify a netname that a Terminal wishes to connect as.
 Dimension getPreferredSize()
           
 Printable getPrintable()
          Obtains a Printable that will render the Terminal to a page.
 int getPrintStyle()
          Gets the style of printing.
 Color getProtectedIntenseColor()
          Gets the color in which to render the text in protected intense fields.
 Color getProtectedNormalColor()
          Gets the color in which to render the text in protected normal fields.
 String getReadableString(int offset, int length)
          Gets a portion of the screen as a human readable string.
 int getRowHeight()
          Gets the height of a single row of the Terminal in pixels.
 int getRows()
          Gets the number of rows of the Terminal.
 int getSOSIDisplayStyle()
          Determine the current display style for SO and SI characters
 Color getStatusBarBackground()
          Gets the background color of the status bar.
 Color getStatusBarForeground()
          Gets the foreground color of the status bar.
 TerminalListener[] getTerminalListeners()
          Gets all of the registered TerminalListeners.
 int getTerminalMode()
          Gets the current Terminal mode.
 String getTN3270Host()
          Gets the TN3270 host.
 int getTN3270Port()
          Gets the TN3270 port.
 Color getUnprotectedIntenseColor()
          Gets the color in which to render the text in unprotected intense fields.
 Color getUnprotectedNormalColor()
          Gets the color in which to render the text in unprotected normal fields.
 void home()
          Simulates the pressing of the Home key on a 3270 keyboard.
 boolean isAutoFontResizingEnabled()
          Determines whether automatic font resizing is enabled.
 boolean isCapturingData()
          Determines if the Terminal is to capture histories of data for use in dumping at a future time.
 boolean isCharFlashing(int offset)
          Determines if the character at the given offset is flashing.
 boolean isCharFlashing(int row, int column)
          Determines if the character is flashing.
 boolean isCharReversed(int offset)
          Determines if the character at the given offset is reversed.
 boolean isCharReversed(int row, int column)
          Determines if the character is reversed.
 boolean isCharUnderlined(int offset)
          Determines if the character at the given offset is underlined.
 boolean isCharUnderlined(int row, int column)
          Determines if the character is underlined.
 boolean isConnected()
          Determines if the Terminal is in a connected state.
 boolean isConnecting()
          Determines if the Terminal is in a connecting state.
 boolean isDisconnected()
          Determines if the Terminal is in a disconnected state.
 boolean isDisconnecting()
          Determines if the Terminal is in a disconnecting state.
 boolean isFormatted()
          Determines if the Terminal display is formatted.
 boolean isInsertCursorFlashing()
          Determines whether the insert cursor should flash or not.
 boolean isInserting()
          Determines if insert mode is operational.
 boolean isKeyboardInitiallyUnlocked()
          Determines whether to unlock the keyboard on receiving the first datastream from the host.
 boolean isKeyboardLocked()
          Determines if the keyboard is locked.
 boolean isOvertypeCursorFlashing()
          Determines whether the overtype cursor should flash or not.
 boolean isStatusBarShowing()
          Determines whether the visible Terminal should have a status bar on it.
 boolean isSysreqAllowed()
          Determines if the use of the pressSysreq() method is allowed.
 boolean isTN3270EAllowed()
          Determines if the Terminal is 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 Terminal.
 void moveCursorToRowColumn(int row, int column)
          Moves the cursor to the specified row and column on the Terminal.
 void newline()
          Simulates the pressing of the Newline key on a 3270 keyboard.
 int offsetFromPoint(int x, int y)
          Returns the offset value given x and y pixel position.
 int offsetFromPoint(Point p)
          Returns the offset value given a Point.
 int offsetFromRowColumn(int row, int column)
          Returns the offset value given a row, column pair.
 void pressATTN()
          Simulates the pressing of the ATTN key.
 void pressClear()
          Simulates the pressing of the Clear key on a 3270 keyboard.
 void pressCursorSelect()
          Simulates the pressing of the Cursor Select key on a 3270 keyboard.
 void pressDUP()
          Simulates the pressing of the DUP key on a 3270 keyboard.
 void pressEnter()
          Simulates the pressing of the Enter key on a 3270 keyboard.
 void pressFieldMark()
          Simulates the pressing of the Field Mark key on a 3270 keyboard.
 void pressInsert()
          Simulates the pressing of the Insert key on a 3270 keyboard.
 void pressPA(int key)
          Simulates the pressing of the specified PA key on a 3270 keyboard.
 void pressPF(int key)
          Simulates the pressing of the specified PF key on a 3270 keyboard.
 void pressReset()
          Simulates the pressing of the Reset key on a 3270 keyboard.
 void pressSysreq()
          Simulates the pressing of the SYSREQ key.
 void removeAllHighlightAreas()
          Removes all the highlighted areas from the screen.
 void removeNotify()
           
 void removeTerminalListener(TerminalListener l)
          Removes a listener for Terminal events.
 int rowFromOffset(int offset)
          Gets the row number from a given offset.
 void setAutoFontResizingEnabled(boolean b)
          Sets whether the font should automatically resize if the Terminal is resized.
 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)
          Defines if the Terminal is to capture histories of data for use in dumping at a future time.
 void setDebugDestination(PrintWriter pw)
          Defines the destination for debug information.
 void setEnabled(boolean b)
           
 void setExtendedColors(Color[] c)
          Sets 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)
          Sets 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 font used to render the Terminal.
 void setForceEWA(boolean b)
          Sets whether all datastreams that come in should be treated as if they are 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)
          Sets the color of the insert cursor.
 void setInsertCursorFlashing(boolean b)
          Sets whether the insert cursor should flash or not.
 void setInsertCursorStyle(int style)
          Sets the style of the insert cursor.
 void setInserting(boolean insertMode)
          Sets the insert mode.
 void setKeyboardInitiallyUnlocked(boolean b)
          Determines whether to unlock the keyboard on receiving the first datastream from the host.
 void setLocale(Locale l)
           
 void setModel(int newModel)
          Sets the model to the specified value.
 void setNetworkInactivityTimeout(int seconds)
          Sets the network inactivity timeout for the remote connection.
 void setNumericInputValidation(boolean b)
          Controls whether validation is performed of characters typed into numeric fields.
 void setOvertypeCursorColor(Color c)
          Sets the color of the overtype cursor.
 void setOvertypeCursorFlashing(boolean b)
          Sets whether the overtype cursor should flash or not.
 void setOvertypeCursorStyle(int style)
          Sets the style of the overtype cursor.
 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)
          Sets the style of printing to be used.
 void setProtectedIntenseColor(Color c)
          Sets the color in which to render the text in protected intense fields.
 void setProtectedNormalColor(Color c)
          Sets the color in which to render the text in protected normal fields.
 void setSOSIDisplayStyle(int style)
          Define how the DBCS SO and SI characters are to be displayed.
 void setStatusBarBackground(Color c)
          Sets the background color of the status bar.
 void setStatusBarForeground(Color c)
          Sets the foreground color of the status bar.
 void setStatusBarShowing(boolean displayValue)
          Sets whether the visible Terminal should have a status bar on it.
 void setTN3270EAllowed(boolean b)
          Allows the Terminal to use the TN3270E protocol (as defined in RFC 1647 and RFC 2355).
 void setTN3270Host(String newHost)
          Sets the name of the TN3270 host with which to communicate.
 void setTN3270Port(int newPort)
          Sets the port number on which the TN3270 server is listening.
 void setUnprotectedIntenseColor(Color c)
          Sets the color in which to render the text in unprotected intense fields.
 void setUnprotectedNormalColor(Color c)
          Sets the color in which to render the text in unprotected normal fields.
 void tab()
          Simulates the pressing of the Tab key on a 3270 keyboard.
 void typeChar(char c)
          Types a character on the Terminal at the current cursor position.
 void typeCharNVT(char c)
          Types a character on the Terminal at the current cursor position.
 void typeString(String s)
          Types a set of characters on the Terminal at the current cursor position.
 void waitCondition(TerminalCondition terminalCondition)
          Waits until the condition specified in the TerminalCondition class is met.
 void waitForReadableString(String readableString, int offset)
          Waits for the specified string to be displayed on the Terminal at the specified offset.
 void waitHeuristic(int timeInMillis)
          Waits for a response from the host in a heuristic manner.
 void waitUntilConnected()
          Waits until the Terminal is connected.
 void waitUntilDisconnected()
          Waits until the Terminal is disconnected.
 void waitUntilKeyboardUnlocked()
          Waits until the Terminal keyboard is unlocked.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getLocation, getMaximumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COLOR_DEFAULT

public static final byte COLOR_DEFAULT
See Also:
Constant Field Values

COLOR_NEUTRAL_0

public static final byte COLOR_NEUTRAL_0
See Also:
Constant Field Values

COLOR_BLUE

public static final byte COLOR_BLUE
See Also:
Constant Field Values

COLOR_RED

public static final byte COLOR_RED
See Also:
Constant Field Values

COLOR_PINK

public static final byte COLOR_PINK
See Also:
Constant Field Values

COLOR_GREEN

public static final byte COLOR_GREEN
See Also:
Constant Field Values

COLOR_TURQUOISE

public static final byte COLOR_TURQUOISE
See Also:
Constant Field Values

COLOR_YELLOW

public static final byte COLOR_YELLOW
See Also:
Constant Field Values

COLOR_NEUTRAL_1

public static final byte COLOR_NEUTRAL_1
See Also:
Constant Field Values

COLOR_BLACK

public static final byte COLOR_BLACK
See Also:
Constant Field Values

COLOR_DEEP_BLUE

public static final byte COLOR_DEEP_BLUE
See Also:
Constant Field Values

COLOR_ORANGE

public static final byte COLOR_ORANGE
See Also:
Constant Field Values

COLOR_PURPLE

public static final byte COLOR_PURPLE
See Also:
Constant Field Values

COLOR_PALE_GREEN

public static final byte COLOR_PALE_GREEN
See Also:
Constant Field Values

COLOR_PALE_TURQUOISE

public static final byte COLOR_PALE_TURQUOISE
See Also:
Constant Field Values

COLOR_GREY

public static final byte COLOR_GREY
See Also:
Constant Field Values

COLOR_WHITE

public static final byte COLOR_WHITE
See Also:
Constant Field Values

SOSI_DISPLAY_STYLE_LTGT

public static final int SOSI_DISPLAY_STYLE_LTGT
See Also:
Constant Field Values

SOSI_DISPLAY_STYLE_BLANKS

public static final int SOSI_DISPLAY_STYLE_BLANKS
See Also:
Constant Field Values

SOSI_DISPLAY_STYLE_ARROWS

public static final int SOSI_DISPLAY_STYLE_ARROWS
See Also:
Constant Field Values

MODEL_3278_2

public static final int MODEL_3278_2
See Also:
Constant Field Values

MODEL_3278_2_E

public static final int MODEL_3278_2_E
See Also:
Constant Field Values

MODEL_3278_3

public static final int MODEL_3278_3
See Also:
Constant Field Values

MODEL_3278_3_E

public static final int MODEL_3278_3_E
See Also:
Constant Field Values

MODEL_3278_4

public static final int MODEL_3278_4
See Also:
Constant Field Values

MODEL_3278_4_E

public static final int MODEL_3278_4_E
See Also:
Constant Field Values

MODEL_3278_5

public static final int MODEL_3278_5
See Also:
Constant Field Values

MODEL_3278_5_E

public static final int MODEL_3278_5_E
See Also:
Constant Field Values

CONNECTION_STATE_CONNECTED

public static final int CONNECTION_STATE_CONNECTED
See Also:
Constant Field Values

CONNECTION_STATE_CONNECTING

public static final int CONNECTION_STATE_CONNECTING
See Also:
Constant Field Values

CONNECTION_STATE_DISCONNECTED

public static final int CONNECTION_STATE_DISCONNECTED
See Also:
Constant Field Values

CONNECTION_STATE_DISCONNECTING

public static final int CONNECTION_STATE_DISCONNECTING
See Also:
Constant Field Values

TERMINAL_MODE_NONE

public static final int TERMINAL_MODE_NONE
See Also:
Constant Field Values

TERMINAL_MODE_NVT

public static final int TERMINAL_MODE_NVT
See Also:
Constant Field Values

TERMINAL_MODE_3270_NORMAL

public static final int TERMINAL_MODE_3270_NORMAL
See Also:
Constant Field Values

TERMINAL_MODE_3270_SUSPEND

public static final int TERMINAL_MODE_3270_SUSPEND
See Also:
Constant Field Values

PRINTSTYLE_NORMAL

public static final int PRINTSTYLE_NORMAL
See Also:
Constant Field Values

PRINTSTYLE_WHITE_ON_BLACK

public static final int PRINTSTYLE_WHITE_ON_BLACK
See Also:
Constant Field Values

PRINTSTYLE_BLACK_ON_WHITE

public static final int PRINTSTYLE_BLACK_ON_WHITE
See Also:
Constant Field Values

PRINTSTYLE_COLOR_ON_WHITE

public static final int PRINTSTYLE_COLOR_ON_WHITE
See Also:
Constant Field Values

CURSOR_BLOCK

public static final int CURSOR_BLOCK
See Also:
Constant Field Values

CURSOR_INVERSE

public static final int CURSOR_INVERSE
See Also:
Constant Field Values

CURSOR_UNDERLINE

public static final int CURSOR_UNDERLINE
See Also:
Constant Field Values

CURSOR_SIDELINE

public static final int CURSOR_SIDELINE
See Also:
Constant Field Values

DISC_REASON_NEVER_CONNECTED

public static final int DISC_REASON_NEVER_CONNECTED
See Also:
Constant Field Values

DISC_REASON_NO_CONNECTION_ESTABLISHED

public static final int DISC_REASON_NO_CONNECTION_ESTABLISHED
See Also:
Constant Field Values

DISC_REASON_STOPPED_BY_USER

public static final int DISC_REASON_STOPPED_BY_USER
See Also:
Constant Field Values

DISC_REASON_DROPPED

public static final int DISC_REASON_DROPPED
See Also:
Constant Field Values

DISC_REASON_TIMED_OUT

public static final int DISC_REASON_TIMED_OUT
See Also:
Constant Field Values

DISC_REASON_SECURITY_FAILURE

public static final int DISC_REASON_SECURITY_FAILURE
See Also:
Constant Field Values

DISC_REASON_DEVICE_IN_USE

public static final int DISC_REASON_DEVICE_IN_USE
See Also:
Constant Field Values

DISC_REASON_INV_NAME

public static final int DISC_REASON_INV_NAME
See Also:
Constant Field Values

DISC_REASON_INV_DEVICE_TYPE

public static final int DISC_REASON_INV_DEVICE_TYPE
See Also:
Constant Field Values

DISC_REASON_TYPE_NAME_ERROR

public static final int DISC_REASON_TYPE_NAME_ERROR
See Also:
Constant Field Values

DISC_REASON_UNKNOWN_ERROR

public static final int DISC_REASON_UNKNOWN_ERROR
See Also:
Constant Field Values

DISC_REASON_UNSUPPORTED_REQ

public static final int DISC_REASON_UNSUPPORTED_REQ
See Also:
Constant Field Values

CODEPAGE_IBM037

public static final String CODEPAGE_IBM037
US English, Portuguese, Canadian French

See Also:
Constant Field Values

CODEPAGE_IBM273

public static final String CODEPAGE_IBM273
German

See Also:
Constant Field Values

CODEPAGE_IBM277

public static final String CODEPAGE_IBM277
Danish, Norwegian

See Also:
Constant Field Values

CODEPAGE_IBM278

public static final String CODEPAGE_IBM278
Finnish, Swedish

See Also:
Constant Field Values

CODEPAGE_IBM280

public static final String CODEPAGE_IBM280
Italian

See Also:
Constant Field Values

CODEPAGE_IBM284

public static final String CODEPAGE_IBM284
Spanish

See Also:
Constant Field Values

CODEPAGE_IBM285

public static final String CODEPAGE_IBM285
UK English

See Also:
Constant Field Values

CODEPAGE_IBM297

public static final String CODEPAGE_IBM297
French

See Also:
Constant Field Values

CODEPAGE_IBM500

public static final String CODEPAGE_IBM500
Belgian, Swiss German

See Also:
Constant Field Values

CODEPAGE_IBM870

public static final String CODEPAGE_IBM870
Hungarian, Polish, Romanian, etc.

See Also:
Constant Field Values

CODEPAGE_IBM875

public static final String CODEPAGE_IBM875
Greek

See Also:
Constant Field Values

CODEPAGE_IBM930

public static final String CODEPAGE_IBM930
Japanese DBCS

See Also:
Constant Field Values

CODEPAGE_IBM933

public static final String CODEPAGE_IBM933
Korean DBCS

See Also:
Constant Field Values

CODEPAGE_IBM935

public static final String CODEPAGE_IBM935
Simplified Chinese DBCS

See Also:
Constant Field Values

CODEPAGE_IBM937

public static final String CODEPAGE_IBM937
Traditional Chinese DBCS

See Also:
Constant Field Values

CODEPAGE_IBM939

public static final String CODEPAGE_IBM939
Japanese DBCS

See Also:
Constant Field Values

CODEPAGE_IBM1025

public static final String CODEPAGE_IBM1025
Bulgarian, Macedonian, Serbian Cyrillic, Russian

See Also:
Constant Field Values

CODEPAGE_IBM1026

public static final String CODEPAGE_IBM1026
Turkish

See Also:
Constant Field Values

CODEPAGE_IBM1047

public static final String CODEPAGE_IBM1047
Open Edition

See Also:
Constant Field Values

CODEPAGE_IBM1140

public static final String CODEPAGE_IBM1140
US English - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1141

public static final String CODEPAGE_IBM1141
German - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1142

public static final String CODEPAGE_IBM1142
Danish, Norwegian - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1143

public static final String CODEPAGE_IBM1143
Finnish, Swedish - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1144

public static final String CODEPAGE_IBM1144
Italian - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1145

public static final String CODEPAGE_IBM1145
Spanish - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1146

public static final String CODEPAGE_IBM1146
UK English - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1147

public static final String CODEPAGE_IBM1147
French - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1148

public static final String CODEPAGE_IBM1148
Multilingual - Euro

See Also:
Constant Field Values

CODEPAGE_IBM1149

public static final String CODEPAGE_IBM1149
Icelandic - Euro

See Also:
Constant Field Values
Constructor Detail

Terminal

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


Terminal

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

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

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

Parameters:
source - The Terminal upon which the new one is to be based.
Throws:
IllegalArgumentException - if source is null.
Method Detail

removeNotify

public void removeNotify()

addNotify

public void addNotify()

getCopyrightString

public String getCopyrightString()
Obtains the Sun Microsystems copyright string.

Returns:
the Sun copyright string.

getIdentifierString

public String getIdentifierString()
Gets a textual indicator of the version and build level of this Bean.

Returns:
an identifier.

isKeyboardLocked

public boolean isKeyboardLocked()
Determines if the keyboard is locked.

Returns:
the keyboard lock state.

setTN3270Host

public void setTN3270Host(String newHost)
Sets the name of the TN3270 host with which to communicate. The parameter specifies the remote TCP host, either as a host name or an IP address. This value is used in the connect() process.

Parameters:
newHost - The TN3270 host.
See Also:
getTN3270Host()
Default Value:
"localhost"

getTN3270Host

public String getTN3270Host()
Gets the TN3270 host. The returned value is that last set using the setTN3270Host method. This method is typically used to obtain the name of the host for the current connection.

Returns:
the TN3270 host.
See Also:
setTN3270Host(java.lang.String)

setTN3270Port

public void setTN3270Port(int newPort)
Sets the port number on which the TN3270 server is listening. This value is used in the connect() process.

Parameters:
newPort - The TN3270 port.
See Also:
getTN3270Port()
Default Value:
2001

getTN3270Port

public int getTN3270Port()
Gets the TN3270 port. The returned value is that last set using the setTN3270Port method. This method is typically used to obtain the port for the host for the current connection.

Returns:
the TN3270 port.
See Also:
setTN3270Port(int)

setModel

public void setModel(int newModel)
Sets the model to the specified value.

Parameters:
newModel - The TN3270 model - this should be to one of the MODEL constant values defined in this class.
See Also:
getModel()
Default Value:
MODEL_3278_2_E

getModel

public int getModel()
Gets the model of the Terminal

Returns:
the TN3270 model - this is one of the MODEL constant values defined in this class.
See Also:
setModel(int)

setNetworkInactivityTimeout

public void setNetworkInactivityTimeout(int seconds)
Sets the network inactivity timeout for the remote connection. A value of 0 indicates that no timeout will occur.

IMPORTANT NOTE: The calling of this method when the Terminal is CONNECTED is known to be unreliable in some Java environments. It is highly recommended that this method is only called when the Terminal 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()
Default Value:
300 seconds (5 minutes)

getNetworkInactivityTimeout

public int getNetworkInactivityTimeout()
Gets 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()
Gets the maximum number of rows of the Terminal.

Returns:
the maximum number of rows.

getMaximumColumns

public int getMaximumColumns()
Gets the maximum number of columns of the Terminal.

Returns:
the maximum number of columns.

getMaximumDisplaySize

public int getMaximumDisplaySize()
Gets the maximum display size of the Terminal in characters. This is equal to
maximumRows * maximumColumns

Returns:
the maximum display size.

getRows

public int getRows()
Gets the number of rows of the Terminal. This is dependent on the model.

Returns:
the number of rows.

getColumns

public int getColumns()
Gets the number of columns of the Terminal. This is dependent on the model.

Returns:
the number of columns.

getDisplaySize

public int getDisplaySize()
Gets the display size of the Terminal in characters. This is dependent on the model.

Returns:
the display size.

getConnectionState

public int getConnectionState()
Gets the connection state of the Terminal.

Returns:
the connection state - this is one of the CONNECTION_STATE constant values defined in this class.

isConnected

public boolean isConnected()
Determines if the Terminal is in a connected state.

Returns:
the connected state.
See Also:
isConnecting(), isDisconnected(), isDisconnecting()

isConnecting

public boolean isConnecting()
Determines if the Terminal is in a connecting state.

Returns:
the connecting state.
See Also:
isConnected(), isDisconnected(), isDisconnecting()

isDisconnected

public boolean isDisconnected()
Determines if the Terminal is in a disconnected state.

Returns:
the disconnected state.
See Also:
isConnected(), isConnecting(), isDisconnecting()

isDisconnecting

public boolean isDisconnecting()
Determines 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 as an int.

Returns:
the reason for disconnection - this is one of the DISC_REASON constant values defined in this class.

getLastDisconnectionString

public String getLastDisconnectionString()
Gets a textual representation of the reason for the last disconnection of the Terminal.

Returns:
a 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 - if the Terminal is already connected to a host, or if this is an EVALUATION copy of the Terminal 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 Terminal 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 Terminal. If null then the default message is used.
Throws:
IllegalStateException - if the Terminal is not connected to a host.
See Also:
disconnect(), connect()

getCursorRow

public int getCursorRow()
Gets the row number of the Terminal containing the cursor.

Returns:
the row.

getCursorColumn

public int getCursorColumn()
Gets the column number of the Terminal containing the cursor.

Returns:
the column.

getCursorOffset

public int getCursorOffset()
Gets 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 objects of class TerminalField and they will be in ascending start offset order.

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

It should be noted that this method can successfully be called against a disconnected Terminal. The results then reflect the state of the Terminal at the time the disconnection occurred.

Returns:
a Vector containing all of the fields.
Throws:
IllegalStateException - if the Terminal is in NVT mode.
See Also:
findField(int)

isFormatted

public boolean isFormatted()
Determines if the Terminal display is formatted. A screen is defined as formatted if it possesses fields.

Returns:
the formatted state.

isCharUnderlined

public boolean isCharUnderlined(int offset)
Determines if the character at the given offset 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.
Throws:
IllegalArgumentException - if offset is less than zero or greater than the current screen size.
See Also:
isCharUnderlined(int,int)

isCharUnderlined

public boolean isCharUnderlined(int row,
                                int column)
Determines 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.
Throws:
IllegalArgumentException - if row or column is less than zero or greater than the current row or column.
See Also:
isCharUnderlined(int)

isCharReversed

public boolean isCharReversed(int offset)
Determines if the character at the given offset 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.
Throws:
IllegalArgumentException - if offset is less than zero or greater than the current screen size.
See Also:
isCharReversed(int,int)

isCharReversed

public boolean isCharReversed(int row,
                              int column)
Determines 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.
Throws:
IllegalArgumentException - if the supplied row or column is beyond the boundaries of the screen.
See Also:
isCharReversed(int)

isCharFlashing

public boolean isCharFlashing(int offset)
Determines if the character at the given offset 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.
Throws:
IllegalArgumentException - if offset is less than zero or greater than the current screen size.
See Also:
isCharFlashing(int,int)

isCharFlashing

public boolean isCharFlashing(int row,
                              int column)
Determines 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.
Throws:
IllegalArgumentException - if the supplied row or column is beyond the boundaries of the screen.
See Also:
isCharFlashing(int)

pressInsert

public void pressInsert()
Simulates the pressing of the Insert key on a 3270 keyboard.

Since:
2.0
See Also:
isInserting(), setInserting(boolean)

setInserting

public void setInserting(boolean insertMode)
Sets the insert mode.

Parameters:
insertMode - The insert mode.
Throws:
IllegalStateException - if the keyboard is not unlocked.
See Also:
isInserting()

isInserting

public boolean isInserting()
Determines 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.

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.
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.

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.
See Also:
cursorLeft(), cursorDown(), cursorUp()

cursorUp

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

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.
See Also:
cursorLeft(), cursorRight(), cursorDown()
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.

cursorDown

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

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.
See Also:
cursorLeft(), cursorRight(), cursorUp()
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.

tab

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

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.
See Also:
backtab()

backtab

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

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.
See Also:
tab()

newline

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

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.

home

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

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.

typeChar

public void typeChar(char c)
Types a character on the Terminal 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.

Parameters:
c - The character to be typed on the Terminal.
DBCS Considerations:
  • If a 3270 field is defined as being a pure DBCS field, then only UNICODE characters that map to double byte EBCDIC characters using the current codepage may be entered in that field.
  • If a 3270 field is defined as being a pure SBCS field, then only UNICODE characters that map to single byte EBCDIC characters using the current codepage may be entered in that field.
  • For a SOSI field, SO and SI markers are inserted automatically where required. The supplied character must not be a SO or a SI.

typeCharNVT

public void typeCharNVT(char c)
Types a character on the Terminal 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 Terminal.

typeString

public void typeString(String s)
Types a set of characters on the Terminal 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.

Parameters:
s - The String to be typed on the Terminal.
DBCS Considerations:
  • If a 3270 field is defined as being a pure DBCS field, then only UNICODE characters that map to double byte EBCDIC characters using the current codepage may be entered in that field.
  • If a 3270 field is defined as being a pure SBCS field, then only UNICODE characters that map to single byte EBCDIC characters using the current codepage may be entered in that field.
  • For a SOSI field, SO and SI markers are inserted automatically where required. The supplied string must not contain SOSI markers.

eraseEndOfField

public void eraseEndOfField()
Simulates the pressing of the EOF key on a 3270 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.

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.

eraseInput

public void eraseInput()
Simulates the pressing of the Erase Input key on a 3270 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.

If there are no unprotected fields, the cursor is placed at the top left corner of the screen.

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.

delete

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

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.

backspace

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

Throws:
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.

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)
Gets 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.

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.
Throws:
IllegalArgumentException - if the supplied offset is beyond the boundaries of the screen, or if the length is less than 1 or greater than the size of the screen.
See Also:
typeString(java.lang.String)
DBCS Considerations:
  • The 2 display positions occupied by a DBCS character must both be contained within the range specified in order for that DBCS character to be present in the returned string.
  • Each DBCS character is returned as a single UNICODE character in the returned string
  • SO and SI markers in SOSI fields are stripped from the returned string. There are two reasons for this: firstly they are not required in a UNICODE string, and secondly, this allows the contents of one SOSI field obtained using this method to be entered into another SOSI field using the typeString(String) routine

getExtendedAttributeBuffer

public byte[] 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 byte[] 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 byte[] 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 a 3270 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 a 3270 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 a 3270 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 a 3270 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 a 3270 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(int) method to simulate a light-pen.

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

setFont

public void setFont(Font newFont)
Sets the font used to render the Terminal.

Parameters:
newFont - the font.
See Also:
getFont()

getFont

public Font getFont()
Gets the font of the Terminal.

Specified by:
getFont in interface MenuContainer
Returns:
the font.
See Also:
setFont(java.awt.Font)

setLocale

public void setLocale(Locale l)

setBackground

public void setBackground(Color c)
Sets the Terminal background color to the specified color.

Parameters:
c - The background color.
See Also:
getBackground()
Default Value:
Color.black

getBackground

public Color getBackground()
Gets the background color of the Terminal.

Returns:
the background color.
See Also:
setBackground(java.awt.Color)

setUnprotectedNormalColor

public void setUnprotectedNormalColor(Color c)
Sets the color in which to render the text in unprotected normal fields.

Parameters:
c - The unprotected normal color.
Throws:
NullPointerException - if c is null.
See Also:
getUnprotectedNormalColor()

getUnprotectedNormalColor

public Color getUnprotectedNormalColor()
Gets the color in which to render the text in unprotected normal fields.

Returns:
the unprotected normal color.
See Also:
setUnprotectedNormalColor(java.awt.Color)

setProtectedNormalColor

public void setProtectedNormalColor(Color c)
Sets the color in which to render the text in protected normal fields.

Parameters:
c - The protected normal color.
Throws:
NullPointerException - if c is null.
See Also:
getProtectedNormalColor()

getProtectedNormalColor

public Color getProtectedNormalColor()
Gets the color in which to render the text in protected normal fields.

Returns:
the protected normal color.
See Also:
setProtectedNormalColor(java.awt.Color)

setUnprotectedIntenseColor

public void setUnprotectedIntenseColor(Color c)
Sets the color in which to render the text in unprotected intense fields.

Parameters:
c - The unprotected intense color.
Throws:
NullPointerException - if c is null.
See Also:
getUnprotectedIntenseColor()

getUnprotectedIntenseColor

public Color getUnprotectedIntenseColor()
Gets the color in which to render the text in unprotected intense fields.

Returns:
the unprotected intense color.
See Also:
setUnprotectedIntenseColor(java.awt.Color)

setProtectedIntenseColor

public void setProtectedIntenseColor(Color c)
Sets the color in which to render the text in protected intense fields.

Parameters:
c - The protected intense color.
Throws:
NullPointerException - if c is null.
See Also:
getProtectedIntenseColor()

getProtectedIntenseColor

public Color getProtectedIntenseColor()
Gets the color in which to render the text in protected intense fields.

Returns:
the protected intense color.
See Also:
setProtectedIntenseColor(java.awt.Color)

setStatusBarBackground

public void setStatusBarBackground(Color c)
Sets the background color of the status bar.

Parameters:
c - The status bar background color.
Throws:
NullPointerException - if c is null.
See Also:
getStatusBarBackground()
Default Value:
Color.gray

getStatusBarBackground

public Color getStatusBarBackground()
Gets the background color of the status bar.

Returns:
the status bar background color.
See Also:
setStatusBarBackground(java.awt.Color)

setStatusBarForeground

public void setStatusBarForeground(Color c)
Sets the foreground color of the status bar.

Parameters:
c - The status bar foreground color.
Throws:
NullPointerException - if c is null.
See Also:
getStatusBarForeground()
Default Value:
Color.black

getStatusBarForeground

public Color getStatusBarForeground()
Gets the foreground color of the status bar.

Returns:
the status bar foreground color.
See Also:
setStatusBarForeground(java.awt.Color)

setExtendedColors

public void setExtendedColors(Color[] c)
Sets a the colors in the color map for the colors as defined by the extended attributes on the screen.

The supplied new colors can be an array of any length. Up to the first 16 elements from the array are used to populate the internal color map. Any item in the array being null causes the internal color map for that index to remain unchanged.

Parameters:
c - The extended color map.
Throws:
NullPointerException - if c is null.
See Also:
getExtendedColors()

setExtendedColors

public void setExtendedColors(int index,
                              Color c)
Sets 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.
Throws:
NullPointerException - if c is null.
IllegalArgumentException - if the index < 0 or index >15.
See Also:
getExtendedColors(int)

getExtendedColors

public Color[] getExtendedColors()
Gets the extended color map.

Returns:
the array of colors.
See Also:
setExtendedColors(java.awt.Color[])

getExtendedColors

public Color getExtendedColors(int index)
Gets 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)
Sets the style of printing to be used. The PRINTSTYLE values describe a set of ways that printing can be handled.

Parameters:
style - The print style - an int that should be one of the PRINTSTYLE constant values defined in this class.
Throws:
IllegalArgumentException - if style is not one of the defined print styles.
See Also:
getPrintStyle()
Default Value:
PRINTSTYLE_NORMAL

getPrintStyle

public int getPrintStyle()
Gets the style of printing.

Returns:
the print style - this is one of the PRINTSTYLE constant values defined in this class.
See Also:
setPrintStyle(int)

setStatusBarShowing

public void setStatusBarShowing(boolean displayValue)
Sets whether the visible Terminal should have a status bar on it.

Parameters:
displayValue - Whether the status bar should be displayed.
See Also:
isStatusBarShowing()
Default Value:
true

isStatusBarShowing

public boolean isStatusBarShowing()
Determines whether the visible Terminal 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)
Sets the style of the overtype cursor.

Parameters:
style - The overtype cursor style - an int that should be one of the CURSOR constant values defined in this class.
Throws:
IllegalArgumentException - if the style is not one of the valid values.
See Also:
getOvertypeCursorStyle()
Default Value:
CURSOR_BLOCK

getOvertypeCursorStyle

public int getOvertypeCursorStyle()
Gets the style of the overtype cursor.

Returns:
the overtype cursor style - this is one of the CURSOR constant values defined in this class.
See Also:
setOvertypeCursorStyle(int)

setOvertypeCursorColor

public void setOvertypeCursorColor(Color c)
Sets the color of the overtype cursor.

Parameters:
c - The new overtype cursor color.
Throws:
NullPointerException - if c is null.
See Also:
getOvertypeCursorColor()
Default Value:
Color.blue

getOvertypeCursorColor

public Color getOvertypeCursorColor()
Gets the color of the overtype cursor.

Returns:
the overtype cursor color.
See Also:
setOvertypeCursorColor(java.awt.Color)

setOvertypeCursorFlashing

public void setOvertypeCursorFlashing(boolean b)
Sets whether the overtype cursor should flash or not.

Parameters:
b - true to make the cursor flash.
See Also:
isOvertypeCursorFlashing()
Default Value:
false

isOvertypeCursorFlashing

public boolean isOvertypeCursorFlashing()
Determines 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)
Sets the style of the insert cursor.

Parameters:
style - The insert cursor style - this should be one of the CURSOR constant values defined in this class.
Throws:
IllegalArgumentException - if the style is not one of the valid values.
See Also:
getInsertCursorStyle()
Default Value:
CURSOR_SIDELINE

getInsertCursorStyle

public int getInsertCursorStyle()
Gets the style of the insert cursor.

Returns:
the overtype cursor style - this is one of the CURSOR constant values defined in this class.
See Also:
setInsertCursorStyle(int)

setInsertCursorColor

public void setInsertCursorColor(Color c)
Sets the color of the insert cursor.

Parameters:
c - The insert cursor color.
Throws:
NullPointerException - if c is null.
See Also:
getInsertCursorColor()
Default Value:
Color.blue

getInsertCursorColor

public Color getInsertCursorColor()
Gets the color of the insert cursor.

Returns:
the insert cursor color.
See Also:
setInsertCursorColor(java.awt.Color)

setInsertCursorFlashing

public void setInsertCursorFlashing(boolean b)
Sets whether the insert cursor should flash or not.

Parameters:
b - true to make the cursor flash.
See Also:
isInsertCursorFlashing()
Default Value:
false

isInsertCursorFlashing

public boolean isInsertCursorFlashing()
Determines whether the insert cursor should flash or not.

Returns:
true if the cursor is flashing.
See Also:
setInsertCursorFlashing(boolean)

findField

public TerminalField findField(int offset)
Gets the field that contains the given offset.

This method returns null if the screen is unformatted.

Parameters:
offset - The offset value.
Returns:
the field at the given offset.
Throws:
IllegalArgumentException - if offset is less than zero or greater than the current screen size.
IllegalStateException - if the Terminal is in NVT mode.
See Also:
getFields()

offsetFromRowColumn

public int offsetFromRowColumn(int row,
                               int column)
Returns 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.
Throws:
IllegalArgumentException - if the supplied row or column is beyond the boundaries of the screen.
See Also:
rowFromOffset(int), columnFromOffset(int)

rowFromOffset

public int rowFromOffset(int offset)
Gets the row number 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.
Throws:
IllegalArgumentException - if offset is less than zero or greater than the current screen size.
See Also:
offsetFromRowColumn(int,int), columnFromOffset(int)

columnFromOffset

public int columnFromOffset(int offset)
Gets the column number 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.
Throws:
IllegalArgumentException - if offset is less than zero or greater than the current screen size.
See Also:
offsetFromRowColumn(int,int), rowFromOffset(int)

offsetFromPoint

public int offsetFromPoint(int x,
                           int y)
Returns the offset value given x and y 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 Terminal screen is not visible.
See Also:
offsetFromPoint(java.awt.Point)

offsetFromPoint

public int offsetFromPoint(Point p)
Returns the offset value given a Point. If there is no visible screen an IllegalStateException is thrown.

Parameters:
p - The screen pixel position.
Returns:
the offset.
Throws:
IllegalStateException - if the Terminal screen is not visible.
See Also:
offsetFromPoint(int, int)

addHighlightArea

public void addHighlightArea(int offset,
                             int length,
                             Color color)
Adds 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.
Throws:
NullPointerException - if color is null.
See Also:
removeAllHighlightAreas()

addHighlightAreas

public void addHighlightAreas(int[] offset,
                              int[] length,
                              Color[] color)
Adds multiple areas of the 3270 display to be highlighted in the given colors. This is the same as calling addHighlightArea multiple times.

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.
Throws:
NullPointerException - if any of the parameters are null.
IllegalArgumentException - if the lengths of the arrays are not the same, or if any of the elements of the arrays is not valid.
See Also:
removeAllHighlightAreas()

removeAllHighlightAreas

public void removeAllHighlightAreas()
Removes 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)

getMinimumSize

public Dimension getMinimumSize()

getPreferredSize

public Dimension getPreferredSize()

addTerminalListener

public void addTerminalListener(TerminalListener l)
Adds a listener for Terminal events.

Parameters:
l - The TerminalListener to be added.
Since:
2.0
See Also:
removeTerminalListener(com.sun.emp.pathway.bean.TerminalListener)

removeTerminalListener

public void removeTerminalListener(TerminalListener l)
Removes a listener for Terminal events.

Parameters:
l - The TerminalListener to be removed.
See Also:
addTerminalListener(com.sun.emp.pathway.bean.TerminalListener)

getTerminalListeners

public TerminalListener[] getTerminalListeners()
Gets all of the registered TerminalListeners.

Returns:
the listeners.
Since:
2.0
See Also:
addTerminalListener(com.sun.emp.pathway.bean.TerminalListener), removeTerminalListener(com.sun.emp.pathway.bean.TerminalListener)

getListeners

public EventListener[] getListeners(Class listenerType)

setEnabled

public void setEnabled(boolean b)

setForceEWA

public void setForceEWA(boolean b)
Sets whether all datastreams that come in should be treated as if they are for the alternate screen size.

Parameters:
b - true if datastream are all to be treated as alternate.
See Also:
getForceEWA()
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.


getForceEWA

public boolean getForceEWA()
Determines whether all datastreams that come in are be treated as if they are for the alternate screen size.

Returns:
true if datastream are all treated as alternate.
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.

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

Parameters:
b - Force or not.
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.


pressDUP

public void pressDUP()
Simulates the pressing of the DUP key on a 3270 keyboard.

Throws:
IllegalStateException - if this operation is performed when any one of the following conditions are 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 a 3270 keyboard.

Throws:
IllegalStateException - if this operation is performed when any one of the following conditions are 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 a 3270 keyboard.


moveCursorToOffset

public void moveCursorToOffset(int offset)
Moves the cursor to the specified offset on the Terminal.

Parameters:
offset - The cursor offset.
Throws:
IllegalArgumentException - if offset is less than zero or greater than the current screen size.
IllegalStateException - if the Terminal is not connected, keyboard unlocked, and in 3270 or suspend mode.
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.

moveCursorToRowColumn

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

Parameters:
row - The cursor row.
column - The cursor column.
Throws:
IllegalArgumentException - if the supplied row or column is beyond the boundaries of 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.

waitUntilConnected

public void waitUntilConnected()
Waits until the Terminal is connected. A call to this method should only be made after a connect() is issued.

Throws:
IllegalStateException - if the Terminal is in DISCONNECTED state when this call is made, or if the Terminal enters DISCONNECTED state during the wait.
See Also:
connect()

waitUntilDisconnected

public void waitUntilDisconnected()
Waits until the Terminal is disconnected.


waitUntilKeyboardUnlocked

public void waitUntilKeyboardUnlocked()
Waits until the Terminal keyboard is unlocked.

Throws:
IllegalStateException - if this method is called when the Terminal is not in connected state, or if the Terminal leaves connected state during the wait.

waitHeuristic

public void waitHeuristic(int timeInMillis)
Waits 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 - if this method is called when the Terminal is not in connected state, or if the Terminal leaves connected state during the wait.
IllegalArgumentException - if timeInMillis is negative.

waitCondition

public void waitCondition(TerminalCondition terminalCondition)
                   throws TerminalConditionException
Waits until the condition specified in the TerminalCondition class is met.

Parameters:
terminalCondition - The TerminalCondition object defining the wait condition.
Throws:
NullPointerException - if terminalCondition is null.
TerminalConditionException - if a runtime error occurs within the isSatisfied method of terminalCondition.
Since:
2.0

waitForReadableString

public void waitForReadableString(String readableString,
                                  int offset)
Waits for the specified string to be displayed on the Terminal at the specified offset.

Parameters:
readableString - The String to wait for.
offset - The start offset of where the string is to be displayed.
Throws:
IllegalStateException - if the Terminal is not in the connected state when this call is made, or if the Terminal leaves the connected state during the wait.
NullPointerException - if readableString is null.
IllegalArgumentException - if the supplied offset is negative.
Since:
2.0

dispose

public void dispose()
Disposes of the Terminal and releases any resources that it is using.

Do not call any other methods in the Terminal after it has been disposed.


getRowHeight

public int getRowHeight()
Gets the height of a single row of the Terminal in pixels.

This returns 0 if the Terminal has not been shown.

Returns:
the row height.
See Also:
getColumnWidth()

getColumnWidth

public int getColumnWidth()
Gets the width of a single column of the Terminal in pixels.

This returns 0 if the Terminal has not been shown.

Returns:
the column width.
See Also:
getRowHeight()

getBoundary

public Insets getBoundary()
Gets an Insets object representing the 'freespace' around the Terminal.

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

Returns:
an Insets object.
Throws:
IllegalStateException - if the Terminal screen is not visible.

isKeyboardInitiallyUnlocked

public boolean isKeyboardInitiallyUnlocked()
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.

Returns:
the initial keyboard locked state.
See Also:
setKeyboardInitiallyUnlocked(boolean)
Default Value:
false

setKeyboardInitiallyUnlocked

public void setKeyboardInitiallyUnlocked(boolean b)
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.

Parameters:
b - The new initial keyboard locked state.
See Also:
isKeyboardInitiallyUnlocked()
Default Value:
false

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 constants.
Default Value:
CODEPAGE_IBM1047

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 constants.

getTerminalMode

public int getTerminalMode()
Gets the current Terminal mode. This can be one of the following values:

Returns:
the mode.

pressSysreq

public void pressSysreq()
Simulates 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.

See Also:
isSysreqAllowed()

pressATTN

public void pressATTN()
Simulates the pressing of the ATTN key.


isSysreqAllowed

public boolean isSysreqAllowed()
Determines if the use of the pressSysreq() method is allowed.

Returns:
is SYSREQ allowed.
See Also:
pressSysreq()

getNetname

public String getNetname()
Gets 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.
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.
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.
See Also:
setPreferredNetname(java.lang.String)

setTN3270EAllowed

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

Parameters:
b - Allow TN3270E.
Throws:
IllegalStateException - if the Terminal is in a DISCONNECTED state when this call is made.
See Also:
getPreferredNetname()
Default Value:
true

isTN3270EAllowed

public boolean isTN3270EAllowed()
Determines if the Terminal is to use the TN3270E protocol (as defined in RFC 1647 and RFC 2355).

Returns:
allow TN3270E?
See Also:
getPreferredNetname()
Default Value:
true

setDebugDestination

public void setDebugDestination(PrintWriter pw)
Defines the destination for debug information.

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()
Determines whether validation is performed of characters typed into 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)
Controls whether validation is performed of characters typed into 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 Terminals that share the same connection, i.e. those created using the constructor 'public Terminal(Terminal)'

Parameters:
b - The new value.
Default Value:
true

setCapturingData

public void setCapturingData(boolean b)
Defines if the Terminal 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:
b - true if data is to be captured.
See Also:
dump(java.io.PrintWriter)
Default Value:
false

isCapturingData

public boolean isCapturingData()
Determines if the Terminal 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)
Performs a diagnostic dump of the state of the Terminal.

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)
Performs a diagnostic dump of the state of the Terminal.

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.

setAutoFontResizingEnabled

public void setAutoFontResizingEnabled(boolean b)
Sets whether the font should automatically resize if the Terminal is resized.

Parameters:
b - true to enable automatic font resizing.
Since:
2.0
See Also:
isAutoFontResizingEnabled()
Default Value:
true

isAutoFontResizingEnabled

public boolean isAutoFontResizingEnabled()
Determines whether automatic font resizing is enabled.

Returns:
whether automatic font resizing is enabled.
Since:
2.0
See Also:
setAutoFontResizingEnabled(boolean)

getAccessibleContext

public AccessibleContext getAccessibleContext()
Specified by:
getAccessibleContext in interface Accessible

getPrintable

public Printable getPrintable()
Obtains a Printable that will render the Terminal to a page.

This method returns an object that is suitable for use with the JDK 1.4 Printing APIs.

Returns:
a printable.
Since:
2.0

setSOSIDisplayStyle

public void setSOSIDisplayStyle(int style)
Define how the DBCS SO and SI characters are to be displayed.

Parameters:
style - One of the following:
  • SOSI_DISPLAY_STYLE_LTGT : Display SO and SI as 'less-than' and 'greater-than' symbols respectively.
  • SOSI_DISPLAY_STYLE_BLANKS : Display SO and SI as blank characters.
  • SOSI_DISPLAY_STYLE_ARROWS : Display SO and SI as right and left pointing arrows respectively.
Since:
2.0p2
See Also:
getSOSIDisplayStyle()
Default Value:
SOSI_DISPLAY_STYLE_LTGT

getSOSIDisplayStyle

public int getSOSIDisplayStyle()
Determine the current display style for SO and SI characters

Returns:
One of:
  • SOSI_DISPLAY_STYLE_LTGT : SO and SI are displayed as 'less-than' and 'greater-than' symbols respectively.
  • SOSI_DISPLAY_STYLE_BLANKS : SO and SI are displayed as blank characters.
  • SOSI_DISPLAY_STYLE_ARROWS : SO and SI are displayed as right and left pointing arrows respectively.
Since:
2.0p2
See Also:
setSOSIDisplayStyle(int)