Class 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.
    • Method Detail

      • addListener

        public void addListener​(ITerminalListener listener)
        Adds a terminal listener.
      • removeListener

        public void removeListener​(ITerminalListener listener)
        Removes a terminal listener.
      • getHostSession

        public HostSession getHostSession()
        Gets the HostSession.
      • 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:
        onActivateMenu in interface TerminalWindowListener
        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 interface TerminalWindowListener
        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.
      • 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 interface TerminalWindowListener
        Parameters:
        key - The key to send.
      • sendCharacter

        public void sendCharacter​(char ch)
        Sends a character string to the terminal.
        Specified by:
        sendCharacter in interface TerminalWindowListener
        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 interface TerminalWindowListener
        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 interface TerminalWindowListener
        Returns:
        true if locked.
      • inInsertMode

        public boolean inInsertMode()
        The insert mode can be read using this method.
        Specified by:
        inInsertMode in interface TerminalWindowListener
        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:
        isDisconnected in interface TerminalWindowListener
        Returns:
        true if disconnected.
      • selectAll

        public void selectAll()
        Selects all in terminal window.
      • getTerminalWindow

        public TerminalWindow getTerminalWindow()
        Gets the AWT TerminalWindow container.
      • isMarkAllowed

        public boolean isMarkAllowed()
        Checks if marking is allowed, i.e. connected.
        Specified by:
        isMarkAllowed in interface TerminalWindowListener
        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.