CICS® Transaction Gateway Base API Programming Reference v8.1.0.2

com.ibm.ctg.epi
Class ScreenHandler

java.lang.Object
  extended by com.ibm.ctg.epi.ScreenHandler
All Implemented Interfaces:
TerminalEventListener, java.awt.event.ActionListener, java.io.Serializable, java.util.EventListener

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:


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.
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.ctg.epi.TerminalEventListener
handleScreen
 

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

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, 2012
Legal