Package jexer.backend
Class TWindowBackend
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TWindow
-
- jexer.backend.TWindowBackend
-
public class TWindowBackend extends TWindow implements Backend
TWindowBackend uses a window in one TApplication to provide a backend for another TApplication. Note that TWindow has its own getScreen() and setTitle() functions. Clients in TWindowBackend's application won't be able to use it to get at the other application's screen. getOtherScreen() has been provided.
-
-
Field Summary
-
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 TWindowBackend(java.lang.Object listener, TApplication application, java.lang.String title, int width, int height)
Public constructor.TWindowBackend(java.lang.Object listener, TApplication application, java.lang.String title, int width, int height, int flags)
Public constructor.TWindowBackend(java.lang.Object listener, TApplication application, java.lang.String title, int x, int y, int width, int height)
Public constructor.TWindowBackend(java.lang.Object listener, TApplication application, java.lang.String title, int x, int y, int width, int height, int flags)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
draw()
Draw the foreground colors grid.void
flushScreen()
Subclasses must provide an implementation that syncs the logical screen to the physical device.void
getEvents(java.util.List<TInputEvent> queue)
Subclasses must provide an implementation to get keyboard, mouse, and screen resize events.Screen
getOtherScreen()
Getter for the other application's screen.SessionInfo
getSessionInfo()
Getter for sessionInfo.boolean
hasEvents()
Check if there are events in the queue.boolean
isReadOnly()
Check if backend is read-only.protected boolean
mouseOnOtherScreen(TMouseEvent mouse)
Returns true if the mouse is currently in the otherScreen window.void
onClose()
Subclasses should override this method to cleanup resources.void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
onMouseDown(TMouseEvent mouse)
Handle mouse button presses.void
onMouseMotion(TMouseEvent mouse)
Handle mouse movements.void
onMouseUp(TMouseEvent mouse)
Handle mouse button releases.void
onResize(TResizeEvent event)
Handle window/screen resize events.void
reloadOptions()
Reload backend options from System properties.void
setDrawLock(java.lang.Object drawLock)
Set the object to sync to in draw().void
setListener(java.lang.Object listener)
Set listener to a different Object.void
setOtherApplication(TApplication application)
Set the other screen's application.void
setReadOnly(boolean readOnly)
Set read-only flag.void
shutdown()
Subclasses must provide an implementation that closes sockets, restores console, etc.-
Methods inherited from class jexer.TWindow
activate, addShortcutKeypress, center, clearShortcutKeypresses, close, ensureOnScreen, getApplication, getBackground, getBorder, getBorderControls, getHelpTopic, getMaximumWindowHeight, getMaximumWindowWidth, getMinimumWindowHeight, getMinimumWindowWidth, getScreen, getStatusBar, getTitle, getZ, hasCloseBox, hasHiddenMouse, hasOverriddenMenu, hasZoomBox, hide, inMovements, isHidden, isModal, isResizable, isShortcutKeypress, isShown, maximize, mouseOnClose, mouseOnMaximize, mouseOnResize, newStatusBar, onCommand, onFocus, onHide, onMenu, onPreClose, onShow, onUnfocus, removeShortcutKeypress, restore, 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
-
-
-
-
Constructor Detail
-
TWindowBackend
public TWindowBackend(java.lang.Object listener, TApplication application, java.lang.String title, int width, int height)
Public constructor. Window will be located at (0, 0).- Parameters:
listener
- the object this backend needs to wake up when new input comes inapplication
- TApplication that manages this windowtitle
- window title, will be centered along the top borderwidth
- width of windowheight
- height of window
-
TWindowBackend
public TWindowBackend(java.lang.Object listener, TApplication application, java.lang.String title, int width, int height, int flags)
Public constructor. Window will be located at (0, 0).- Parameters:
listener
- the object this backend needs to wake up when new input comes inapplication
- TApplication that manages this windowtitle
- window title, will be centered along the top borderwidth
- width of windowheight
- height of windowflags
- bitmask of RESIZABLE, CENTERED, or MODAL
-
TWindowBackend
public TWindowBackend(java.lang.Object listener, TApplication application, java.lang.String title, int x, int y, int width, int height)
Public constructor.- Parameters:
listener
- the object this backend needs to wake up when new input comes inapplication
- TApplication that manages this windowtitle
- window title, will be centered along the top borderx
- column relative to parenty
- row relative to parentwidth
- width of windowheight
- height of window
-
TWindowBackend
public TWindowBackend(java.lang.Object listener, TApplication application, java.lang.String title, int x, int y, int width, int height, int flags)
Public constructor.- Parameters:
listener
- the object this backend needs to wake up when new input comes inapplication
- TApplication that manages this windowtitle
- window title, will be centered along the top borderx
- column relative to parenty
- row relative to parentwidth
- width of windowheight
- height of windowflags
- mask of RESIZABLE, CENTERED, or MODAL
-
-
Method Detail
-
onResize
public void onResize(TResizeEvent event)
Handle window/screen resize events.
-
mouseOnOtherScreen
protected boolean mouseOnOtherScreen(TMouseEvent mouse)
Returns true if the mouse is currently in the otherScreen window.- Parameters:
mouse
- mouse event- Returns:
- true if mouse is currently in the otherScreen window.
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse button presses.- Overrides:
onMouseDown
in classTWindow
- Parameters:
mouse
- mouse button event
-
onMouseUp
public void onMouseUp(TMouseEvent mouse)
Handle mouse button releases.
-
onMouseMotion
public void onMouseMotion(TMouseEvent mouse)
Handle mouse movements.- Overrides:
onMouseMotion
in classTWindow
- Parameters:
mouse
- mouse motion event
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypress
in classTWindow
- Parameters:
keypress
- keystroke event
-
onClose
public void onClose()
Subclasses should override this method to cleanup resources. This is called by application.closeWindow().
-
getSessionInfo
public final SessionInfo getSessionInfo()
Getter for sessionInfo.- Specified by:
getSessionInfo
in interfaceBackend
- Returns:
- the SessionInfo
-
flushScreen
public void flushScreen()
Subclasses must provide an implementation that syncs the logical screen to the physical device.- Specified by:
flushScreen
in interfaceBackend
-
hasEvents
public boolean hasEvents()
Check if there are events in the queue.
-
getEvents
public void getEvents(java.util.List<TInputEvent> queue)
Subclasses must provide an implementation to get keyboard, mouse, and screen resize events.
-
shutdown
public void shutdown()
Subclasses must provide an implementation that closes sockets, restores console, etc.
-
setListener
public void setListener(java.lang.Object listener)
Set listener to a different Object.- Specified by:
setListener
in interfaceBackend
- Parameters:
listener
- the new listening object that run() wakes up on new input
-
reloadOptions
public void reloadOptions()
Reload backend options from System properties.- Specified by:
reloadOptions
in interfaceBackend
-
isReadOnly
public boolean isReadOnly()
Check if backend is read-only.- Specified by:
isReadOnly
in interfaceBackend
- Returns:
- true if user input events from the backend are discarded
-
setReadOnly
public void setReadOnly(boolean readOnly)
Set read-only flag.- Specified by:
setReadOnly
in interfaceBackend
- Parameters:
readOnly
- if true, then input events will be discarded
-
setDrawLock
public void setDrawLock(java.lang.Object drawLock)
Set the object to sync to in draw().- Parameters:
drawLock
- the object to synchronize on
-
getOtherScreen
public Screen getOtherScreen()
Getter for the other application's screen.- Returns:
- the Screen
-
setOtherApplication
public void setOtherApplication(TApplication application)
Set the other screen's application.- Parameters:
application
- the application driving the other screen
-
-