public abstract class GuiPrimitivesImpl extends java.lang.Object implements GuiPrimitives
This interface is for GUI-specific features. It is intended to be specific to a given UI-modality (GUI in this case). No driver-specific implementation classes or features should be present. For example, no Swing-specific feature usage is allowed.
The actual GUI processing does not heavily utilize the pluggable OutputPrimitives
interface. In other words, the interactive UI processing GUI is not switched in and out like
in ChUI. For this reason, the core output processing in ChUI is driven using the primitives
approach, but in GUI we simply honor the minimum implementation in this class. The majority
of this class is really about providing access to and management of the core window structure.
The primitives implementation is secondary, but the functionality is best implemented here.
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.Integer,EmulatedWindowState> |
emulators
Registry of window emulators.
|
protected EmulatedWindowState |
ews
Current GUI emulator.
|
| Constructor and Description |
|---|
GuiPrimitivesImpl()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearArea(int left,
int top,
int right,
int bottom,
Color color)
Clear specified area at the screen.
|
void |
deregisterWindow(int windowId)
Deregister this window from the driver.
|
ScreenBitmap |
getScreenBitmap()
Get the screen bitmap for the current window.
|
EmulatedWindowState |
getWindowEmulator()
Get the currently selected window emulator.
|
EmulatedWindowState |
getWindowEmulatorSafe(int windowId)
Returns the window emulator registered for the supplied window id.
|
int |
getWindowId()
Get the ID of the window currently selected.
|
boolean |
hasWindowEmulator(int windowId)
Check if window has an emulator for the given window id.
|
void |
refresh(NativeRectangle rect)
Refresh specified area.
|
void |
registerWindow(int windowId,
EmulatedWindowState ews)
Register a new window with the driver.
|
void |
releaseWindow()
On a device which allows multiple windows to be created, this allows releasing the window to
allow drawing from other threads.
|
int |
screenHeight()
Get the screen height, in character units.
|
int |
screenWidth()
Get the screen width, in character units.
|
void |
selectWindow(int windowId)
On a GUI interface multiple windows can be created.
|
void |
setScreenBitmap(ScreenBitmap bitmap)
Set the active screen bitmap for the current window.
|
void |
shutdown()
Perform shutdown.
|
abstract void |
sync()
Synchronize screen.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetWindowEmulatorprotected EmulatedWindowState ews
private java.util.Map<java.lang.Integer,EmulatedWindowState> emulators
public void clearArea(int left,
int top,
int right,
int bottom,
Color color)
clearArea in interface OutputPrimitivesleft - Left coordinate of the area.top - Top coordinate of the area.right - Right coordinate of the area.bottom - Bottom coordinate of the area.color - Color.public void refresh(NativeRectangle rect)
This is a no-op.
refresh in interface OutputPrimitivesrect - Area to refresh.public int screenWidth()
screenWidth in interface OutputPrimitivespublic int screenHeight()
screenHeight in interface OutputPrimitivespublic abstract void sync()
Driver level implementation of this method should force flushing internal low-level buffers to screen. This method requires implementation only if operating system or hardware uses internal buffering for the terminal output. Otherwise this method can do nothing.
sync in interface OutputPrimitivespublic void setScreenBitmap(ScreenBitmap bitmap)
setScreenBitmap in interface OutputPrimitivesbitmap - The screen bitmap.public ScreenBitmap getScreenBitmap()
getScreenBitmap in interface OutputPrimitivespublic int getWindowId()
getWindowId in interface OutputPrimitivespublic EmulatedWindowState getWindowEmulator()
getWindowEmulator in interface GuiPrimitivespublic EmulatedWindowState getWindowEmulatorSafe(int windowId)
getWindowEmulatorSafe in interface GuiPrimitiveswindowId - A valid window id.java.lang.RuntimeException - When no window emulator is registered for the supplied window id.public boolean hasWindowEmulator(int windowId)
hasWindowEmulator in interface GuiPrimitiveswindowId - Window ID.true if window has an associated emulator, true
otherwise.public void registerWindow(int windowId,
EmulatedWindowState ews)
registerWindow in interface GuiPrimitiveswindowId - The window ID.ews - New emulated window state to register.public void deregisterWindow(int windowId)
deregisterWindow in interface GuiPrimitiveswindowId - The window ID.public void selectWindow(int windowId)
selectWindow in interface GuiPrimitiveswindowId - Window ID.public void releaseWindow()
releaseWindow in interface GuiPrimitivespublic void shutdown()
shutdown in interface GuiPrimitives