Package jexer

Class TTerminalWidget

    • Constructor Detail

      • TTerminalWidget

        public TTerminalWidget​(TWidget parent,
                               int x,
                               int y,
                               java.lang.String commandLine)
        Public constructor spawns a custom command line.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        commandLine - the command line to execute
      • TTerminalWidget

        public TTerminalWidget​(TWidget parent,
                               int x,
                               int y,
                               java.lang.String[] command)
        Public constructor spawns a custom command line.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        command - the command line to execute
      • TTerminalWidget

        public TTerminalWidget​(TWidget parent,
                               int x,
                               int y,
                               java.lang.String[] command,
                               TAction closeAction)
        Public constructor spawns a custom command line.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        command - the command line to execute
        closeAction - action to perform when the shell exits
      • TTerminalWidget

        public TTerminalWidget​(TWidget parent,
                               int x,
                               int y,
                               int width,
                               int height,
                               java.lang.String[] command,
                               TAction closeAction)
        Public constructor spawns a custom command line.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        width - width of widget
        height - height of widget
        command - the command line to execute
        closeAction - action to perform when the shell exits
      • TTerminalWidget

        public TTerminalWidget​(TWidget parent,
                               int x,
                               int y)
        Public constructor spawns a shell.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
      • TTerminalWidget

        public TTerminalWidget​(TWidget parent,
                               int x,
                               int y,
                               TAction closeAction)
        Public constructor spawns a shell.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        closeAction - action to perform when the shell exits
      • TTerminalWidget

        public TTerminalWidget​(TWidget parent,
                               int x,
                               int y,
                               int width,
                               int height,
                               TAction closeAction)
        Public constructor spawns a shell.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        width - width of widget
        height - height of widget
        closeAction - action to perform when the shell exits
    • Method Detail

      • onKeypress

        public void onKeypress​(TKeypressEvent keypress)
        Handle keystrokes.
        Overrides:
        onKeypress in class TWidget
        Parameters:
        keypress - keystroke event
      • onMouseDown

        public void onMouseDown​(TMouseEvent mouse)
        Handle mouse press events.
        Overrides:
        onMouseDown in class TWidget
        Parameters:
        mouse - mouse button press event
      • onMouseUp

        public void onMouseUp​(TMouseEvent mouse)
        Handle mouse release events.
        Overrides:
        onMouseUp in class TWidget
        Parameters:
        mouse - mouse button release event
      • onMouseMotion

        public void onMouseMotion​(TMouseEvent mouse)
        Handle mouse motion events.
        Overrides:
        onMouseMotion in class TWidget
        Parameters:
        mouse - mouse motion event
      • onCommand

        public void onCommand​(TCommandEvent command)
        Handle posted command events.
        Overrides:
        onCommand in class TWidget
        Parameters:
        command - command event
      • draw

        public void draw()
        Draw the display buffer.
        Overrides:
        draw in class TWidget
      • close

        public void close()
        Handle widget close.
        Overrides:
        close in class TWidget
      • setDirty

        public void setDirty()
        Set the dirty flag.
      • getTitle

        public java.lang.String getTitle()
        Get the desired window title.
        Returns:
        the title
      • getCommandLine

        public java.lang.String[] getCommandLine()
        Get the full command line that spawned the shell.
        Returns:
        the command line
      • hasHiddenMouse

        public boolean hasHiddenMouse()
        Returns true if this widget does not want the application-wide mouse cursor drawn over it.
        Returns:
        true if this widget does not want the application-wide mouse cursor drawn over it
      • isPixelMouse

        public boolean isPixelMouse()
        Check if per-pixel mouse events are requested.
        Overrides:
        isPixelMouse in class TWidget
        Returns:
        true if per-pixel mouse events are requested
      • isReading

        public boolean isReading()
        See if the terminal is still running.
        Returns:
        if true, we are still connected to / reading from the remote side
      • getPid

        public long getPid()
        Get the PID of the child process.
        Returns:
        the pid, or -1 if it cannot be determined
      • signalShellChildProcess

        public void signalShellChildProcess​(int signal)
        Send a signal to the the child of the 'script' or 'ptypipe' process used on POSIX. This may or may not work.
        Parameters:
        signal - the signal number
      • signalShellChildProcess

        public void signalShellChildProcess​(java.lang.String signal)
        Send a signal to the the child of the 'script' or 'ptypipe' process used on POSIX. This may or may not work.
        Parameters:
        signal - the signal name
      • onShellExit

        public void onShellExit()
        Hook for subclasses to be notified of the shell termination.
      • waitForOutput

        public boolean waitForOutput​(int millis)
        Wait for a period of time to get output from the launched process.
        Parameters:
        millis - millis to wait for, or 0 to wait forever
        Returns:
        true if the launched process has emitted something
      • getExitValue

        public int getExitValue()
        Get the exit value for the emulator.
        Returns:
        exit value
      • getScrollbackBuffer

        public final java.util.List<DisplayLine> getScrollbackBuffer()
        Get the scrollback buffer from the emulator.
        Returns:
        the scrollback buffer, all the lines that have scrolled off screen
      • getDisplayBuffer

        public final java.util.List<DisplayLine> getDisplayBuffer()
        Get the display buffer from the emulator.
        Returns:
        the display buffer, the lines that are on the visible screen
      • writeSessionAsText

        public void writeSessionAsText​(java.io.Writer writer)
                                throws java.io.IOException
        Write the entire session (scrollback and display buffers) as plain text to a writer.
        Parameters:
        writer - the output writer
        Throws:
        java.io.IOException - of a java.io operation throws
      • writeSessionAsHtml

        public void writeSessionAsHtml​(java.io.Writer writer)
                                throws java.io.IOException
        Write the entire session (scrollback and display buffers) as colorized HTML to a writer. This method does not write the HTML header/body tags.
        Parameters:
        writer - the output writer
        Throws:
        java.io.IOException - of a java.io operation throws
      • displayChanged

        public void displayChanged()
        Called by emulator when fresh data has come in.
        Specified by:
        displayChanged in interface DisplayListener
      • getDisplayWidth

        public int getDisplayWidth()
        Function to call to obtain the display width.
        Specified by:
        getDisplayWidth in interface DisplayListener
        Returns:
        the number of columns in the display
      • getDisplayHeight

        public int getDisplayHeight()
        Function to call to obtain the display height.
        Specified by:
        getDisplayHeight in interface DisplayListener
        Returns:
        the number of rows in the display
      • isEditMenuCut

        public boolean isEditMenuCut()
        Check if the cut menu item should be enabled.
        Specified by:
        isEditMenuCut in interface EditMenuUser
        Returns:
        true if the cut menu item should be enabled
      • isEditMenuCopy

        public boolean isEditMenuCopy()
        Check if the copy menu item should be enabled.
        Specified by:
        isEditMenuCopy in interface EditMenuUser
        Returns:
        true if the copy menu item should be enabled
      • isEditMenuPaste

        public boolean isEditMenuPaste()
        Check if the paste menu item should be enabled.
        Specified by:
        isEditMenuPaste in interface EditMenuUser
        Returns:
        true if the paste menu item should be enabled
      • isEditMenuClear

        public boolean isEditMenuClear()
        Check if the clear menu item should be enabled.
        Specified by:
        isEditMenuClear in interface EditMenuUser
        Returns:
        true if the clear menu item should be enabled