Package com.iizigo.term.internal
Class Terminal
- java.lang.Object
 - com.iizigo.term.internal.Terminal
 
- All Implemented Interfaces:
 TerminalWindowListener
public class Terminal extends java.lang.Object implements 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
Constructors Constructor Description Terminal(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(ITerminalListener listener)Adds a terminal listener.voidclear()Clears the entire screen.voidcreateTerminal(org.eclipse.swt.widgets.Canvas canvas, TerminalStatusBar statusBar, IScreenDesigner designer)Creates an instance of the terminal window.voiddispose()Disposes of the instance.int[]getAttributes()Gets the attributes for direct manipulation of underlines.intgetCursorX()Gets the cursor X.intgetCursorY()Gets the cursor X.HostSessiongetHostSession()Gets the HostSession.booleangetInsertMode()Gets the insert mode.org.eclipse.swt.graphics.Rectangle[]getMarks()Gets the rectangle presently marked.TerminalSettingsgetSettings()Gets the Settings container.TerminalWindowgetTerminalWindow()Gets the AWT TerminalWindow container.booleanhasMark()Checks if a rectangle is presently marked.booleaninInsertMode()The insert mode can be read using this method.booleanisDisconnected()Checks if disconnected, used e.g.booleanisLocked()Checks if the terminal session is locked.booleanisMarkAllowed()Checks if marking is allowed, i.e.booleanonActivateMenu(boolean isPopup)Handles display of the pop-up window or activation of the menu bar.voidonMarkChange()Called when the mark changes.booleanonPopup(int x, int y)Handles display of the pop-up window.voidremoveListener(ITerminalListener listener)Removes a terminal listener.voidremoveMarks()Removes the rectangle mark.voidselectAll()Selects all in terminal window.voidsendCharacter(char ch)Sends a character string to the terminal.voidsendHostKey(int key)Sends a host key to the host.voidsendKey(HostKeyEvent e)Sends a key to the terminal.booleansetCursor(int x, int y)Sets the cursor position to X/Y.voidsoundAlarm(boolean isHostAlarm)Sounds the Alarm.voidswitchProperties(HostSession hostSession, EditorTerminalProps terminalProps)Switches properties.voidupdateCursor(int x, int y)The cursor position has changed from Local terminal.voidupdateScreenData(int begin, int end)The screen has changed between two points in a wrapping fashion.voidupdateScreenSize()Sets the screen size from Local terminal.
Constructor Detail
Terminal
public Terminal(EditorActiveTerminalSession session, HostSessionProps props)
Constructor for a remote session to a server.
Terminal
public Terminal(HostSession hostSession, EditorTerminalProps terminalProps)
Creates a new terminal session for a local connection inside the Designer.
Method Detail
addListener
public void addListener(ITerminalListener listener)
Adds a terminal listener.
removeListener
public void removeListener(ITerminalListener listener)
Removes a terminal listener.
switchProperties
public void switchProperties(HostSession hostSession, EditorTerminalProps terminalProps)
Switches properties.
getHostSession
public HostSession getHostSession()
Gets the HostSession.
getSettings
public TerminalSettings getSettings()
Gets the Settings container.
createTerminal
public void createTerminal(org.eclipse.swt.widgets.Canvas canvas, TerminalStatusBar statusBar, IScreenDesigner designer)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:
 onActivateMenuin 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:
 onPopupin 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
public void sendKey(HostKeyEvent e)
Sends a key to the terminal.- Specified by:
 sendKeyin 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:
 sendHostKeyin interfaceTerminalWindowListener- Parameters:
 key- The key to send.
sendCharacter
public void sendCharacter(char ch)
Sends a character string to the terminal.- Specified by:
 sendCharacterin interfaceTerminalWindowListener- Parameters:
 ch- The character to send.
setCursor
public boolean setCursor(int x, int y)Sets the cursor position to X/Y.- Specified by:
 setCursorin 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:
 isLockedin interfaceTerminalWindowListener- Returns:
 - true if locked.
 
inInsertMode
public boolean inInsertMode()
The insert mode can be read using this method.- Specified by:
 inInsertModein 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
public org.eclipse.swt.graphics.Rectangle[] 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:
 isDisconnectedin 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:
 onMarkChangein interfaceTerminalWindowListener
getTerminalWindow
public TerminalWindow getTerminalWindow()
Gets the AWT TerminalWindow container.
isMarkAllowed
public boolean isMarkAllowed()
Checks if marking is allowed, i.e. connected.- Specified by:
 isMarkAllowedin 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.