Package com.iizix.term.remote
Class RemoteHostSession
- java.lang.Object
- com.iizix.term.remote.RemoteHostSession
- All Implemented Interfaces:
HostScreenListener,HostSessionListener,HostSessionOwner,IPreSendHostSessionProps,RemoteHostSessionListener
public class RemoteHostSession extends java.lang.Object implements HostSessionOwner, IPreSendHostSessionProps, RemoteHostSessionListener, HostScreenListener
The host screen changes.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description booleanisVerboseThe verbose flag.
Constructor Summary
Constructors Constructor Description RemoteHostSession(Worker worker, HostSessionProps props, boolean needFields, boolean needPopupWindows)Creates a remote host session controller instance.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachHostSession(HostSession hostSession, java.lang.Runnable stateChangedListener)Attaches a host session to this instance.voiddetachHostSession()Detaches from the host session.HostSessiongetHostSession()Gets the host session.SessionInfogetSessionInfo()Gets the SessionInfo.WorkergetWorker()Gets the worker of the session.voidonConnectChange(HostSessionPeer peer, boolean connected)Notifies the session of a connect state change.voidonCursorChanged(int x, int y)The cursor position has changed.voidonCursorPositionChange(HostSessionPeer peer, int x, int y)Notifies the session that the cursor position has changed.voidonFieldChange(HostSessionPeer peer)Notifies the session that fields have changed.intonHostDataStreamProcessing(HostSessionPeer peer, boolean isEntering)Called when the datastream enters or exits processing.voidonHostDataStreamProcessing(HostSessionPeer peer, boolean isEntering, int updates)N/A.voidonHostPrintPage(HostSessionPeer peer)Called when a host printer needs printing of a new page.voidonPreSend(HostSessionProps props)Called prior to sending the transaction update to the other party.voidonScreenChange(HostSessionPeer peer, int beginPos, int endPos)Notifies the session of a screen change.voidonScreenChange(HostSessionPeer peer, int begin, int end, char[] chars, byte[] attr1, byte[] attr2)Notifies the session of a screen change.voidonScreenChanged(int begin, int end)The screen has changed between two points in a wrapping fashion.voidonScreenClear()The display has been cleared, i.e.voidonScreenSizeChange(HostSessionPeer peer, int cx, int cy)Notifies the session that the screen size has changed.voidonScreenSizeChanged(int cx, int cy)The screen size has changed.voidonSessionFailure(HostSessionPeer peer, java.lang.Throwable exception)Called when a session has had a failure.voidonStateChange(HostSessionPeer peer)Notifies the session of a state change (such as insert mode, lock state, error state).java.lang.StringperformTerminalCopy(int x, int y, int cx, int cy)Performs a copy operation to a clip board string for terminal screen.booleanprintSession(HostSessionPeer peer)Called when the host (mainframe) has issued a Print Session (Print Local Copy).voidsoundAlarm(HostSessionPeer peer)Sound alarm on the client.
Constructor Detail
RemoteHostSession
public RemoteHostSession(Worker worker, HostSessionProps props, boolean needFields, boolean needPopupWindows)
Creates a remote host session controller instance.- Parameters:
worker- The worker for the session.props- The host session properties.needFields- Changes in fields are of interest or not.needPopupWindows- Changes in pop-up windows are of interest or not.
Method Detail
attachHostSession
public void attachHostSession(HostSession hostSession, java.lang.Runnable stateChangedListener)
Attaches a host session to this instance.- Parameters:
hostSession- The host session instance.stateChangedListener- The state change listener, null for none.
detachHostSession
public void detachHostSession()
Detaches from the host session.
onPreSend
public void onPreSend(HostSessionProps props)
Called prior to sending the transaction update to the other party. Using this method, an implementing class can add additional data at the last moment.- Specified by:
onPreSendin interfaceIPreSendHostSessionProps- Parameters:
props- The host session properties.
getHostSession
public HostSession getHostSession()
Gets the host session.- Returns:
- The host session, null if not created.
onScreenClear
public void onScreenClear()
The display has been cleared, i.e. entire screen blanked with spaces and default color.- Specified by:
onScreenClearin interfaceHostScreenListener
onCursorChanged
public void onCursorChanged(int x, int y)The cursor position has changed.- Specified by:
onCursorChangedin interfaceHostScreenListener- Parameters:
x- X position on screen.y- Y position on screen.
onScreenChanged
public void onScreenChanged(int begin, int end)The screen has changed between two points in a wrapping fashion.- Specified by:
onScreenChangedin interfaceHostScreenListener- Parameters:
begin- The beginning position.end- The end position (inclusive).
onScreenSizeChanged
public void onScreenSizeChanged(int cx, int cy)The screen size has changed.- Specified by:
onScreenSizeChangedin interfaceHostScreenListener- Parameters:
cx- The new width.cy- The new height.
onScreenChange
public void onScreenChange(HostSessionPeer peer, int beginPos, int endPos)
Notifies the session of a screen change.- Specified by:
onScreenChangein interfaceHostSessionListener
onScreenChange
public void onScreenChange(HostSessionPeer peer, int begin, int end, char[] chars, byte[] attr1, byte[] attr2)
Notifies the session of a screen change.- Specified by:
onScreenChangein interfaceRemoteHostSessionListener- Parameters:
peer- Host session peer.begin- Begin position, zero based.end- Ending position, zero-based (inclusive).chars- Characters data.attr1- Normal attribute array.attr2- Extended attribute array.
onFieldChange
public void onFieldChange(HostSessionPeer peer)
Notifies the session that fields have changed.- Specified by:
onFieldChangein interfaceHostSessionListener
onScreenSizeChange
public void onScreenSizeChange(HostSessionPeer peer, int cx, int cy)
Notifies the session that the screen size has changed.- Specified by:
onScreenSizeChangein interfaceHostSessionListener
onCursorPositionChange
public void onCursorPositionChange(HostSessionPeer peer, int x, int y)
Notifies the session that the cursor position has changed.- Specified by:
onCursorPositionChangein interfaceHostSessionListener
onConnectChange
public void onConnectChange(HostSessionPeer peer, boolean connected)
Notifies the session of a connect state change.- Specified by:
onConnectChangein interfaceHostSessionListener
onStateChange
public void onStateChange(HostSessionPeer peer)
Notifies the session of a state change (such as insert mode, lock state, error state).- Specified by:
onStateChangein interfaceHostSessionListener
onSessionFailure
public void onSessionFailure(HostSessionPeer peer, java.lang.Throwable exception)
Called when a session has had a failure.- Specified by:
onSessionFailurein interfaceHostSessionListener
soundAlarm
public void soundAlarm(HostSessionPeer peer)
Sound alarm on the client.- Specified by:
soundAlarmin interfaceHostSessionListener
onHostDataStreamProcessing
public int onHostDataStreamProcessing(HostSessionPeer peer, boolean isEntering)
Called when the datastream enters or exits processing. This enables the owner to "group" multiple notification events together.- Specified by:
onHostDataStreamProcessingin interfaceHostSessionOwner- Parameters:
peer- The peer.isEntering- Flag for entering or exiting.- Returns:
- Bit flags 0x01 = characters changed, 0x02=fields changed.
onHostPrintPage
public void onHostPrintPage(HostSessionPeer peer)
Called when a host printer needs printing of a new page.- Specified by:
onHostPrintPagein interfaceHostSessionOwner- Parameters:
peer- The peer.
printSession
public boolean printSession(HostSessionPeer peer)
Called when the host (mainframe) has issued a Print Session (Print Local Copy).- Specified by:
printSessionin interfaceHostSessionOwner- Parameters:
peer- The peer.- Returns:
- true for success, false for cancel.
getWorker
public Worker getWorker()
Gets the worker of the session.- Specified by:
getWorkerin interfaceHostSessionOwner- Returns:
- The worker.
getSessionInfo
public SessionInfo getSessionInfo()
Gets the SessionInfo.- Specified by:
getSessionInfoin interfaceHostSessionOwner- Returns:
- The session info, never null.
performTerminalCopy
public java.lang.String performTerminalCopy(int x, int y, int cx, int cy)Performs a copy operation to a clip board string for terminal screen.- Parameters:
x- X position.y- Y position.cx- Width.cy- Height.- Returns:
- null if the operation could not be completed due to invalid host session or parameters.
onHostDataStreamProcessing
public void onHostDataStreamProcessing(HostSessionPeer peer, boolean isEntering, int updates)
N/A.- Specified by:
onHostDataStreamProcessingin interfaceHostSessionListener- Parameters:
peer- The peer.isEntering- The state of processing (true=before, false=after).updates- What has been updated on screen (bit flag: 0x01=characters, 0x02=fields).