Package jexer
Class TTerminalWindow
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TWindow
-
- jexer.TScrollableWindow
-
- jexer.TTerminalWindow
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
,Scrollable
- Direct Known Subclasses:
ExternalEditorWindow
,TerminalWindow
public class TTerminalWindow extends TScrollableWindow
TTerminalWindow exposes a ECMA-48 / ANSI X3.64 style terminal in a window.
-
-
Field Summary
Fields Modifier and Type Field Description protected TTerminalWidget
terminal
The terminal.-
Fields inherited from class jexer.TScrollableWindow
hScroller, vScroller
-
Fields inherited from class jexer.TWindow
ABSOLUTEXY, CENTERED, helpTopic, HIDEONCLOSE, inKeyboardResize, inWindowMove, inWindowResize, MODAL, mouse, NOCLOSEBOX, NOZOOMBOX, OVERRIDEMENU, RESIZABLE, statusBar
-
-
Constructor Summary
Constructors Constructor Description TTerminalWindow(TApplication application, int x, int y, int flags)
Public constructor spawns a shell.TTerminalWindow(TApplication application, int x, int y, int flags, boolean closeOnExit)
Public constructor spawns a shell.TTerminalWindow(TApplication application, int x, int y, int flags, java.lang.String[] command)
Public constructor spawns a custom command line.TTerminalWindow(TApplication application, int x, int y, int flags, java.lang.String[] command, boolean closeOnExit)
Public constructor spawns a custom command line.TTerminalWindow(TApplication application, int x, int y, java.lang.String commandLine)
Public constructor spawns a custom command line.TTerminalWindow(TApplication application, int x, int y, java.lang.String commandLine, boolean closeOnExit)
Public constructor spawns a custom command line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
draw()
Draw the display buffer.java.lang.String[]
getCommandLine()
Get the full command line that spawned the shell.int
getExitValue()
Get the exit value for the emulator.java.lang.String
getHelpTopic()
Get this window's help topic to load.boolean
hasHiddenMouse()
Returns true if this window does not want the application-wide mouse cursor drawn over it.void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
onMouseDown(TMouseEvent mouse)
Handle mouse press events.void
onMouseMotion(TMouseEvent mouse)
Handle mouse motion events.void
onMouseUp(TMouseEvent mouse)
Handle mouse release events.void
onResize(TResizeEvent resize)
Handle window/screen resize events.void
onShellExit()
Hook for subclasses to be notified of the shell termination.void
reflowData()
Resize scrollbars for a new width/height.void
setTitle(java.lang.String title, boolean override)
Set window title.boolean
waitForOutput(int millis)
Wait for a period of time to get output from the launched process.-
Methods inherited from class jexer.TScrollableWindow
bigHorizontalDecrement, bigHorizontalIncrement, bigVerticalDecrement, bigVerticalIncrement, getBottomValue, getHorizontalBigChange, getHorizontalScroller, getHorizontalSmallChange, getHorizontalValue, getLeftValue, getRightValue, getTopValue, getVerticalBigChange, getVerticalScroller, getVerticalSmallChange, getVerticalValue, horizontalDecrement, horizontalIncrement, maximize, mouseOnHorizontalScroller, mouseOnVerticalScroller, placeScrollbars, restore, setBottomValue, setHorizontalBigChange, setHorizontalSmallChange, setHorizontalValue, setLeftValue, setRightValue, setTopValue, setVerticalBigChange, setVerticalSmallChange, setVerticalValue, toBottom, toEnd, toHome, toLeft, toRight, toTop, verticalDecrement, verticalIncrement
-
Methods inherited from class jexer.TWindow
activate, addShortcutKeypress, center, clearShortcutKeypresses, close, ensureOnScreen, getApplication, getBackground, getBorder, getBorderControls, getMaximumWindowHeight, getMaximumWindowWidth, getMinimumWindowHeight, getMinimumWindowWidth, getScreen, getStatusBar, getTitle, getZ, hasCloseBox, hasOverriddenMenu, hasZoomBox, hide, inMovements, isHidden, isModal, isResizable, isShortcutKeypress, isShown, mouseOnClose, mouseOnMaximize, mouseOnResize, newStatusBar, onClose, onCommand, onFocus, onHide, onMenu, onPreClose, onShow, onUnfocus, removeShortcutKeypress, setCloseBox, setHiddenMouse, setMaximumWindowHeight, setMaximumWindowWidth, setMinimumWindowHeight, setMinimumWindowWidth, setResizable, setTitle, setZ, setZoomBox, show, stopMovements, toString
-
Methods inherited from class jexer.TWidget
activate, activate, activateAll, addButton, addCalendar, addCheckBox, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, compareTo, doRepaint, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getHeight, getLayoutManager, getParent, getTheme, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isVisible, messageBox, messageBox, mouseWouldHit, onIdle, onMouseDoubleClick, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setHeight, setLayoutManager, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, vLineXY
-
-
-
-
Field Detail
-
terminal
protected TTerminalWidget terminal
The terminal.
-
-
Constructor Detail
-
TTerminalWindow
public TTerminalWindow(TApplication application, int x, int y, java.lang.String commandLine)
Public constructor spawns a custom command line.- Parameters:
application
- TApplication that manages this windowx
- column relative to parenty
- row relative to parentcommandLine
- the command line to execute
-
TTerminalWindow
public TTerminalWindow(TApplication application, int x, int y, java.lang.String commandLine, boolean closeOnExit)
Public constructor spawns a custom command line.- Parameters:
application
- TApplication that manages this windowx
- column relative to parenty
- row relative to parentcommandLine
- the command line to executecloseOnExit
- if true, close the window when the command exits
-
TTerminalWindow
public TTerminalWindow(TApplication application, int x, int y, int flags, java.lang.String[] command)
Public constructor spawns a custom command line.- Parameters:
application
- TApplication that manages this windowx
- column relative to parenty
- row relative to parentflags
- mask of CENTERED, MODAL, or RESIZABLEcommand
- the command line to execute
-
TTerminalWindow
public TTerminalWindow(TApplication application, int x, int y, int flags, java.lang.String[] command, boolean closeOnExit)
Public constructor spawns a custom command line.- Parameters:
application
- TApplication that manages this windowx
- column relative to parenty
- row relative to parentflags
- mask of CENTERED, MODAL, or RESIZABLEcommand
- the command line to executecloseOnExit
- if true, close the window when the command exits
-
TTerminalWindow
public TTerminalWindow(TApplication application, int x, int y, int flags)
Public constructor spawns a shell.- Parameters:
application
- TApplication that manages this windowx
- column relative to parenty
- row relative to parentflags
- mask of CENTERED, MODAL, or RESIZABLE
-
TTerminalWindow
public TTerminalWindow(TApplication application, int x, int y, int flags, boolean closeOnExit)
Public constructor spawns a shell.- Parameters:
application
- TApplication that manages this windowx
- column relative to parenty
- row relative to parentflags
- mask of CENTERED, MODAL, or RESIZABLEcloseOnExit
- if true, close the window when the shell exits
-
-
Method Detail
-
onResize
public void onResize(TResizeEvent resize)
Handle window/screen resize events.- Overrides:
onResize
in classTScrollableWindow
- Parameters:
resize
- resize event
-
reflowData
public void reflowData()
Resize scrollbars for a new width/height.- Overrides:
reflowData
in classTScrollableWindow
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypress
in classTWindow
- Parameters:
keypress
- keystroke event
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse press events.- Overrides:
onMouseDown
in classTWindow
- Parameters:
mouse
- mouse button press event
-
onMouseUp
public void onMouseUp(TMouseEvent mouse)
Handle mouse release events.
-
onMouseMotion
public void onMouseMotion(TMouseEvent mouse)
Handle mouse motion events.- Overrides:
onMouseMotion
in classTWindow
- Parameters:
mouse
- mouse motion event
-
getHelpTopic
public java.lang.String getHelpTopic()
Get this window's help topic to load.- Overrides:
getHelpTopic
in classTWindow
- Returns:
- the topic name
-
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 window does not want the application-wide mouse cursor drawn over it.- Overrides:
hasHiddenMouse
in classTWindow
- Returns:
- true if this window does not want the application-wide mouse cursor drawn over it
-
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
-
setTitle
public final void setTitle(java.lang.String title, boolean override)
Set window title.- Parameters:
title
- new window titleoverride
- if true, force the title to never change regardless of the desired title from the running terminal
-
-