Class TerminalWindow

  • All Implemented Interfaces:
    java.lang.Runnable, java.util.EventListener, org.eclipse.swt.events.DisposeListener, org.eclipse.swt.events.FocusListener, org.eclipse.swt.events.KeyListener, org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.events.PaintListener, org.eclipse.swt.internal.SWTEventListener

    public class TerminalWindow
    extends java.lang.Object
    implements org.eclipse.swt.events.FocusListener, org.eclipse.swt.events.KeyListener, org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.events.PaintListener, org.eclipse.swt.events.DisposeListener, java.lang.Runnable
    This class creates and displays the terminal window inside a JComponent, typically a JFrame or JInternalFrame. It will create a status bar at the bottom, place the terminal window display on top and possibly with scroll bars around.

    This class is used by the Clients, but also by the terminal window on the Server when running in GUI mode.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidaddMark​(int x, int y, int cx, int cy)
      Adds a mark.
      voidaddMark​(org.eclipse.swt.graphics.Rectangle mark)
      Adds a mark.
      org.eclipse.swt.graphics.PointcomputeSize​(int wHint, int hHint)
      Gets the minimum size without scroll bars.
      voiddoKeyPressed​(org.eclipse.swt.events.KeyEvent e)
      Key pressed.
      voiddoKeyReleased​(org.eclipse.swt.events.KeyEvent e)
      Key released.
      voiddoMouseDoubleClick​(org.eclipse.swt.events.MouseEvent e)
      Mouse double-click, continued.
      voiddoMouseDown​(org.eclipse.swt.events.MouseEvent e)
      Mouse pressed.
      voiddoMouseUp​(org.eclipse.swt.events.MouseEvent e)
      Mouse released, continued.
      voidfocusGained​(org.eclipse.swt.events.FocusEvent e)
      Focus gained.
      voidfocusLost​(org.eclipse.swt.events.FocusEvent e)
      Focus is lost.
      org.eclipse.swt.graphics.PointgetCursorLocation()
      Gets the current pointer position relative canvas.
      org.eclipse.swt.graphics.PointgetCursorPoint()
      Gets the current point of the cursor relative the "frame".
      intgetFontHeight()
      Gets the font height.
      java.lang.StringgetFontName()
      Gets the font name used.
      intgetFontWidth()
      Gets the font width.
      intgetLeftMargin()
      Gets the left margin.
      org.eclipse.swt.graphics.Rectangle[]getMarks()
      Get the current selected marks.
      intgetScreenHeight()
      Gets the screenHeight.
      intgetScreenWidth()
      Gets the screenWidth.
      intgetTopMargin()
      Gets the top margin.
      booleanhasMark()
      Get the current selected mark.
      booleanhasSingleMark()
      Check for a single mark.
      voidkeyPressed​(org.eclipse.swt.events.KeyEvent e)
      Key pressed.
      voidkeyReleased​(org.eclipse.swt.events.KeyEvent e)
      Key released.
      voidmouseDoubleClick​(org.eclipse.swt.events.MouseEvent e)
      Mouse double-click.
      voidmouseDown​(org.eclipse.swt.events.MouseEvent e)
      Mouse pressed.
      voidmouseMove​(org.eclipse.swt.events.MouseEvent e)
      Mouse move.
      voidmouseUp​(org.eclipse.swt.events.MouseEvent e)
      Mouse released.
      voidonNewSize​(int cx, int cy)
      Called when a new size is set.
      voidpaintControl​(org.eclipse.swt.events.PaintEvent e)
      The paint listener.
      booleanremoveMark​(int x, int y, int cx, int cy)
      Removes a mark.
      voidrepaint()
      Repaint entire area now.
      voidrepaintCharRect​(int x, int y, int cx, int cy)
      Repaints one or two rectangles in character scaling.
      voidrepaintCharRect​(org.eclipse.swt.graphics.Rectangle r)
      Repaints one or two rectangles in character scaling.
      voidrepaintPixelRect​(int x, int y, int cx, int cy)
      The repaint a rectangle, later.
      voidrepaintPixelRect​(org.eclipse.swt.graphics.Rectangle r)
      The repaint a rectangle, later.
      voidrepaintText​(int beginPos, int endPos)
      Change of character/color data between two positions.
      voidrun()
      The action performed is actually a timer message and causes the cursor to flash.
      voidsetCapture​(boolean on)
      Sets mouse capture.
      booleansetCursorVisible​(boolean on)
      Shows or hides the cursor for a session.
      voidsetFocusProcessing​(boolean on)
      setIgnoreFocusTime
      voidsetInsertMode​(boolean on)
      Sets the insert mode indicator.
      voidsetMoveSize​(boolean on)
      Call to set moving/sizing in order to skip cursor drawing.
      voidsetPreview​(boolean doAntiAlias)
      Preview anti-alias.
      voidsetScreenSize​(int cx, int cy, char[] cd, int[] ad)
      Sets the current screen size.
      voidsetShowHiddenText​(boolean on)
      Sets showing of hidden text.
      voidupdate()
      Updates the terminal window now, after a repaint.
      voidwidgetDisposed​(org.eclipse.swt.events.DisposeEvent e)
      Dispose listener.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TerminalWindow

        public TerminalWindow​(org.eclipse.swt.widgets.Canvas canvas,
                              TerminalStatusBar statusBar,
                              IScreenDesigner designer,
                              int cx,
                              int cy,
                              int x,
                              int y,
                              char[] cd,
                              int[] ad,
                              TerminalWindowListener listener,
                              TerminalSettings settings)
        The constructor creates the child components (terminal display with possible scroll bars and the status bar. It also starts to listen to keystrokes and focus changes.
        Parameters:
        canvas - The canvas.
        statusBar - The status bar.
        designer - The designer interface.
        cx - Width.
        cy - Height.
        x - X position.
        y - Y position.
        cd - Character data.
        ad - Attribute data.
        listener - Listener.
        settings - Settings.
    • Method Detail

      • setPreview

        public void setPreview​(boolean doAntiAlias)
        Preview anti-alias.
        Parameters:
        doAntiAlias - Flag to perform anti-alias or not.
      • getScreenWidth

        public int getScreenWidth()
        Gets the screenWidth.
        Returns:
        The screen width.
      • getScreenHeight

        public int getScreenHeight()
        Gets the screenHeight.
        Returns:
        The screen height.
      • getTopMargin

        public int getTopMargin()
        Gets the top margin.
        Returns:
        The top margin.
      • getLeftMargin

        public int getLeftMargin()
        Gets the left margin.
        Returns:
        The left margin.
      • getFontWidth

        public int getFontWidth()
        Gets the font width.
        Returns:
        The font width in pixels.
      • getFontHeight

        public int getFontHeight()
        Gets the font height.
        Returns:
        The font height in pixels.
      • keyPressed

        public void keyPressed​(org.eclipse.swt.events.KeyEvent e)
        Key pressed.
        Specified by:
        keyPressed in interface org.eclipse.swt.events.KeyListener
        Parameters:
        e - The KeyEvent.
      • doKeyPressed

        public void doKeyPressed​(org.eclipse.swt.events.KeyEvent e)
        Key pressed.
        Parameters:
        e - The KeyEvent.
      • keyReleased

        public void keyReleased​(org.eclipse.swt.events.KeyEvent e)
        Key released.
        Specified by:
        keyReleased in interface org.eclipse.swt.events.KeyListener
        Parameters:
        e - The KeyEvent.
      • doKeyReleased

        public void doKeyReleased​(org.eclipse.swt.events.KeyEvent e)
        Key released.
        Parameters:
        e - The KeyEvent.
      • getCursorPoint

        public org.eclipse.swt.graphics.Point getCursorPoint()
        Gets the current point of the cursor relative the "frame".
      • setCapture

        public void setCapture​(boolean on)
        Sets mouse capture.
      • mouseDown

        public void mouseDown​(org.eclipse.swt.events.MouseEvent e)
        Mouse pressed.
        Specified by:
        mouseDown in interface org.eclipse.swt.events.MouseListener
      • doMouseDown

        public void doMouseDown​(org.eclipse.swt.events.MouseEvent e)
        Mouse pressed.
      • mouseDoubleClick

        public void mouseDoubleClick​(org.eclipse.swt.events.MouseEvent e)
        Mouse double-click.
        Specified by:
        mouseDoubleClick in interface org.eclipse.swt.events.MouseListener
      • doMouseDoubleClick

        public void doMouseDoubleClick​(org.eclipse.swt.events.MouseEvent e)
        Mouse double-click, continued.
      • mouseUp

        public void mouseUp​(org.eclipse.swt.events.MouseEvent e)
        Mouse released.
        Specified by:
        mouseUp in interface org.eclipse.swt.events.MouseListener
      • doMouseUp

        public void doMouseUp​(org.eclipse.swt.events.MouseEvent e)
        Mouse released, continued.
      • mouseMove

        public void mouseMove​(org.eclipse.swt.events.MouseEvent e)
        Mouse move.
        Specified by:
        mouseMove in interface org.eclipse.swt.events.MouseMoveListener
      • addMark

        public void addMark​(int x,
                            int y,
                            int cx,
                            int cy)
        Adds a mark.
      • addMark

        public void addMark​(org.eclipse.swt.graphics.Rectangle mark)
        Adds a mark.
      • removeMark

        public boolean removeMark​(int x,
                                  int y,
                                  int cx,
                                  int cy)
        Removes a mark.
        Returns:
        true for success, false if not found.
      • widgetDisposed

        public void widgetDisposed​(org.eclipse.swt.events.DisposeEvent e)
        Dispose listener.
        Specified by:
        widgetDisposed in interface org.eclipse.swt.events.DisposeListener
      • paintControl

        public void paintControl​(org.eclipse.swt.events.PaintEvent e)
        The paint listener.
        Specified by:
        paintControl in interface org.eclipse.swt.events.PaintListener
      • onNewSize

        public void onNewSize​(int cx,
                              int cy)
        Called when a new size is set.
      • computeSize

        public org.eclipse.swt.graphics.Point computeSize​(int wHint,
                                                          int hHint)
        Gets the minimum size without scroll bars.
      • repaint

        public void repaint()
        Repaint entire area now.
      • update

        public void update()
        Updates the terminal window now, after a repaint.
      • getCursorLocation

        public org.eclipse.swt.graphics.Point getCursorLocation()
        Gets the current pointer position relative canvas.
      • repaintPixelRect

        public void repaintPixelRect​(org.eclipse.swt.graphics.Rectangle r)
        The repaint a rectangle, later.
      • repaintPixelRect

        public void repaintPixelRect​(int x,
                                     int y,
                                     int cx,
                                     int cy)
        The repaint a rectangle, later.
      • repaintCharRect

        public void repaintCharRect​(org.eclipse.swt.graphics.Rectangle r)
        Repaints one or two rectangles in character scaling.
      • repaintCharRect

        public void repaintCharRect​(int x,
                                    int y,
                                    int cx,
                                    int cy)
        Repaints one or two rectangles in character scaling.
      • setFocusProcessing

        public void setFocusProcessing​(boolean on)
        setIgnoreFocusTime
      • focusGained

        public void focusGained​(org.eclipse.swt.events.FocusEvent e)
        Focus gained.
        Specified by:
        focusGained in interface org.eclipse.swt.events.FocusListener
      • focusLost

        public void focusLost​(org.eclipse.swt.events.FocusEvent e)
        Focus is lost.
        Specified by:
        focusLost in interface org.eclipse.swt.events.FocusListener
      • setMoveSize

        public void setMoveSize​(boolean on)
        Call to set moving/sizing in order to skip cursor drawing.
      • run

        public void run()
        The action performed is actually a timer message and causes the cursor to flash.
        Specified by:
        run in interface java.lang.Runnable
      • setCursorVisible

        public boolean setCursorVisible​(boolean on)
        Shows or hides the cursor for a session.
      • repaintText

        public void repaintText​(int beginPos,
                                int endPos)
        Change of character/color data between two positions.
      • setInsertMode

        public void setInsertMode​(boolean on)
        Sets the insert mode indicator.
      • hasMark

        public boolean hasMark()
        Get the current selected mark.
        Returns:
        Rectangle
      • hasSingleMark

        public boolean hasSingleMark()
        Check for a single mark.
        Returns:
        Rectangle
      • getMarks

        public org.eclipse.swt.graphics.Rectangle[] getMarks()
        Get the current selected marks.
        Returns:
        Rectangle array.
      • setScreenSize

        public void setScreenSize​(int cx,
                                  int cy,
                                  char[] cd,
                                  int[] ad)
        Sets the current screen size.
      • getFontName

        public java.lang.String getFontName()
        Gets the font name used.
      • setShowHiddenText

        public void setShowHiddenText​(boolean on)
        Sets showing of hidden text.