no.gar.glink.api
Class GlinkApi

java.lang.Object
  extended by no.gar.glink.api.GlinkApi
Direct Known Subclasses:
GlinkApiDebug

public class GlinkApi
extends java.lang.Object

This is the main class for the API interface to Glink. The class is contained in the file glink.jar. The Java class path must be adjusted so this jar file can be found.

To start Glink from an application, create a GlinkApi object and supply the user name, password and session name with the userName(), userPassword() and sessionName() methods. Then call the start method to launch Glink.

Profiling/debugging mode

A subclass of GlinkApi -- GlinkApiDebug -- can be used for debugging/profiling purposes. The signatures of the methods are exactly the same, but GlinkApiDebug will write a chronological trace of entry to and exit from API methods to timestamped files in the apitrace subdirectory of the current Glink directory. To enable this mode, create a GlinkApi object using one of the GlinkApi.createApi() methods, passing 'true' for the debug argument.

Restricted mode

When Glink is running as a J2EE connector, the J2EE application server will place the API in Restricted mode before passing it to client applications. When in Restricted mode, some methods will silently do nothing. These methods are marked as Restricted in this documentation.

Message mode and character sets

In message mode, Glink bypasses the emulation and sends and receives data directly between client and host. In emulation mode, clients always work in ASCII/UNICODE regardless of the host character set, as data is always assumed to be textual.
In message mode, binary data transmission is possible. This is implemented by two sets of message mode functions. One set works much like emulation mode in that data is always in ASCII/UNICODE as seen from the client, regardless of the host native character set. The other set allows transmission of raw data buffers in the host native character set. The difference between these two sets is that the former operates on String data, the latter operates on byte arrays. See the relevant messageModeXXX() methods below for details.


Field Summary
static int ASCII_TO_EBCDIC
          Specifies translation direction for translateBuffer(): ASCII to EBCDIC
static int EBCDIC_TO_ASCII
          Specifies translation direction for translateBuffer(): EBCDIC to ASCII
static int SCREEN_FORMATTED
          Specifies that one or more fields are defined for the current screen.
static int SCREEN_UNFORMATTED
          Specifies that no fields are defined for the current screen.
static int SCREEN_UNFORMATTED_CHAR
          Specifies that no fields are defined for the current screen and data is sent to the host character by character and simultaneously displayed on the local screen.
static int SEARCH_BACKWARD
          Specifies the search direction for the findString method.
static int SEARCH_FORWARD
          Specifies the search direction for the findString method.
 
Constructor Summary
GlinkApi()
          Constructs a new empty GlinkApi object.
GlinkApi(java.applet.Applet applet)
          Constructs a new empty GlinkApi object from an applet.
GlinkApi(GlinkApi anotherApi)
          Constructs a GlinkApi object that will inherit configuration parameters from another GlinkApi object.
 
Method Summary
 void addConfiguration(GlinkConfiguration glinkConfiguration)
          Adds the configuration to the list of available sessions.
 void addGlinkEventListener(GlinkEventListener listener)
          Specifies the listener which is to receive Glink events.
 void configBase(java.lang.String configBase)
          Sets the Glink configuration directory when running without a Glink Config Server.
 void configLanguage(java.lang.String lkey)
          Specifies the language file to use for fixed texts.
 void configServer(java.lang.String address)
          Specifies the IP address or host name of the computer where the Glink server is installed and running.
 void connect()
          Connects to the session specified with the sessionName() method.
static GlinkApi createApi(java.applet.Applet ap, boolean debug)
          Create a regular or debug enabled GlinkApi object from an Applet.
static GlinkApi createApi(boolean debug)
          Create a regular or debug enabled GlinkApi object.
static GlinkApi createApi(GlinkApi nother, boolean debug)
          Create a regular or debug enabled GlinkApi object from another GlinkApi object.
 void debugStart(java.io.PrintWriter debugStream)
          Start or restart Glink debugging, send output to a stream.
 void debugStop()
          Stop Glink debugging.
 void disconnect()
          Disconnects the current session.
 void emulate(java.lang.String hostData)
          This method emulates a string locally.
 java.lang.String fieldRead(int fieldNum)
          Returns the data for the given variable field.
 void fileBase(java.lang.String fileBase)
          Sets the Glink file base directory.
 java.awt.Point findString(java.lang.String string, java.awt.Point start, int length, int direction, boolean caseSensitive)
          Searches the text plane for the given string.
 void flushGlinkEvents()
          Flushes the GlinkEvent queue.
 int[] getAttributes(java.awt.Point start, int len)
          Returns the attributes for the target area
 int[] getAttributes(java.awt.Point start, java.awt.Point end)
          Returns the attributes for the target area
 java.util.Vector getAvailableSessions()
          Returns the sessions configured.
 int getBackgroundColor(int attribute)
          Returns the RGB value for the given field or character attribute.
 int getColumns()
          Returns the number of columns in the presentation space.
 int getCommunicationProtocol()
          Returns the current communication protocol.
 java.lang.String getConfigParameter(java.lang.String name)
          Returns the value as a string for the specified parameter name.
 java.awt.Point getCursor()
          Returns the current cursor position.
 byte[] getDataBytes(java.awt.Point start, int len)
          Returns the screen characters (bytes) for the target area in the configured character set
 byte[] getDataBytes(java.awt.Point start, java.awt.Point end)
          Returns the screen characters (bytes) for the target area in the configured character set
 char[] getDataChars(java.awt.Point start, int len)
          Returns the screen characters for the target area
 char[] getDataChars(java.awt.Point start, java.awt.Point end)
          Returns the screen characters for the target area
 int getDataLength(java.awt.Point start, java.awt.Point end)
          Returns the length for the target area.
 int getDefaultColorAttribute()
          Returns the default color attribute settings.
 int getEmulationType()
          Returns the current emulation type.
 GlinkFields getFields()
          Returns the GlinkFields object associated with the current screen.
 GlinkFields getFieldsEx()
          Returns the GlinkFields object associated with the current screen.
 int getForegroundColor(int attribute)
          Returns the RGB value for the given field or character attribute.
 java.awt.Container getGlinkContainer()
          Returns the object that contains all the visible Glink components.
 GlinkEvent getGlinkEvent(int eventCode, long timeout)
          Returns the first GlinkEvent available from the GlinkEvent queue.
 java.awt.Frame getGlinkFrame()
          Returns the Glink frame.
 java.lang.String getGlinkVersion()
          Returns the Glink version information as a text string.
 java.util.Vector getInteractiveComParams()
          Returns the interactive communication parameters.
 GlinkScreenArea getMarkedScreenArea()
          Returns a screen area object for the current screen selection.
 java.lang.String getProperty(java.lang.String key)
          Returns the the property for the given key.
 int getRows()
          Returns the number of rows in the presentation space.
 GlinkScreenArea getScreenArea(java.awt.Point start, java.awt.Point end, boolean rectangle)
          Returns an object for the given screen area or null if the positions given are not within the current screen.
 java.lang.String getScreenCharacterSet()
          Returns the name of the character set configured.
 int getScreenMode()
          If the host application has used field attributes to define fields on the screen, then the current screen is formatted.
 java.lang.String getSessionName()
          Returns the name of the current session
 java.lang.String getString()
          Returns the entire text plane of the presentation space as a string.
 java.lang.String getString(java.awt.Point start, java.awt.Point end)
          Returns the text at the given location in the presentation space as a string.
 GlinkFields getVariableFields()
          Returns the GlinkFields object associated with the current screen with variable fields only.
 GlinkFields getVariableFieldsEx()
          Returns the GlinkFields object associated with the current screen with variable fields only.
 boolean isConnected()
          Returns true if Glink is connected to a session.
 boolean isScreenAreaMatch(GlinkScreenArea sa)
          Returns true if the supplied GlinkScreenArea object matches the current screen.
 boolean isSessionAvailable(java.lang.String name, java.util.Vector sessions)
          Returns true if the given session is available.
 boolean isSplashScreenVisible()
          Returns true if the splash screen is visible.
 boolean isStarted()
          Returns true if Glink has started.
 boolean isTurnKnown()
          Returns true if Glink is connected to a host and the communication module in use knows about which side has the turn to send, either the host side or the Glink side.
 boolean isTurnReceived()
          Returns true if this side has the turn to send data.
 boolean isVisible()
          Returns true if the Glink screen (frame) is visible.
 void markScreenArea(java.awt.Point start, java.awt.Point end, boolean rectangle)
          This method marks the given screen area.
 void messageModeBufferOverwrite(boolean overwrite)
          Specifies if the message mode receive buffer may be overwritten if the limit of the buffer is reached.
 void messageModeOff()
          This method turns message mode off.
 void messageModeOn()
          This method instructs Glink to start message mode operation.
 void messageModeOn(int bufsize, boolean processHostData)
          This method instructs Glink to start message mode operation.
 java.lang.String messageModeReceive()
          This method returns the string of characters received from the host since the last time this method was called.
 byte[] messageModeReceiveBytes()
          This method returns the byte array received from the host since the last time this method or messageModeReceive() was called.
 byte[] messageModeReceiveBytesSync()
          This method waits until the turn has been received from the host and then returns the byte array of characters received, in the host native character set.
 byte[] messageModeReceiveBytesSync(int maxlen)
          This method waits until the requested number of characters has been received from the host before it returns these.
 java.lang.String messageModeReceiveSync()
          This method waits until the turn has been received from the host and then returns the string of characters received.
 java.lang.String messageModeReceiveSync(int maxlen)
          This method waits until the requested number of characters has been received from the host before it returns these.
 void messageModeSend(java.lang.String s)
          This method bypasses the Glink emulation and sends the string directly to the host.
 void messageModeSend(java.lang.String s, boolean passTurn)
          This method bypasses the Glink emulation and sends a string directly to the host.
 void messageModeSendBytes(byte[] s, int offset, int len)
          This method bypasses the Glink emulation and sends a byte array directly to the host.
 void messageModeSendBytes(byte[] s, int offset, int len, boolean passTurn)
          This method bypasses the Glink emulation and sends a byte array directly to the host.
 void notifyCommandKey(int commandKey)
          Instructs Glink to fire a GlinkEvent.COMMAND_KEY_TYPED event when the given command key is typed.
 void notifyDataBlocks(boolean enable)
          Turns on of off posting of GlinkEvent.DATA_BLOCK events.
 void notifyKey(int key)
          Instructs Glink to fire a GlinkEvent.KEY_TYPED event when the given key is typed.
 void notifyScreenArea(GlinkScreenArea screenArea, int identity, boolean removeAfterwards)
          Instructs Glink to fire a GlinkEvent.SCREEN_AREA_MATCH event when the given object matches the current screen.
 void notifyString(java.lang.String string, boolean caseSensitive, int identity, boolean removeAfterwards)
          Instructs Glink to fire a GlinkEvent.STRING_RECEIVED event when the given string is received from host.
 void noToolbar()
          This method instructs Glink to start without a toolbar and keybar.
 void queueGlinkEvents(boolean enable)
          Enables or disables the queuing of GlinkEvents.
 void removeConfiguration(GlinkConfiguration glinkConfiguration)
          Removes the configuration previously set with the addConfiguration method.
 void removeGlinkEventListener(GlinkEventListener listener)
          Removes the specified listener set with the addGlinkEventListener method.
 void removeNotifyCommandKey(int commandKey)
          Removes the notification for the command key previously set with the notifyCommandKey method.
 void removeNotifyKey(int key)
          Removes the notification for the key previously set with the notifyKey method.
 boolean removeNotifyScreenArea(int identity)
          Removes the GlinkScreenArea object associated with the given identity from the list of objects being checked for a match.
 boolean removeNotifyString(int identity)
          Removes the string associated with the given identity from the list of strings being checked for.
 void requestFocus()
          Requests that the Glink screen component get the input focus.
 boolean restoreScreenContent(java.lang.String fileName)
          Restores the screen previously saved.
 boolean saveScreenContent(java.lang.String fileName)
          Saves the current screen content to the file specified.
 void scriptCommand(java.lang.String command)
          Activates the given script command.
 void scriptFile(java.lang.String fileName)
          Activates the given script file.
 void scriptTerminate()
          Terminates the current script.
 void sendCommandKey(int key)
          The sendCommandKey method sends a "command" keystroke to the virtual screen.
 void sendKeys(java.lang.String text)
          Sends a string to the emulator starting at the current cursor location.
 void sendKeys(java.lang.String text, java.awt.Point location)
          Sends a string to the emulator starting at the given cursor location.
 void sendMacro(java.lang.String macro)
          Sends a string of characters and control characters to the emulator starting at the current cursor location.
 void serverPort(java.lang.String port)
          Set the IP port on which to connect to the Glink server.
 boolean sessionName(java.lang.String name)
          Specifies the name of the session to which Glink should connect.
 void setCursor(int x, int y)
          Moves the cursor to the given position.
 void setCursor(java.awt.Point location)
          Moves the cursor to the given position.
 void setGlinkDirectory(java.lang.String glinkDir)
          Set the Glink directory.
 void setInteractiveComParams(java.util.Vector params)
          Sets the interactive communication parameters.
 void setParameter(java.lang.String param)
          Add a configuration parameter to the glink.ini set.
 void setParentFrame(java.awt.Frame frame)
          Normally Glink starts up in its own frame.
 boolean setRestrictedMode(java.lang.String key, int level)
          Switch restricted mode on or off.
 void setScreenSize(int columns, int rows)
          For most emulations the screen size is 80 columns times 24 rows.
 void setSplashScreenVisible(boolean visible)
          Specifies whether the splash screen should be visible.
 void setString(java.lang.String text, java.awt.Point location)
          The setString method sends a string to the virtual screen at the specified location.
 void setVisible(boolean visible)
          Specifies whether the Glink screen (frame) should be visible or not.
 void start()
          Starts Glink.
 void stop()
          Stops Glink.
 void suppressTurnLostEvents(boolean doSuppress)
          Suppress or enable TURN_LOST events from the API.
 java.lang.String translateBuffer(java.lang.String buffer, int direction)
          Translate a string between ASCII and EBCDIC.
 void userName(java.lang.String name)
          Specifies the user name.
 void userPassword(java.lang.String password)
          Specifies the password for the user.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASCII_TO_EBCDIC

public static final int ASCII_TO_EBCDIC
Specifies translation direction for translateBuffer(): ASCII to EBCDIC

See Also:
Constant Field Values

EBCDIC_TO_ASCII

public static final int EBCDIC_TO_ASCII
Specifies translation direction for translateBuffer(): EBCDIC to ASCII

See Also:
Constant Field Values

SCREEN_FORMATTED

public static final int SCREEN_FORMATTED
Specifies that one or more fields are defined for the current screen.

See Also:
getScreenMode(), Constant Field Values

SCREEN_UNFORMATTED

public static final int SCREEN_UNFORMATTED
Specifies that no fields are defined for the current screen.

See Also:
Constant Field Values

SCREEN_UNFORMATTED_CHAR

public static final int SCREEN_UNFORMATTED_CHAR
Specifies that no fields are defined for the current screen and data is sent to the host character by character and simultaneously displayed on the local screen.

See Also:
Constant Field Values

SEARCH_BACKWARD

public static final int SEARCH_BACKWARD
Specifies the search direction for the findString method.

See Also:
findString, Constant Field Values

SEARCH_FORWARD

public static final int SEARCH_FORWARD
Specifies the search direction for the findString method.

See Also:
findString, Constant Field Values
Constructor Detail

GlinkApi

public GlinkApi()
Constructs a new empty GlinkApi object.

See Also:
GlinkApi(Applet applet)

GlinkApi

public GlinkApi(java.applet.Applet applet)
Constructs a new empty GlinkApi object from an applet. Use this contructor if the GlinkApi object is created from an applet.


GlinkApi

public GlinkApi(GlinkApi anotherApi)
Constructs a GlinkApi object that will inherit configuration parameters from another GlinkApi object. The parameters inherited are those that can be placed in glink.ini and/or in the <PARAM> tags of the HTML page used to load Glink. To pick up glink.ini parameters, the GlinkApi object passed in anotherApi must be started. Of particular interest are user.name, user.password, config.name, config.language.

Parameters:
anotherApi - -- the API from which this API will inherit parameters
Method Detail

addConfiguration

public void addConfiguration(GlinkConfiguration glinkConfiguration)
Adds the configuration to the list of available sessions.

Restricted

See Also:
sessionName, GlinkConfiguration

addGlinkEventListener

public void addGlinkEventListener(GlinkEventListener listener)
Specifies the listener which is to receive Glink events.

See Also:
GlinkEvent

configBase

public void configBase(java.lang.String configBase)
Sets the Glink configuration directory when running without a Glink Config Server. The configuration directory is located in a subdirectory to the directory where 'glink.jar' is installed. The default name of this configuration directory is 'config'. Normally there should be no need to use this method. Just make sure that 'glink.jar' is specified in the class path directive with a path name, for example 'd:\glinkj\glink.jar'.

Restricted

Parameters:
configBase - The path to the location where the Glink configuration directory is placed, for example: GlinkApi.configBase("D:\\glinkj\\config");

configLanguage

public void configLanguage(java.lang.String lkey)
Specifies the language file to use for fixed texts. This determines the language used in menus, dialogs, message boxes and status line. Normally the value should be a two-letter abbreviation specifying the language; the default value is us. Glink looks for a file glink_xx.txt, where xx is the value of this parameter, in the .../no/gar/data directory.

Restricted

Parameters:
lkey - The 2-letter language key to use. Default is "us".

configServer

public void configServer(java.lang.String address)
Specifies the IP address or host name of the computer where the Glink server is installed and running. If configServer is not set, Glink assumes that the configuration server is running on the same computer as Glink. To run Glink without a Config Server, specify "none" as the server address.

Restricted

Parameters:
address - The address may be specified as: hostname.yourcompany.com or 123.234.123.1 or none

connect

public void connect()
Connects to the session specified with the sessionName() method. At startup Glink automatically connects to the session specified with the sessionName method.

Restricted

See Also:
sessionName

createApi

public static final GlinkApi createApi(java.applet.Applet ap,
                                       boolean debug)
Create a regular or debug enabled GlinkApi object from an Applet.

Parameters:
ap - Applet handle
debug - if true, an object of type GlinkApiDebug is created
Returns:
GlinkApi or GlinkApiDebug handle depending on the value of the argument

createApi

public static final GlinkApi createApi(boolean debug)
Create a regular or debug enabled GlinkApi object.

Parameters:
debug - if true, an object of type GlinkApiDebug is created
Returns:
GlinkApi or GlinkApiDebug handle depending on the value of the argument

createApi

public static final GlinkApi createApi(GlinkApi nother,
                                       boolean debug)
Create a regular or debug enabled GlinkApi object from another GlinkApi object.

Parameters:
nother - another GlinkApi object used as a template
debug - if true, an object of type GlinkApiDebug is created
Returns:
GlinkApi or GlinkApiDebug handle depending on the value of the argument

debugStart

public void debugStart(java.io.PrintWriter debugStream)
Start or restart Glink debugging, send output to a stream. If debug was already running it is restarted, and subsequent debugging output is sent to debugStream. If debugging wasn't running it is started.

Restricted

Parameters:
debugStream - destination stream for debug output
See Also:
debugStop()

debugStop

public void debugStop()
Stop Glink debugging.

Restricted

See Also:
debugStart(java.io.PrintWriter)

disconnect

public void disconnect()
Disconnects the current session.

Restricted


emulate

public void emulate(java.lang.String hostData)
This method emulates a string locally. The string may be simple text or contain emulation escape sequences. Normally this command will be used to process host data obtained with the messageModeReceive method when the "processHostData" parameter in the messageModeOn method is set to FALSE.

See Also:
messageModeOn()

fieldRead

public java.lang.String fieldRead(int fieldNum)
Returns the data for the given variable field.

Parameters:
fieldNum - The variable field number where 1 is the first variable field and 0 means the current field.
Returns:
The field value.

fileBase

public void fileBase(java.lang.String fileBase)
Sets the Glink file base directory. Glink needs some files located in the 'no' directory, normally located as a subdirectory of the directory where the 'glink.jar' file is found. There should be no need to use this method, the default file base directory is where the 'glink.jar' file is found. Just make sure that the 'glink.jar' is specified in the class path directive with a path name, for example 'd:\glinkj\glink.jar'.

Restricted

Parameters:
fileBase - The path to the location where the Glink 'no' directory is placed, for example: GlinkApi.fileBase("D:\\glinkj"); GlinkApi.fileBase("http://www.gar.no/glinkj");

findString

public java.awt.Point findString(java.lang.String string,
                                 java.awt.Point start,
                                 int length,
                                 int direction,
                                 boolean caseSensitive)
Searches the text plane for the given string. Null characters in the text plane are treated as spaces during search processing.

Parameters:
string - The string for which to search.
start - The row and column in which to start. The position is inclusive (for example, row 1, col 1 means that position 1,1 will be used as the starting location and 1,1 will be included in the search).
length - The length from startPos to include in the search.
direction - Search direction value:

Constant Value Description
SEARCH_FORWARD 0 Forward (beginning towards end)
SEARCH_BACKWARD 1 Backward (end towards beginning)

caseSensitive - Indicates whether the search is to be case sensitive. True means the search will be case sensitive.
Returns:
If found, returns a Point object containing the location. If not found, returns a null. The string must be completely contained by the target area for the search to be successful.

flushGlinkEvents

public void flushGlinkEvents()
Flushes the GlinkEvent queue. Any GlinkEvents queued are removed from the queue.

See Also:
getGlinkEvent(int, long), queueGlinkEvents(boolean)

getAttributes

public int[] getAttributes(java.awt.Point start,
                           int len)
Returns the attributes for the target area

Parameters:
start - The row and column in which to start.
len - The length (number of attributes integer) from startPos.
See Also:
Attribute format.

getAttributes

public int[] getAttributes(java.awt.Point start,
                           java.awt.Point end)
Returns the attributes for the target area

See Also:
getAttributes(java.awt.Point, int), Attribute format.

getAvailableSessions

public java.util.Vector getAvailableSessions()
Returns the sessions configured. Please note that if this method is called before Glink has started, the user name, password and either configserver or Glink directory must be set prior this call or must have been configured in glink.ini (except Glink directory), otherwise "null" will be returned and a GlinkEvent.ERROR_DETECTED will be posted.

Restricted

See Also:
getAvailableSessions(), userName(java.lang.String), userPassword(java.lang.String), configServer(java.lang.String), serverPort(java.lang.String), setGlinkDirectory(java.lang.String), GlinkEvent.VE_SESSIONS_ERROR

getBackgroundColor

public int getBackgroundColor(int attribute)
Returns the RGB value for the given field or character attribute. The color returned is affected by the Glink screen color settings for the current session.

Returns:
The RGB value (Bits 24-31 are 0xff, 16-23 are red, 8-15 are green, 0-7 are blue)
See Also:
GlinkField

getColumns

public int getColumns()
Returns the number of columns in the presentation space.

Returns:
The number of columns.

getCommunicationProtocol

public int getCommunicationProtocol()
Returns the current communication protocol.

Returns:
the communication protocol value defined int the GlinkConfiguration class or -1 if Glink is not connected.
See Also:
GlinkConfiguration

getConfigParameter

public java.lang.String getConfigParameter(java.lang.String name)
Returns the value as a string for the specified parameter name. For example; getConfigParameter("screen.fontsize") may return the string "16" or getConfigParameter("emu.vipinittext") may return the string "false".

Returns:
Returns the configuration parameter as a string value or null if the name is not defined or Glink is not started
See Also:
setParameter

getCursor

public java.awt.Point getCursor()
Returns the current cursor position.

Returns:
The cursor position.

getDataBytes

public byte[] getDataBytes(java.awt.Point start,
                           int len)
Returns the screen characters (bytes) for the target area in the configured character set


getDataBytes

public byte[] getDataBytes(java.awt.Point start,
                           java.awt.Point end)
Returns the screen characters (bytes) for the target area in the configured character set


getDataChars

public char[] getDataChars(java.awt.Point start,
                           int len)
Returns the screen characters for the target area

Parameters:
start - The row and column in which to start. The position is inclusive (for example, row 1, col 1 means that position 1,1 will be used as the starting location and 1,1 will be included in the data).
len - The length of the target area.
Returns:
The screen characters at the given location

getDataChars

public char[] getDataChars(java.awt.Point start,
                           java.awt.Point end)
Returns the screen characters for the target area

Parameters:
start - The row and column in which to start. The position is inclusive (for example, row 1, col 1 means that position 1,1 will be used as the starting location and 1,1 will be included in the data).
end - The row and column in which to end. The position is inclusive (for example, row 10, col 12 means that position 10,12 will be used as the ending location and 10,12 will be included in the data).
Returns:
The screen characters at the given location

getDataLength

public int getDataLength(java.awt.Point start,
                         java.awt.Point end)
Returns the length for the target area.


getDefaultColorAttribute

public int getDefaultColorAttribute()
Returns the default color attribute settings.

For example, the following call gets the RGB value for the default background color:
getBackgroundColor(getDefaultColorAttribute());

Returns:
Returns the default color attribute settings. The foreground color is given in bits 0-3 the and background color is given in bits 4-6.
See Also:
Attribute format., getForegroundColor(int), getBackgroundColor(int)

getEmulationType

public int getEmulationType()
Returns the current emulation type.

Returns:
the emulation type value defined int the GlinkConfiguration class or -1 if Glink is not connected.
See Also:
GlinkConfiguration

getFields

public GlinkFields getFields()
Returns the GlinkFields object associated with the current screen. GlinkFields contains all the fields in the current screen. For unformatted screens, the returned object contains only one input field that contains the whole presentation space.


getFieldsEx

public GlinkFields getFieldsEx()
Returns the GlinkFields object associated with the current screen. GlinkFields contains all the fields in the current screen. For formatted screens, this method will return the very same as the getFields() method.

For unformatted screens where no fields are defined, this method will simulate that one or more fields are defined. For VIP and DKU emulations set in text mode, an input field will be defined from the position of the cursor to the end of the line. For emulations running in character mode like VT, an input field will be defined from the cursor position. The end of this field will be on the same line but will depend of the line contents and attributes.

The rest of the screen will be presented as a fixed field. The result will often be that three fields are defined for the screen (one fixed field, one variable field and another fixed field at the end).


getForegroundColor

public int getForegroundColor(int attribute)
Returns the RGB value for the given field or character attribute. The color returned is affected by the Glink screen color settings for the current session.

Returns:
The RGB value (Bits 24-31 are 0xff, 16-23 are red, 8-15 are green, 0-7 are blue)
See Also:
GlinkField

getGlinkContainer

public java.awt.Container getGlinkContainer()
Returns the object that contains all the visible Glink components. Normally Glink starts up in its own frame. However, if you want to include Glink in a panel within your own frame, use this call to get hold of the Glink container and add it to the panel. Please note that Glink must be startet and set not visible (glink.setVisible(false)) prior using this call.

Returns:
The Glink container or null if the Glink frame is visible or the GlinkEvent.STARTED has not yet been posted.
See Also:
setVisible(boolean), isVisible(), start(), GlinkEvent.STARTED

getGlinkEvent

public GlinkEvent getGlinkEvent(int eventCode,
                                long timeout)
Returns the first GlinkEvent available from the GlinkEvent queue. Use the queueGlinkEvents method to enable GlinkEvents queuing. The GlinkEvents queuing can be used instead of a GlinkEvent listener to get hold of GlinkEvents.

If the eventCode parameter is set to 0, the first available GlinkEvent is returned. If the eventCode is set to a valid GlinkEvent code, then other GlinkEvents queued are flushed and the specified GlinkEvent is returned if available.

The GlinkEvent.TURN_LOST event is ignored and not reported by this method.

Parameters:
eventCode - The GlinkEvent code to wait for or 0 to wait for any.
timeout - Specifies the number of milliseconds to wait for GlinkEvents if not available or 0 if no waiting.
Returns:
First available GlinkEvent or null if no GlinkEvent is available.
See Also:
queueGlinkEvents(boolean), flushGlinkEvents(), GlinkEvent, addGlinkEventListener(no.gar.glink.api.GlinkEventListener)

getGlinkFrame

public java.awt.Frame getGlinkFrame()
Returns the Glink frame. The Glink frame is a top-level window with a title and a border. If you want to add the Glink screen to your own frame, use the getGlinkContainer method.

Returns:
The Glink frame or null if the GlinkEvent.STARTED has not yet been posted.
See Also:
getGlinkContainer()

getGlinkVersion

public java.lang.String getGlinkVersion()
Returns the Glink version information as a text string.


getInteractiveComParams

public java.util.Vector getInteractiveComParams()
Returns the interactive communication parameters. This method should be called only if the following event is posted:
 GlinkEvent.INTERACTIVE_COM_PARAMS_REQUESTED
The Ggate and DSA communication modules may be configured with parameters that should be supplied or modified by the user when connecting to the host application. These parameters are referred to as interactive communication parameters. If the current communication module is configured with such interactive parameters and Glink itself is not visible (glink.setVisible(false)), then the GlinkEvent.INTERACTIVE_COM_PARAMS_REQUESTED is posted. The GlinkApi application should then call the getInteractiveComParams method to get the interactive parameters in question, modify the parameter values and set the interactive parameters with the setInteractiveComParams method call.

The getInteractiveComParams returns a vector with one element per interactive parameter. Each element is a string array of 3. The first string contains the short name of the parameter, the second the long name and the third the actual parameter value. For example a parameter may have "pw" as the short name, "Password" as the long name and an empty string as the parameter value. Below is a code example where one of the parameter ("pw") is modified if present.

       Vector v = glink.getInteractiveComParams();
       String param[];
       for (int i = 0; i < v.size(); i++) {
           param = (String[])v.elementAt(i);
           if (param[0].equals("pw")) {
               params[2] = "mypassword";
               v.set(i,param);
           }
       }
       glink.setInteractiveComParams(v);
 

Returns:
A vector with one element per interactive config parameter.
See Also:
setInteractiveComParams(java.util.Vector), GlinkEvent.INTERACTIVE_COM_PARAMS_REQUESTED

getMarkedScreenArea

public GlinkScreenArea getMarkedScreenArea()
Returns a screen area object for the current screen selection. The method checks the current screen and if any text is marked, returns a GlinkScreenArea object for the marked text. Please note that Glink supports two modes of marking; marking done on a line-by-line basis and rectangular marking. Use the GlinkScreenArea.isRectangle() to check the marking mode used.

Returns:
A GlinkScreenArea object describing the marked area or null if no text has been marked.
See Also:
getScreenArea(java.awt.Point, java.awt.Point, boolean), isScreenAreaMatch(no.gar.glink.api.GlinkScreenArea)

getProperty

public java.lang.String getProperty(java.lang.String key)
Returns the the property for the given key.

Returns:
Returns the property or null if the key is not defined or Glink is not started

Key Description
device Returns the allocated LU name for TN3270E or the device name for TN5250

getRows

public int getRows()
Returns the number of rows in the presentation space.

Returns:
The number of rows.

getScreenArea

public GlinkScreenArea getScreenArea(java.awt.Point start,
                                     java.awt.Point end,
                                     boolean rectangle)
Returns an object for the given screen area or null if the positions given are not within the current screen.

Parameters:
start - The row and column in which to start. The position is inclusive (for example, row 1, col 1 means that position 1,1 will be used as the starting location and 1,1 will be included in the data).
end - The row and column in which to end. The position is inclusive (for example, row 10, col 12 means that position 10,12 will be used as the ending location and 10,12 will be included in the data).
rectangle - Supply true to get a rectangle area and false to get an area that is on a line-by-line basis from the given start position.
Returns:
A GlinkScreenArea object for the given area
See Also:
getMarkedScreenArea(), notifyScreenArea, isScreenAreaMatch(no.gar.glink.api.GlinkScreenArea)

getScreenCharacterSet

public java.lang.String getScreenCharacterSet()
Returns the name of the character set configured. The character set is used to transform between 8 bits character and 16 Unicode characters The default value returned is null which means that no character set is configured. The ISO-8859-1 standard will be used in this case.


getScreenMode

public int getScreenMode()
If the host application has used field attributes to define fields on the screen, then the current screen is formatted. If there are no fields defined, then the current screen is unformatted.

Returns:
The screen mode for the current screen (SCREEN_FORMATTED, SCREEN_UNFORMATTED or SCREEN_UNFORMATTED_CHAR).
See Also:
SCREEN_FORMATTED, SCREEN_UNFORMATTED, SCREEN_UNFORMATTED_CHAR

getSessionName

public java.lang.String getSessionName()
Returns the name of the current session


getString

public java.lang.String getString()
Returns the entire text plane of the presentation space as a string. All null characters and Field Attribute characters are returned as space characters.

Returns:
The entire text plane as a string

getString

public java.lang.String getString(java.awt.Point start,
                                  java.awt.Point end)
Returns the text at the given location in the presentation space as a string. All null characters and Field Attribute characters are returned as space characters.

Parameters:
start - The row and column in which to start. The position is inclusive (for example, row 1, col 1 means that position 1,1 will be used as the starting location and 1,1 will be included in the data).
end - The row and column in which to end. The position is inclusive (for example, row 10, col 12 means that position 10,12 will be used as the ending location and 10,12 will be included in the data).
Returns:
The text as a string at the given location

getVariableFields

public GlinkFields getVariableFields()
Returns the GlinkFields object associated with the current screen with variable fields only. In other words only unprotected fields are contained in the returned GlinkFields object. For unformatted screens, the returned object contains only one GlinkField item that contains the whole presentation space.


getVariableFieldsEx

public GlinkFields getVariableFieldsEx()
Returns the GlinkFields object associated with the current screen with variable fields only. In other words only unprotected fields are contained in the returned GlinkFields object. For formatted screens, this method will return the very same as the getVariableFields() method.

For unformatted screens where no fields are defined, this method will simulate that one input field is defined. For VIP and DKU emulations set in text mode, an input field will be defined from the position of the cursor to the end of the line. For emulations running in character mode like VT, an input field will be defined from the cursor position. The end of this field will be on the same line but will depend of the line contents and attributes.


isConnected

public boolean isConnected()
Returns true if Glink is connected to a session.


isScreenAreaMatch

public boolean isScreenAreaMatch(GlinkScreenArea sa)
Returns true if the supplied GlinkScreenArea object matches the current screen.

See Also:
getScreenArea(java.awt.Point, java.awt.Point, boolean)

isSessionAvailable

public boolean isSessionAvailable(java.lang.String name,
                                  java.util.Vector sessions)
Returns true if the given session is available.

Restricted

See Also:
getAvailableSessions()

isSplashScreenVisible

public boolean isSplashScreenVisible()
Returns true if the splash screen is visible.

See Also:
setSplashScreenVisible(boolean)

isStarted

public boolean isStarted()
Returns true if Glink has started.

See Also:
start()

isTurnKnown

public boolean isTurnKnown()
Returns true if Glink is connected to a host and the communication module in use knows about which side has the turn to send, either the host side or the Glink side. When isTurnKnown() returns true, the Glink communication module signals the turn to the GlinkApi application with the GlinkEvent.TURN_LOST and GlinkEvent.TURN_RECEIVED event flags.

Communication modules such as ComTN3270, ComTN5250, ComGgate ComDSA and ComTNVIP all know about the turn, whereas ComTelenet and ComMinitel do not.

See Also:
GlinkEvent.TURN_LOST, GlinkEvent.TURN_RECEIVED, isTurnReceived()

isTurnReceived

public boolean isTurnReceived()
Returns true if this side has the turn to send data.

See Also:
isTurnKnown()

isVisible

public boolean isVisible()
Returns true if the Glink screen (frame) is visible.

See Also:
//PRO_BEGIN, //PRO_END

markScreenArea

public void markScreenArea(java.awt.Point start,
                           java.awt.Point end,
                           boolean rectangle)
This method marks the given screen area. Glink supports two modes of marking; marking done on a line-by-line basis and rectangular marking.

Parameters:
start - The starting position (1,1 is the upper left corner). Screen marking is removed by supplying an invalid screen position , for example (0,0).
end - The ending position (80,24 is the end of the screen).
rectangle - Sets the marking mode to be used.
See Also:
getMarkedScreenArea()

messageModeBufferOverwrite

public void messageModeBufferOverwrite(boolean overwrite)
Specifies if the message mode receive buffer may be overwritten if the limit of the buffer is reached. When the message mode receive buffer has reached its limit, the line module will by default be suspended until a message mode receive call has been issued to clear the buffer so more data can be accepted. If you allow the message mode receive buffer to be overwritten, the line module will clear the buffer and continue to receive the rest of the data without any delay.

Parameters:
overwrite - if true, Glink overwrites the message mode receive buffer when it has reached its limit, if false, Glink waits until one of the messageModeReceive methods are called to clear the buffer.

messageModeOff

public void messageModeOff()
This method turns message mode off.

Restricted


messageModeOn

public void messageModeOn()
This method instructs Glink to start message mode operation. In message mode, all characters received from the host will be stored as "raw" data and made available to the application with either the messageModeReceive or messageModeReceiveSync calls. The Glink emulation itself is bypassed.

The default buffer size set by this method is 2048 bytes.

Restricted

See Also:
messageModeOn(int bufsize, boolean processHostData)

messageModeOn

public void messageModeOn(int bufsize,
                          boolean processHostData)
This method instructs Glink to start message mode operation. In message mode, all characters received from the host will be stored as "raw" data and made available to the application with either the messageModeReceive or messageModeReceiveSync calls.

Parameters:
bufsize - Size of the buffer where the incoming characters are stored. The buffer is cleared with the messageModeReceive or messageModeReceiveSync calls. If the buffer reaches its limit, the line modul will be suspended until a receive call is issued to clear the buffer.
processHostData - Tells Glink to pass the received characters to the Glink emulation class when set to true. When set to false, the characters are stored in the message mode buffer only and the Glink emulation is bypassed.

Restricted

See Also:
messageModeReceive(), messageModeReceiveSync(), messageModeReceiveSync(int maxlen), messageModeBufferOverwrite(boolean), emulate(java.lang.String)

messageModeReceive

public java.lang.String messageModeReceive()
This method returns the string of characters received from the host since the last time this method was called. Glink must be in message mode operation for this call to return any data. The returned string is always in Unicode, regardless of the host character set.

Returns:
The string of character received or null if no data is available
See Also:
messageModeReceiveSync(), messageModeReceiveBytes(), messageModeReceiveBytesSync(), GlinkEvent.MESSAGE_MODE_DATA, emulate(java.lang.String)

messageModeReceiveBytes

public byte[] messageModeReceiveBytes()
This method returns the byte array received from the host since the last time this method or messageModeReceive() was called. Glink must be in message mode operation for this call to return any data. The returned byte array is always in the host native character set.

Returns:
an array of bytes received from the host, or null if no data available.
See Also:
messageModeReceive(), messageModeReceiveSync(), messageModeReceiveBytesSync(), GlinkEvent.MESSAGE_MODE_DATA, emulate(java.lang.String)

messageModeReceiveBytesSync

public byte[] messageModeReceiveBytesSync()
This method waits until the turn has been received from the host and then returns the byte array of characters received, in the host native character set.

The method will check the turn first and if turn is at the host side, it will wait until the turn has been received from the host before it returns the bytes received from the host since the last time this method was called. Glink must be in message mode operation for this call to return any data.

If the message mode receive buffer has reached its limit before the turn has been received, the call will return with the first part of data received and more messageModeReceiveBytesSync() calls must be issued to get the rest of the data.

Returns:
array of host data bytes, or null if no data is available.
See Also:
GlinkEvent.MESSAGE_MODE_DATA, messageModeOn(), isTurnKnown(), isTurnReceived(), messageModeReceive(), messageModeReceiveBytes(), messageModeReceiveSync()

messageModeReceiveBytesSync

public byte[] messageModeReceiveBytesSync(int maxlen)
This method waits until the requested number of characters has been received from the host before it returns these.

The method will check the turn first and if the turn is at the host side, it will wait until the requested number of characters has been received from the host and return these as a byte array. If less characters have been received when turn is received, then these characters are returned. When no more data is available, a null pointer is returned.

If the message mode receive buffer has reached its limit before the number of requested characters has been received, the message mode receive buffer is automatically adjusted.

The returned data is in the host native character set.


messageModeReceiveSync

public java.lang.String messageModeReceiveSync()
This method waits until the turn has been received from the host and then returns the string of characters received.

The method will check the turn first and if turn is at the host side, it will wait until the turn has been received from the host before it returns the string of characters received from the host since the last time this method was called. Glink must be in message mode operation for this call to return any data. The returned data is always ASCII/UNICODE.

If the message mode receive buffer has reached its limit before the turn has been received, the call will return with the first part of data received and more messageModeReceiveSync() calls must be issued to get the rest of the data.

Returns:
The string of character received or null if no data is available
See Also:
GlinkEvent.MESSAGE_MODE_DATA, messageModeOn(), isTurnKnown(), isTurnReceived(), messageModeReceive(), messageModeReceiveBytes(), messageModeReceiveBytesSync()

messageModeReceiveSync

public java.lang.String messageModeReceiveSync(int maxlen)
This method waits until the requested number of characters has been received from the host before it returns these.

The method will check the turn first and if the turn is at the host side, it will wait until the requested number of characters has been received from the host and return these as a string. If less characters have been received when turn is received, then these characters are returned. When no more data is available, a null pointer is returned.

If the message mode receive buffer has reached its limit before the number of requested characters has been received, the message mode receive buffer is automatically adjusted.

The returned data is always Unicode, regardless of the host native character set.


messageModeSend

public void messageModeSend(java.lang.String s)
This method bypasses the Glink emulation and sends the string directly to the host. The turn is passed to the host.

The data is assumed to be a Unicode string. It is translated to the host native character set before transmission.

See Also:
messageModeSend(String s,boolean passTurn)

messageModeSend

public void messageModeSend(java.lang.String s,
                            boolean passTurn)
This method bypasses the Glink emulation and sends a string directly to the host. Several strings of data may be sent without giving up the turn. The passTurn flag is used to signal that this is the end of the data and that the turn should be passed to the host side.

The data is assumed to be an Unicode string. It is translated to the host native character set before transmission.

Turn issues
Please note that the concept of turn is only well defined for the following communications protocols:

For other communications protocols (such as Telnet, raw TCP/IP and Minitel) the passTurn argument is ignored. In these cases you may have to add a go-ahead indicator to your data if you want to pass the turn to the host, such as ETX (0x03) or Carriage Return (0x0D).

Parameters:
s - string to send to the host
passTurn - true if turn is to be passed to the host, false if not (see above).

messageModeSendBytes

public void messageModeSendBytes(byte[] s,
                                 int offset,
                                 int len)
This method bypasses the Glink emulation and sends a byte array directly to the host. The turn is passed to the host.

The data is assumed to be in the host native character set.

Parameters:
s - the data buffer
offset - starting offset to send from
len - number of bytes to send
See Also:
messageModeSendBytes(byte[] s,int offset,int len,boolean passTurn)

messageModeSendBytes

public void messageModeSendBytes(byte[] s,
                                 int offset,
                                 int len,
                                 boolean passTurn)
This method bypasses the Glink emulation and sends a byte array directly to the host. Several data buffers may be sent without giving up the turn. The passTurn flag is used to signal that this is the end of the data and that the turn should be passed to the host side.

The data is assumed to be in the host native character set.

Turn issues
Please note that the concept of turn is only well defined for the following communications protocols:

For other communications protocols (such as Telnet, raw TCP/IP and Minitel) the passTurn argument is ignored. In these cases you may have to add a go-ahead indicator to your data if you want to pass the turn to the host, such as ETX (0x03) or Carriage Return (0x0D).

Parameters:
s - the data buffer
offset - starting index to send from
len - number of bytes to send
passTurn - true if turn is to be passed to the host, false if not (see above).

notifyCommandKey

public void notifyCommandKey(int commandKey)
Instructs Glink to fire a GlinkEvent.COMMAND_KEY_TYPED event when the given command key is typed. This command key will then be ignored by Glink. For the command key to be processed by Glink, send the command key back to Glink with the sendCommandKey method when notified.

Several command keys may be marked for notification. To be notified for all command keys, set the commandKey parameter to -1.

Parameters:
commandKey - The command key for which notifications are to be sent.
See Also:
GlinkKey, removeNotifyCommandKey(int), GlinkEvent.COMMAND_KEY_TYPED

notifyDataBlocks

public void notifyDataBlocks(boolean enable)
Turns on of off posting of GlinkEvent.DATA_BLOCK events. The GlinkEvent.DATA_BLOCK event is normally not needed, you should wait for the TURN_RECEIVED before processing the received data.

See Also:
GlinkEvent.DATA_BLOCK

notifyKey

public void notifyKey(int key)
Instructs Glink to fire a GlinkEvent.KEY_TYPED event when the given key is typed. This key will then be ignored by Glink. For the key to be processed by Glink, send the key back to Glink with the sendKeys method when the notification is received.

Several keys may be marked for notification. To receive notification for every key typed, set the commandKey parameter to -1.

Parameters:
key - The key to be notified.
See Also:
removeNotifyKey(int), GlinkEvent.KEY_TYPED

notifyScreenArea

public void notifyScreenArea(GlinkScreenArea screenArea,
                             int identity,
                             boolean removeAfterwards)
Instructs Glink to fire a GlinkEvent.SCREEN_AREA_MATCH event when the given object matches the current screen. Several objects may be waited for, each with its own identity value. The objects are checked each time Glink receives the turn. For some host connections turn signals are not generated. Use the isTurnKnown() method to check if the current connection gives turn signals.

Parameters:
screenArea - The object that describes the screen area to be checked. When the object matches the current screen the caller will be notified.
identity - Select a positive number to identify this object when being reported. This value will be supplied with the GlinkEvent object (getValue method) to identify which screenArea object matches the current screen. If several objects match the current screen, a notification will be given for each of them.
removeAfterwards - Specifies whether the object should be removed from the notification list or not after the notification has been given for the object. For peformance reasons remove objects that are not in use anymore.
See Also:
removeNotifyScreenArea(int), isTurnKnown(), GlinkEvent.getValue()

notifyString

public void notifyString(java.lang.String string,
                         boolean caseSensitive,
                         int identity,
                         boolean removeAfterwards)
Instructs Glink to fire a GlinkEvent.STRING_RECEIVED event when the given string is received from host. Several strings may be waited for, each with its own identity value. The check is preformed before the received data is processed by the emulation module of Glink. Use the notifyScreenArea method instead if you want the check to be performed after the received data has been processed by Glink.

Parameters:
string - The string for which a notification is to be sent.
caseSensitive - Specifies if the match is to be case sensitive.
identity - Select a positive number to identify this string. This value will be supplied with the GlinkEvent object (getValue method) to identify which string the notification is for.
removeAfterwards - Specifies whether the string should be removed from the notification list after the string has been received from host and the notification has been sent. The string may also be removed from the list with the removeNotifyString call.
See Also:
removeNotifyString(int), GlinkEvent.getValue(), notifyScreenArea

noToolbar

public void noToolbar()
This method instructs Glink to start without a toolbar and keybar. Also, when this option is set, no images are loaded at all to save memory and reduce startup time.


queueGlinkEvents

public void queueGlinkEvents(boolean enable)
Enables or disables the queuing of GlinkEvents. GlinkEvents queuing can be used instead of a GlinkEvent listener to get hold of GlinkEvents. Use the getGlinkEvent method to get hold of GlinkEvents queued.

See Also:
getGlinkEvent(int, long), flushGlinkEvents(), addGlinkEventListener(no.gar.glink.api.GlinkEventListener)

removeConfiguration

public void removeConfiguration(GlinkConfiguration glinkConfiguration)
Removes the configuration previously set with the addConfiguration method.

Restricted

See Also:
addConfiguration(no.gar.glink.api.GlinkConfiguration)

removeGlinkEventListener

public void removeGlinkEventListener(GlinkEventListener listener)
Removes the specified listener set with the addGlinkEventListener method.

See Also:
addGlinkEventListener(no.gar.glink.api.GlinkEventListener)

removeNotifyCommandKey

public void removeNotifyCommandKey(int commandKey)
Removes the notification for the command key previously set with the notifyCommandKey method. If the commandKey param is -1, all command key notifications are removed.

See Also:
notifyCommandKey(int), GlinkKey

removeNotifyKey

public void removeNotifyKey(int key)
Removes the notification for the key previously set with the notifyKey method. If the key param is -1, all key notifications are removed.

See Also:
notifyKey(int)

removeNotifyScreenArea

public boolean removeNotifyScreenArea(int identity)
Removes the GlinkScreenArea object associated with the given identity from the list of objects being checked for a match. If you only want to be notified the first time the object matches the current screen, you may set the "removeAfterwards" parameter in the notifyScreenArea call itself rather than using this call.

Parameters:
identity - Identifies the GlinkScreenArea object to be removed. To remove all of the GlinkScreenArea notification objects set, supply -1 for the identity.
Returns:
True if the object with the given identity is found, otherwise false.
See Also:
notifyScreenArea

removeNotifyString

public boolean removeNotifyString(int identity)
Removes the string associated with the given identity from the list of strings being checked for. If you only want to be notified the first time the string is received from the host, you may set the "removeAfterwards" parameter in the notifyString call itself rather than using this call.

Parameters:
identity - Identifies the string to be removed. To remove all of the string notifications set, supply -1 for the identity.
Returns:
True if the string with the given identity is found, otherwise false.
See Also:
notifyString(java.lang.String, boolean, int, boolean)

requestFocus

public void requestFocus()
Requests that the Glink screen component get the input focus.


restoreScreenContent

public boolean restoreScreenContent(java.lang.String fileName)
Restores the screen previously saved. The operation will fail if the given file does not exists, the file has not been created by the saveContentScreen method or the current emulation type does not match the saved one.

Parameters:
fileName - Specify file name or file path
Returns:
If the operation fails, a GlinkEvent.ERROR_DETECTED will be posted with the error type code GlinkEvent.VE_EMULATION_ERROR and additional error type text.
See Also:
saveScreenContent(java.lang.String)

saveScreenContent

public boolean saveScreenContent(java.lang.String fileName)
Saves the current screen content to the file specified. The file will be created if is does not exist, else it will be overwritten. All data necessary to recreate the screen is saved. The screen is recreated with the restoreScreenContent method.

Parameters:
fileName - Specify file name or file path
Returns:
Return false if the operation fails. In addition, a GlinkEvent.ERROR_DETECTED will be posted with the error type code GlinkEvent.VE_EMULATION_ERROR and additional error type text.
See Also:
restoreScreenContent(java.lang.String)

scriptCommand

public void scriptCommand(java.lang.String command)
Activates the given script command.


scriptFile

public void scriptFile(java.lang.String fileName)
Activates the given script file.

Parameters:
fileName - If the script is stored with the Glink Config Server specify: "server://filename" otherwise supply a full path name.

scriptTerminate

public void scriptTerminate()
Terminates the current script.


sendCommandKey

public void sendCommandKey(int key)
The sendCommandKey method sends a "command" keystroke to the virtual screen. These command keys can be thought of as special keystrokes, like the Enter key, the Tab key or the Page Up key. All valid special key values are contained in the GlinkKey class.

See Also:
GlinkKey

sendKeys

public void sendKeys(java.lang.String text)
Sends a string to the emulator starting at the current cursor location. The sendKeys method sends a string of keys to the virtual screen. This method acts as though keystrokes were being typed from the keyboard.

See Also:
setString(java.lang.String, java.awt.Point)

sendKeys

public void sendKeys(java.lang.String text,
                     java.awt.Point location)
Sends a string to the emulator starting at the given cursor location. The sendKeys method sends a string of keys to the virtual screen. This method acts as though keystrokes were being typed from the keyboard.

See Also:
setString(java.lang.String, java.awt.Point)

sendMacro

public void sendMacro(java.lang.String macro)
Sends a string of characters and control characters to the emulator starting at the current cursor location. The syntax for the control characters is the same as the one used to define keyboard macros; a caret following by a letter. For example, ASCII Cr control character is defined with ^M or ^$0D (hex) or ^#013. ASCII Lf control character is defined with ^J or ^$0A (hex) or ^#010.


serverPort

public void serverPort(java.lang.String port)
Set the IP port on which to connect to the Glink server.

Restricted

Parameters:
port - decimal port number.

sessionName

public boolean sessionName(java.lang.String name)
Specifies the name of the session to which Glink should connect. If the session is not specified, Glink will bring up the Glink Session dialog box for the user to make a selection.

Restricted

Parameters:
name - name of configuration profile.
Returns:
true if session name was found, otherwise false.

setCursor

public void setCursor(int x,
                      int y)
Moves the cursor to the given position.

See Also:
getCursor()

setCursor

public void setCursor(java.awt.Point location)
Moves the cursor to the given position.

See Also:
getCursor()

setGlinkDirectory

public void setGlinkDirectory(java.lang.String glinkDir)
Set the Glink directory.

Restricted

Parameters:
glinkDir - Glink directory. glink.ini should be stored here.

setInteractiveComParams

public void setInteractiveComParams(java.util.Vector params)
Sets the interactive communication parameters. This method should be used only if the following event is posted:
 GlinkEvent.INTERACTIVE_COM_PARAMS_REQUESTED
The setInteractiveComParams must be used together with the getInteractiveComParams, see the getInteractiveComParams for the description on how to use these calls.

Parameters:
params - The vector containing the interactive communication parameters. The vector should have been initialized with the getInteractiveComParams method.
See Also:
getInteractiveComParams(), GlinkEvent.INTERACTIVE_COM_PARAMS_REQUESTED

setParameter

public void setParameter(java.lang.String param)
Add a configuration parameter to the glink.ini set. Syntax is "name=value". Calling this method will set the corresponding parameter as if it were entered in glink.ini (or via PARAM tags in the HTML APPLET tag). If the syntax of the argument is invalid, no action occurs.

Restricted

Parameters:
param - String of the form "name=value".

setParentFrame

public void setParentFrame(java.awt.Frame frame)
Normally Glink starts up in its own frame. However, if the GlinkContainer is included in a panel within your own frame, you may set your frame as the parent frame. The only effect this gives is that Glink's own dialog boxes will get a parent frame and remain on top on this when displayed. Please note that Glink must be startet and set not visible (glink.setVisible(false)) prior using this call.

See Also:
getGlinkContainer(), setVisible(boolean), isVisible(), start(), GlinkEvent.STARTED

setRestrictedMode

public boolean setRestrictedMode(java.lang.String key,
                                 int level)
Switch restricted mode on or off. In Restricted mode, methods marked as Restricted will silently do nothing. A key is required to switch restricted mode on, and the same key must be provided to exit restricted mode.

Parameters:
key - this key is memorized when switching restricted mode on, and must match to exit restricted mode.
level - switch restricted mode off if 0, on if != 0.
Returns:
true if operation succeeded, otherwise false.

setScreenSize

public void setScreenSize(int columns,
                          int rows)
For most emulations the screen size is 80 columns times 24 rows. However some emulation modes may use a different size. For Glink to be able to switch between most of the different screen sizes, the default screen size is set to 132 columns times 32 rows, which means that the actual screen size may be less than or equal to this size. For larger screens to be suported you must increase the size. On the other hand, if you plan to run a number of Glink sessions simultaneously and you know the screen size is less than the default, use this method to reduce the memory allocated. The method must be called before the starting the initial Glink session.


setSplashScreenVisible

public void setSplashScreenVisible(boolean visible)
Specifies whether the splash screen should be visible.


setString

public void setString(java.lang.String text,
                      java.awt.Point location)
The setString method sends a string to the virtual screen at the specified location. The string will only overwrite unprotected fields, and any parts of the string which fall over protected fields will be discarded.

Parameters:
text - String to place in the virtual screen.
location - Position where the string should be written.
See Also:
sendKeys(java.lang.String)

setVisible

public void setVisible(boolean visible)
Specifies whether the Glink screen (frame) should be visible or not. //PRO_BEGIN

See Also:
//PRO_END

start

public void start()
Starts Glink. The GlinkEvent.STARTED event code is posted when Glink is started.

Restricted


stop

public void stop()
Stops Glink. The GlinkEvent.STOPPED event code is posted when Glink is stopped.

Restricted

See Also:
start()

suppressTurnLostEvents

public void suppressTurnLostEvents(boolean doSuppress)
Suppress or enable TURN_LOST events from the API.

Parameters:
doSuppress - if true, TURN_LOST events won't be posted.

translateBuffer

public java.lang.String translateBuffer(java.lang.String buffer,
                                        int direction)
Translate a string between ASCII and EBCDIC. This is a utility method for general-purpose use.

Parameters:
buffer - String to translate
direction - how to translate
Returns:
translated string.
See Also:
ASCII_TO_EBCDIC, EBCDIC_TO_ASCII

userName

public void userName(java.lang.String name)
Specifies the user name. If the name is not specified or is not valid, Glink will bring up the Glink Logon dialog box.

Note that this user name is only used to access the Glink configuration database and is not used to log on to the host.

Restricted

Parameters:
name - name of user
See Also:
userPassword(java.lang.String)

userPassword

public void userPassword(java.lang.String password)
Specifies the password for the user.

Note that this password is only used to access the Glink configuration database and is not used to log on to the host. If the password is not specified or is not valid, Glink will bring up the Glink Logon dialog box.

Restricted

Parameters:
password -
See Also:
userName(java.lang.String)