CICS® Transaction Gateway Programming Reference V3.1

com.ibm.ctg.epi
Class ScreenHandler

java.lang.Object
  |
  +--com.ibm.ctg.epi.ScreenHandler
Direct Known Subclasses:
EPIBasicScreenHandler.GeneralScreenHandler

public abstract class ScreenHandler
extends java.lang.Object
implements TerminalEventListener, java.io.Serializable, java.awt.event.ActionListener

This class can be used as a base class for screen handlers. It implements some useful screen handler behaviour:

See Also:
Serialized Form

Field Summary
protected  AID aid
          the screen AID
protected  int cursorCol
          the screen cursor column
protected  int cursorRow
          the screen cursor row
protected  boolean handling
          true if the ScreenHandler is handling the current screen
protected  java.util.Vector listeners
          Vector of ScreenEventListeners to be notified when an event occurs
protected  TerminalSession terminal
          the EPITerminal
 
Constructor Summary
ScreenHandler()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Handles an action event by converting the action command to an AID value and sending the screen to CICS.
 void addScreenEventListener(ScreenEventListener l)
          The specified ScreenEventListener will be called when this ScreenHandler gains control of the screen and again when it loses control.
 void exceptionOccurred(TerminalEvent evt)
          Handles a terminal exception.
 void exitScreen()
          Exit the screen.
 void fireEvent()
          Send appropriate event to all listeners.
 AID getAID()
          Get the current AID value.
 int getCursorColumn()
          Get the cursor column position.
 int getCursorRow()
          Get the cursor row position.
 boolean isHandling()
          Returns true if the ScreenHandler is handling the current screen.
 void removeScreenEventListener(ScreenEventListener l)
          Remove this ScreenEventListener from the internal list.
 void send()
          Send the screen to CICS.
 void setAID(AID aid)
          Set the AID.
 void setCursor(int row, int col)
          Set the cursor position.
protected  void setHandling(boolean b)
          Sets the screen handler state and fires events to listeners if the state has changed.
 void terminalConnected(TerminalEvent evt)
          Handles a terminal connect event.
 void terminalDisconnected(TerminalEvent evt)
          Handles a terminal disconnect event.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handling

protected transient boolean handling
true if the ScreenHandler is handling the current screen

listeners

protected transient java.util.Vector listeners
Vector of ScreenEventListeners to be notified when an event occurs

terminal

protected transient TerminalSession terminal
the EPITerminal

aid

protected AID aid
the screen AID

cursorRow

protected int cursorRow
the screen cursor row

cursorCol

protected int cursorCol
the screen cursor column
Constructor Detail

ScreenHandler

public ScreenHandler()
Method Detail

addScreenEventListener

public void addScreenEventListener(ScreenEventListener l)
The specified ScreenEventListener will be called when this ScreenHandler gains control of the screen and again when it loses control. The ScreenEventListener object is added to a list of ScreenEventListeners managed by this ScreenHandler, it can be removed with removeScreenEventListener. Note: the JavaBeans specification does not require listeners to run in any particular order.
Parameters:
l - the ScreenEventListener
See Also:
removeScreenEventListener(com.ibm.ctg.epi.ScreenEventListener)

removeScreenEventListener

public void removeScreenEventListener(ScreenEventListener l)
Remove this ScreenEventListener from the internal list. If the ScreenEventListener isn't on the list, silently do nothing.
Parameters:
l - the ScreenEventListener
See Also:
addScreenEventListener(com.ibm.ctg.epi.ScreenEventListener)

fireEvent

public void fireEvent()
Send appropriate event to all listeners.
See Also:
addScreenEventListener(com.ibm.ctg.epi.ScreenEventListener)

terminalConnected

public void terminalConnected(TerminalEvent evt)
Handles a terminal connect event. This method does not do anything.
Specified by:
terminalConnected in interface TerminalEventListener
Parameters:
evt - the EPI event sent

terminalDisconnected

public void terminalDisconnected(TerminalEvent evt)
Handles a terminal disconnect event. Sets the terminal variable to null, and sends the screenUnhandled event to any listeners.
Specified by:
terminalDisconnected in interface TerminalEventListener
Parameters:
evt - the EPI event sent

exceptionOccurred

public void exceptionOccurred(TerminalEvent evt)
Handles a terminal exception. This method does not do anything.
Specified by:
exceptionOccurred in interface TerminalEventListener
Parameters:
evt - the EPI event sent

isHandling

public boolean isHandling()
Returns true if the ScreenHandler is handling the current screen.
Returns:
true if handling, false otherwise

setHandling

protected void setHandling(boolean b)
Sets the screen handler state and fires events to listeners if the state has changed.
Parameters:
b - the new handling status

setAID

public void setAID(AID aid)
Set the AID.
Parameters:
aid - the AID

send

public void send()
Send the screen to CICS.

setCursor

public void setCursor(int row,
                      int col)
Set the cursor position.
Parameters:
row - the cursor row
col - the cursor column

getAID

public AID getAID()
Get the current AID value.
Returns:
the aid

getCursorRow

public int getCursorRow()
Get the cursor row position.
Returns:
the cursor row

getCursorColumn

public int getCursorColumn()
Get the cursor column position.
Returns:
the cursor column

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Handles an action event by converting the action command to an AID value and sending the screen to CICS. This method is provided as a simple way to make a button press set the AID and send the screen.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
evt - the action event

exitScreen

public void exitScreen()
Exit the screen. You may need to override this method, which by default sets the aid to PF3 and sends the screen back to CICS.

© Copyright IBM Corp. 1994, 1999