Package jexer.backend
Class GenericBackend
- java.lang.Object
-
- jexer.backend.GenericBackend
-
- All Implemented Interfaces:
Backend
- Direct Known Subclasses:
ECMA48Backend,SwingBackend
public abstract class GenericBackend extends java.lang.Object implements Backend
This abstract class provides a screen, keyboard, and mouse to TApplication. It also exposes session information as gleaned from lower levels of the communication stack.
-
-
Field Summary
Fields Modifier and Type Field Description protected longlastUserInputTimeThe last time user input (mouse or keyboard) was received.protected booleanreadOnlyWhether or not this backend is read-only.protected ScreenscreenThe screen to draw on.protected SessionInfosessionInfoThe session information.protected TerminalReaderterminalInput events are processed by this Terminal.
-
Constructor Summary
Constructors Modifier Constructor Description protectedGenericBackend()Default constructor used by subclasses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflushScreen()Sync the logical screen to the physical device.voidgetEvents(java.util.List<TInputEvent> queue)Get keyboard, mouse, and screen resize events.ScreengetScreen()Getter for screen.SessionInfogetSessionInfo()Getter for sessionInfo.booleanhasEvents()Check if there are events in the queue.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)Set the window title.voidshutdown()Close the I/O, restore the console, etc.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jexer.backend.Backend
attrToBackgroundColor, attrToForegroundColor
-
-
-
-
Field Detail
-
sessionInfo
protected SessionInfo sessionInfo
The session information.
-
screen
protected Screen screen
The screen to draw on.
-
terminal
protected TerminalReader terminal
Input events are processed by this Terminal.
-
lastUserInputTime
protected long lastUserInputTime
The last time user input (mouse or keyboard) was received.
-
readOnly
protected boolean readOnly
Whether or not this backend is read-only.
-
-
Method Detail
-
getSessionInfo
public final SessionInfo getSessionInfo()
Getter for sessionInfo.- Specified by:
getSessionInfoin interfaceBackend- Returns:
- the SessionInfo
-
getScreen
public final Screen getScreen()
Getter for screen.
-
flushScreen
public void flushScreen()
Sync the logical screen to the physical device.- Specified by:
flushScreenin interfaceBackend
-
hasEvents
public boolean hasEvents()
Check if there are events in the queue.
-
getEvents
public void getEvents(java.util.List<TInputEvent> queue)
Get keyboard, mouse, and screen resize events.
-
shutdown
public void shutdown()
Close the I/O, restore the console, etc.
-
setTitle
public void setTitle(java.lang.String title)
Set the window title.
-
setListener
public void setListener(java.lang.Object listener)
Set listener to a different Object.- Specified by:
setListenerin 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:
reloadOptionsin interfaceBackend
-
isReadOnly
public boolean isReadOnly()
Check if backend is read-only.- Specified by:
isReadOnlyin interfaceBackend- Returns:
- true if user input events from the backend are discarded
-
setReadOnly
public void setReadOnly(boolean readOnly)
Set read-only flag.- Specified by:
setReadOnlyin 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:
isImagesOverTextin interfaceBackend- Returns:
- true if images can partially obscure text
-
isPixelMouse
public boolean isPixelMouse()
Check if backend is reporting pixel-based mouse position.- Specified by:
isPixelMousein interfaceBackend- 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:
setPixelMousein interfaceBackend- Parameters:
pixelMouse- if true, single-pixel mouse movements will be reported, if the backend supports it
-
setMouseStyle
public void setMouseStyle(java.lang.String mouseStyle)
Set the mouse pointer (cursor) style.- Specified by:
setMouseStylein interfaceBackend- Parameters:
mouseStyle- the pointer style string, one of: "default", "none", "hand", "text", "move", or "crosshair"
-
-