Package jexer.backend
Interface Backend
-
- All Known Implementing Classes:
ECMA48Backend,GenericBackend,HeadlessBackend,MultiBackend,SwingBackend,TWindowBackend
public interface BackendThis interface provides a screen, keyboard, and mouse to TApplication. It also exposes session information as gleaned from lower levels of the communication stack.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.awt.ColorattrToBackgroundColor(CellAttributes attr)Convert a CellAttributes background color to an AWT Color.java.awt.ColorattrToForegroundColor(CellAttributes attr)Convert a CellAttributes foreground color to an AWT Color.voidcopyClipboardText(java.lang.String text)Copy text to the system clipboard of the terminal on the backend.voidflushScreen()Classes must provide an implementation that syncs the logical screen to the physical device.voidgetEvents(java.util.List<TInputEvent> queue)Classes must provide an implementation to get keyboard, mouse, and screen resize events.ScreengetScreen()Get a Screen, which displays the text cells to the user.SessionInfogetSessionInfo()Get a SessionInfo, which exposes text width/height, language, username, and other information from the communication stack.booleanhasEvents()Check if there are events in the queue.booleanisFocused()Get window/terminal system focus.booleanisImagesOverText()Check if backend will support incomplete image fragments over text display.booleanisPixelMouse()Check if backend is reporting pixel-based mouse position.booleanisReadOnly()Check if backend is read-only.voidreloadOptions()Reload backend options from System properties.voidsetListener(java.lang.Object listener)Set listener to a different Object.voidsetMouseStyle(java.lang.String mouseStyle)Set the mouse pointer (cursor) style.voidsetPixelMouse(boolean pixelMouse)Set request for backend to report pixel-based mouse position.voidsetReadOnly(boolean readOnly)Set read-only flag.voidsetTitle(java.lang.String title)Classes must provide an implementation that sets the window title.voidshutdown()Classes must provide an implementation that closes sockets, restores console, etc.
-
-
-
Method Detail
-
getSessionInfo
SessionInfo getSessionInfo()
Get a SessionInfo, which exposes text width/height, language, username, and other information from the communication stack.- Returns:
- the SessionInfo
-
getScreen
Screen getScreen()
Get a Screen, which displays the text cells to the user.- Returns:
- the Screen
-
flushScreen
void flushScreen()
Classes must provide an implementation that syncs the logical screen to the physical device.
-
hasEvents
boolean hasEvents()
Check if there are events in the queue.- Returns:
- if true, getEvents() has something to return to the application
-
getEvents
void getEvents(java.util.List<TInputEvent> queue)
Classes must provide an implementation to get keyboard, mouse, and screen resize events.- Parameters:
queue- list to append new events to
-
shutdown
void shutdown()
Classes must provide an implementation that closes sockets, restores console, etc.
-
setTitle
void setTitle(java.lang.String title)
Classes must provide an implementation that sets the window title.- Parameters:
title- the new title
-
setListener
void setListener(java.lang.Object listener)
Set listener to a different Object.- Parameters:
listener- the new listening object that run() wakes up on new input
-
reloadOptions
void reloadOptions()
Reload backend options from System properties.
-
isReadOnly
boolean isReadOnly()
Check if backend is read-only.- Returns:
- true if user input events from the backend are discarded
-
setReadOnly
void setReadOnly(boolean readOnly)
Set read-only flag.- Parameters:
readOnly- if true, then input events will be discarded
-
isImagesOverText
boolean isImagesOverText()
Check if backend will support incomplete image fragments over text display.- Returns:
- true if images can partially obscure text
-
isPixelMouse
boolean isPixelMouse()
Check if backend is reporting pixel-based mouse position.- Returns:
- true if single-pixel mouse movements are reported
-
setPixelMouse
void setPixelMouse(boolean pixelMouse)
Set request for backend to report pixel-based mouse position.- Parameters:
pixelMouse- if true, single-pixel mouse movements will be reported, if the backend supports it
-
setMouseStyle
void setMouseStyle(java.lang.String mouseStyle)
Set the mouse pointer (cursor) style.- Parameters:
mouseStyle- the pointer style string, one of: "default", "none", "hand", "text", "move", or "crosshair"
-
attrToForegroundColor
java.awt.Color attrToForegroundColor(CellAttributes attr)
Convert a CellAttributes foreground color to an AWT Color.- Parameters:
attr- the text attributes- Returns:
- the AWT Color
-
attrToBackgroundColor
java.awt.Color attrToBackgroundColor(CellAttributes attr)
Convert a CellAttributes background color to an AWT Color.- Parameters:
attr- the text attributes- Returns:
- the AWT Color
-
copyClipboardText
void copyClipboardText(java.lang.String text)
Copy text to the system clipboard of the terminal on the backend. Not all terminals support this (OSC 52).- Parameters:
text- string to copy
-
isFocused
boolean isFocused()
Get window/terminal system focus.- Returns:
- true if this backend has the mouse/keyboard focus
-
-