Package com.iizigo.term.internal
Class Terminal
java.lang.Object
com.iizigo.term.internal.Terminal
- All Implemented Interfaces:
TerminalWindowListener
The Terminal class displays the window of the emulator. All keystrokes are sent to the host and all changes of the screen is mapped back into the terminal window.
Constructor Summary
ConstructorDescriptionTerminal
(EditorActiveTerminalSession session, HostSessionProps props) Constructor for a remote session to a server.Terminal
(HostSession hostSession, EditorTerminalProps terminalProps) Creates a new terminal session for a local connection inside the Designer.Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ITerminalListener listener) Adds a terminal listener.void
clear()
Clears the entire screen.void
createTerminal
(Canvas canvas, TerminalStatusBar statusBar, IScreenDesigner designer) Creates an instance of the terminal window.void
dispose()
Disposes of the instance.int[]
Gets the attributes for direct manipulation of underlines.int
Gets the cursor X.int
Gets the cursor X.Gets the HostSession.boolean
Gets the insert mode.getMarks()
Gets the rectangle presently marked.Gets the Settings container.Gets the AWT TerminalWindow container.boolean
hasMark()
Checks if a rectangle is presently marked.boolean
The insert mode can be read using this method.boolean
Checks if disconnected, used e.g.boolean
isLocked()
Checks if the terminal session is locked.boolean
Checks if marking is allowed, i.e.boolean
onActivateMenu
(boolean isPopup) Handles display of the pop-up window or activation of the menu bar.void
Called when the mark changes.boolean
onPopup
(int x, int y) Handles display of the pop-up window.void
removeListener
(ITerminalListener listener) Removes a terminal listener.void
Removes the rectangle mark.void
Selects all in terminal window.void
sendCharacter
(char ch) Sends a character string to the terminal.void
sendHostKey
(int key) Sends a host key to the host.void
Sends a key to the terminal.boolean
setCursor
(int x, int y) Sets the cursor position to X/Y.void
soundAlarm
(boolean isHostAlarm) Sounds the Alarm.void
switchProperties
(HostSession hostSession, EditorTerminalProps terminalProps) Switches properties.void
updateCursor
(int x, int y) The cursor position has changed from Local terminal.void
updateScreenData
(int begin, int end) The screen has changed between two points in a wrapping fashion.void
Sets the screen size from Local terminal.
Constructor Details
Terminal
Constructor for a remote session to a server.Terminal
Creates a new terminal session for a local connection inside the Designer.
Method Details
addListener
Adds a terminal listener.removeListener
Removes a terminal listener.switchProperties
Switches properties.getHostSession
Gets the HostSession.getSettings
Gets the Settings container.createTerminal
Creates an instance of the terminal window.onActivateMenu
public boolean onActivateMenu(boolean isPopup) Handles display of the pop-up window or activation of the menu bar.- Specified by:
onActivateMenu
in interfaceTerminalWindowListener
- Parameters:
isPopup
- Flag indicating it's a pop-up that should be activated, as opposed to the menu bar.- Returns:
- true if handled (i.e. menu is displayed).
onPopup
public boolean onPopup(int x, int y) Handles display of the pop-up window.- Specified by:
onPopup
in interfaceTerminalWindowListener
- Parameters:
x
- The mouse position in X relative the terminal container.y
- The mouse position in Y relative the terminal container.- Returns:
- true if handled (i.e. menu is displayed).
clear
public void clear()Clears the entire screen.sendKey
Sends a key to the terminal.- Specified by:
sendKey
in interfaceTerminalWindowListener
- Parameters:
e
- The Host Key Event.
sendHostKey
public void sendHostKey(int key) Sends a host key to the host. This method is only called from the "block mode" terminal emulation (HScreen, HField's or "this"), and doesn't take keyboard type-ahead into account.- Specified by:
sendHostKey
in interfaceTerminalWindowListener
- Parameters:
key
- The key to send.
sendCharacter
public void sendCharacter(char ch) Sends a character string to the terminal.- Specified by:
sendCharacter
in interfaceTerminalWindowListener
- Parameters:
ch
- The character to send.
setCursor
public boolean setCursor(int x, int y) Sets the cursor position to X/Y.- Specified by:
setCursor
in interfaceTerminalWindowListener
- Parameters:
x
- The X position.y
- The Y position.- Returns:
- false for failure (or not supported).
isLocked
public boolean isLocked()Checks if the terminal session is locked.- Specified by:
isLocked
in interfaceTerminalWindowListener
- Returns:
- true if locked.
inInsertMode
public boolean inInsertMode()The insert mode can be read using this method.- Specified by:
inInsertMode
in interfaceTerminalWindowListener
- Returns:
- true if insert mode, false = overwrite.
soundAlarm
public void soundAlarm(boolean isHostAlarm) Sounds the Alarm.updateScreenData
public void updateScreenData(int begin, int end) The screen has changed between two points in a wrapping fashion.- Parameters:
begin
- The beginning position.end
- The end position (inclusive).
updateScreenSize
public void updateScreenSize()Sets the screen size from Local terminal.updateCursor
public void updateCursor(int x, int y) The cursor position has changed from Local terminal.dispose
public void dispose()Disposes of the instance.hasMark
public boolean hasMark()Checks if a rectangle is presently marked.getMarks
Gets the rectangle presently marked.removeMarks
public void removeMarks()Removes the rectangle mark.isDisconnected
public boolean isDisconnected()Checks if disconnected, used e.g. to paint the cursor.- Specified by:
isDisconnected
in interfaceTerminalWindowListener
- Returns:
- true if disconnected.
selectAll
public void selectAll()Selects all in terminal window.onMarkChange
public void onMarkChange()Called when the mark changes.- Specified by:
onMarkChange
in interfaceTerminalWindowListener
getTerminalWindow
Gets the AWT TerminalWindow container.isMarkAllowed
public boolean isMarkAllowed()Checks if marking is allowed, i.e. connected.- Specified by:
isMarkAllowed
in interfaceTerminalWindowListener
- Returns:
- Mark allowed.
getCursorX
public int getCursorX()Gets the cursor X.getCursorY
public int getCursorY()Gets the cursor X.getInsertMode
public boolean getInsertMode()Gets the insert mode.getAttributes
public int[] getAttributes()Gets the attributes for direct manipulation of underlines.