Package jexer
Class TTerminalWindow
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TWindow
-
- jexer.TScrollableWindow
-
- jexer.TTerminalWindow
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>,Scrollable
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 TTerminalWidgetterminalThe terminal.-
Fields inherited from class jexer.TScrollableWindow
hScroller, vScroller
-
Fields inherited from class jexer.TWindow
ABSOLUTEXY, borderStyleActive, borderStyleActiveModal, borderStyleInactive, borderStyleMoving, CENTERED, helpTopic, HIDEONCLOSE, inKeyboardResize, inWindowMove, inWindowResize, MODAL, mouse, NOCLOSEBOX, NOZOOMBOX, overlay, OVERRIDEMENU, RESIZABLE, statusBar, underlay
-
-
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 voiddraw()Draw the display buffer.java.lang.String[]getCommandLine()Get the full command line that spawned the shell.intgetExitValue()Get the exit value for the emulator.java.lang.StringgetHelpTopic()Get this window's help topic to load.booleanhasHiddenMouse()Returns true if this window does not want the application-wide mouse pointer drawn over it.booleanisPixelMouse()Check if per-pixel mouse events are requested.voidonKeypress(TKeypressEvent keypress)Handle keystrokes.voidonMouseDown(TMouseEvent mouse)Handle mouse press events.voidonMouseMotion(TMouseEvent mouse)Handle mouse motion events.voidonMouseUp(TMouseEvent mouse)Handle mouse release events.voidonResize(TResizeEvent resize)Handle window/screen resize events.voidonShellExit()Hook for subclasses to be notified of the shell termination.voidreflowData()Resize scrollbars for a new width/height.voidsetTitle(java.lang.String title, boolean override)Set window title.booleanwaitForOutput(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, addOverlay, addShortcutKeypress, addUnderlay, center, clearShortcutKeypresses, close, disableCloseEffect, disableOpenEffect, ensureOnScreen, getAlpha, getApplication, getBackground, getBorder, getBorderControls, getBorderStyle, getBorderStyleForeground, getBorderStyleInactive, getBorderStyleModal, getBorderStyleMoving, getMaximumWindowHeight, getMaximumWindowWidth, getMinimumWindowHeight, getMinimumWindowWidth, getMouseStyle, getScreen, getStatusBar, getTitle, getWindowTheme, getZ, hasCloseBox, hasOverriddenMenu, hasZoomBox, hide, inMovements, isHidden, isModal, isResizable, isShortcutKeypress, isShown, mouseOnClose, mouseOnMaximize, mouseOnResize, newStatusBar, onClose, onCommand, onFocus, onHide, onMenu, onPostDraw, onPreClose, onShow, onUnfocus, removeShortcutKeypress, setAlpha, setBorderStyleForeground, setBorderStyleInactive, setBorderStyleModal, setBorderStyleMoving, setCloseBox, setHiddenMouse, setMaximumWindowHeight, setMaximumWindowWidth, setMinimumWindowHeight, setMinimumWindowWidth, setResizable, setTackboardsDirty, setTitle, setWindowTheme, 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, 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, getCustomMousePointer, getHeight, getLayoutManager, getLocale, getParent, getTheme, getWidgetUnderMouse, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, 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, setCustomMousePointer, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setHeight, setLayoutManager, setLocale, setMouseStyle, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, vLineXY, 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, as an array of strings which signifies the external program file to be invoked (command[0]) and its arguments, if any (command[1], command[2], ...). Refer also to java.lang.ProcessBuilder for further operating-system specific details.
-
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 execute, as an array of strings which signifies the external program file to be invoked (command[0]) and its arguments, if any (command[1], command[2], ...). Refer also to java.lang.ProcessBuilder for further operating-system specific details.closeOnExit- 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:
onResizein classTScrollableWindow- Parameters:
resize- resize event
-
reflowData
public void reflowData()
Resize scrollbars for a new width/height.- Overrides:
reflowDatain classTScrollableWindow
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypressin classTWindow- Parameters:
keypress- keystroke event
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse press events.- Overrides:
onMouseDownin 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:
onMouseMotionin classTWindow- Parameters:
mouse- mouse motion event
-
getHelpTopic
public java.lang.String getHelpTopic()
Get this window's help topic to load.- Overrides:
getHelpTopicin 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 pointer drawn over it.- Overrides:
hasHiddenMousein classTWindow- Returns:
- true if this window does not want the application-wide mouse pointer drawn over it
-
isPixelMouse
public boolean isPixelMouse()
Check if per-pixel mouse events are requested.- Overrides:
isPixelMousein classTWidget- Returns:
- true if per-pixel mouse events are requested
-
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
-
-