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, overlay, OVERRIDEMENU, RESIZABLE, statusBar, underlay
-
-
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
isImagesOverText()
Check if backend will support incomplete image fragments over text display.boolean
isPixelMouse()
Check if backend is reporting pixel-based mouse position.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
setPixelMouse(boolean pixelMouse)
Set request for backend to report pixel-based mouse position.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, addOverlay, addShortcutKeypress, addUnderlay, 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, setTackboardsDirty, 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, getCustomMousePointer, getHeight, getLayoutManager, getMouseStyle, getParent, getTheme, getWidgetUnderMouse, 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, setCustomMousePointer, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setHeight, setLayoutManager, setMouseStyle, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, vLineXY
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jexer.backend.Backend
getScreen, setMouseStyle, setTitle
-
-
-
-
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
-
isImagesOverText
public boolean isImagesOverText()
Check if backend will support incomplete image fragments over text display.- Specified by:
isImagesOverText
in interfaceBackend
- Returns:
- true if images can partially obscure text
-
isPixelMouse
public boolean isPixelMouse()
Check if backend is reporting pixel-based mouse position.- Specified by:
isPixelMouse
in interfaceBackend
- Overrides:
isPixelMouse
in classTWidget
- Returns:
- true if single-pixel mouse movements are reported
-
setPixelMouse
public void setPixelMouse(boolean pixelMouse)
Set request for backend to report pixel-based mouse position.- Specified by:
setPixelMouse
in interfaceBackend
- Parameters:
pixelMouse
- if true, single-pixel mouse movements will be reported, if the backend supports it
-
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
-
-