public class GuiOutputManager extends OutputManager<GuiPrimitives>
| Modifier and Type | Field and Description |
|---|---|
private BootstrapConfig |
cfg
The initial configuration of this manager.
|
private WidgetRegistry<GuiOutputManager> |
registry
Widget registry.
|
private OutputManager<?> |
streamableMgr
The
StreamableManager instance used in redirected mode. |
CHUI_DRIVER_BATCH, CHUI_DRIVER_CONSOLE, CHUI_DRIVER_SWING, CHUI_DRIVER_WEB, defaultOutput, defaultTerminal, drawing, driver, GUI_DRIVER_SWING, GUI_DRIVER_WEB, invalidate, output| Constructor and Description |
|---|
GuiOutputManager(GuiDriver driver,
BootstrapConfig cfg)
Create a new output manager instance, with the specified driver.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEditableFrameForWidget(Widget<?> widget)
Register editable frame related widget resources.
|
void |
clear(Widget<?> widget)
Clear area occupied by specified widget.
|
GuiWidgetFactory |
getFactory()
Access driver-specific widget factory.
|
WidgetRegistry<GuiOutputManager> |
getRegistry()
Get the widget registry for this output manager.
|
StreamableManager |
getStreamableManager()
Get the ChUI manager for this manager instance, used for redirected terminal support.
|
boolean |
hasWindowEmulator(int windowId)
Check if window has an emulator for the given window id.
|
static GuiOutputManager |
instance()
Get the context-specific instance, if it exists.
|
boolean |
isRedirected()
Reports if the terminal is currently redirected to a stream.
|
OutputManager |
managerInstance()
Get the manager instance, depending if the mode is redirected or not.
|
protected TitledWindow<?> |
overrideWindow(TopLevelWindow<?> window)
Check if the window being drawn needs to be overridden.
|
protected boolean |
raiseStopCondition(int key)
Check if the given key can raise the STOP condition.
|
void |
realizeChildWindow(int ownerId,
int windowId,
java.lang.String windowTitle,
boolean resizable,
boolean isShareActivationWithOwner)
Realize new child window.
|
void |
realizeChildWindow(int ownerId,
int windowId,
java.lang.String windowTitle,
boolean resizable,
boolean isShareActivationWithOwner,
boolean modal)
Realize new child window.
|
void |
registerWindow(int windowId,
boolean showInTaskbar)
Registers new window with the UI driver.
|
void |
registerWindow(TopLevelWindow<?> window)
Registers new window with the UI driver.
|
void |
releaseWidgetResources(Widget<?> widget)
GUI Implementation specific method of removing widget from registry
|
void |
releaseWindow()
On a device which allows multiple windows to be created, this allows releasing the window to
allow drawing from other threads.
|
void |
releaseWindow(boolean redirected)
On a device which allows multiple windows to be created, this allows releasing the window to
allow drawing from other threads.
|
void |
removeEditableFrameForWidget(Widget<?> widget)
Release editable frame related widget resources.
|
protected ScreenBitmap |
screenBitmap(int windowId)
Determine the screen bitmap associated with the given window.
|
void |
selectWindow(int windowId)
On a device which allows multiple windows to be created, this allows selecting an explicit
window before using the primitives or before drawing a widget.
|
void |
setDisableRedraw(boolean value)
Sets the global SESSION:DISABLE-REDRAW attribute.
|
void |
setDrawingArea(Rectangle bounds)
Limit the available drawing area to the specified boundaries.
|
void |
setInvalidate(Widget<?> widget,
boolean mode,
boolean flush)
Sets the invalidation mode.
|
OutputPrimitives |
switchOutput(OutputPrimitives newOps)
Redirect terminal output to the drawing worker represented by
newOps (or back to the interactive terminal if
newOps is null) and return the instance
representing the current output destination. |
activateBatch, beep, clear, clear, clipWith, coordinates, drawNeeded, fixCoordinates, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getClippings, getClippings, getDriver, getInstanceDriver, getInteractiveOutput, getInvalidChars, inBatchMode, init, init, initErrorWriter, initErrorWriter, isBatchInBackground, isBatchModeOverride, isChui, isInvalidate, markArea, newInstance, readKey, refresh, resetBitmap, resetInvalidate, resetMode, resolveWidget, restoreInvalidate, resume, saveInvalidate, saveInvalidate, screenDimension, screenHeight, screenWidth, setBitmap, setCursorStatus, setInvalidate, setInvalidate, setTerminalType, startScreenSearch, suspend, sync, terminalTypeprivate WidgetRegistry<GuiOutputManager> registry
private final BootstrapConfig cfg
private final OutputManager<?> streamableMgr
StreamableManager instance used in redirected mode.public GuiOutputManager(GuiDriver driver, BootstrapConfig cfg)
driver - Implements low level input/output primitives. Must NOT be null.cfg - The initial configuration.public static GuiOutputManager instance()
null if none exists.public StreamableManager getStreamableManager()
getStreamableManager in class OutputManager<GuiPrimitives>streamableMgr instance.public boolean isRedirected()
isRedirected in class OutputManager<GuiPrimitives>true if the terminal is redirected to a stream,
false if the terminal is interactive.public void setInvalidate(Widget<?> widget, boolean mode, boolean flush)
When invalidation mode is set to true, all
PaintEvents are processed differently. Instead of causing
immediate drawing, they contribute their respective rectangles to the
invalidation rectangle. The moment the invalidation mode is being set to
false, the cumulative invalidation rectangle triggers
selective redrawing of the affected area.
setInvalidate in class OutputManager<GuiPrimitives>mode - true is an opening bracket for the invalidation
mode false is a closing bracket which
conditionally flushes the accumulated paint requestswidget - The widget which triggered this drawing. If is null, the window
as returned by WindowManager.findWindow(int) will be used; otherwise, the
widget's window will be used.flush - only meaningful for mode false. requests
unconditional flushing of all accumulated paint requestspublic OutputPrimitives switchOutput(OutputPrimitives newOps)
newOps (or back to the interactive terminal if
newOps is null) and return the instance
representing the current output destination. This may be another
null if the interactive terminal is in use.switchOutput in class OutputManager<GuiPrimitives>newOps - The drawing worker or null to remove redirections
and activate the interactive terminal.protected ScreenBitmap screenBitmap(int windowId)
After this call, the OutputManager.output will have selected the specified window.
WARNING! If the ScreenBitmap reference is saved and a code is called which in turn
ends up changing the ScreenBitmap reference (via the OutputManager.setBitmap(int, com.goldencode.p2j.ui.client.ScreenBitmap) API), then
ensure the proper reference is used!
screenBitmap in class OutputManager<GuiPrimitives>windowId - The window ID.ScreenBitmap associated with this window.public void registerWindow(TopLevelWindow<?> window)
registerWindow in class OutputManager<GuiPrimitives>window - A window.public void registerWindow(int windowId,
boolean showInTaskbar)
registerWindow in class OutputManager<GuiPrimitives>windowId - A window ID to be realized.showInTaskbar - If set to true the registered window will be shown in the system taskbar.public void realizeChildWindow(int ownerId,
int windowId,
java.lang.String windowTitle,
boolean resizable,
boolean isShareActivationWithOwner)
ownerId - The owning window ID.windowId - A window ID to be realized.windowTitle - Title of the realized window.resizable - true if the window is resizable.isShareActivationWithOwner - Indicates whether the window shares activation state with its owner.public void realizeChildWindow(int ownerId,
int windowId,
java.lang.String windowTitle,
boolean resizable,
boolean isShareActivationWithOwner,
boolean modal)
ownerId - The owning window ID.windowId - A window ID to be realized.windowTitle - Title of the realized window.resizable - true if the window is resizable.isShareActivationWithOwner - Indicates whether the window shares activation state with its owner.modal - true if this is a modal window.public void setDrawingArea(Rectangle bounds)
setDrawingArea in class OutputManager<GuiPrimitives>bounds - The bounds for the drawing area.public void setDisableRedraw(boolean value)
setDisableRedraw in class OutputManager<GuiPrimitives>value - Value to set to DISABLE-REDRAW attribute.public void clear(Widget<?> widget)
clear in class OutputManager<GuiPrimitives>widget - Reference widget.public GuiWidgetFactory getFactory()
getFactory in class OutputManager<GuiPrimitives>public WidgetRegistry<GuiOutputManager> getRegistry()
getRegistry in class OutputManager<GuiPrimitives>public OutputManager managerInstance()
managerInstance in class OutputManager<GuiPrimitives>public void selectWindow(int windowId)
selectWindow in class OutputManager<GuiPrimitives>windowId - Window ID.public void releaseWindow()
releaseWindow in class OutputManager<GuiPrimitives>public void releaseWindow(boolean redirected)
The method allows to explicitly direct the window release to the interactive or the redirected output.
releaseWindow in class OutputManager<GuiPrimitives>redirected - The parameter directs the window release either to the interactive or the redirected output.public boolean hasWindowEmulator(int windowId)
hasWindowEmulator in class OutputManager<GuiPrimitives>windowId - Window ID.true if window has an associated emulator, false
otherwise.protected boolean raiseStopCondition(int key)
raiseStopCondition in class OutputManager<GuiPrimitives>key - The key code to be checked.true if the key is the Key.VK_CTRL_BREAK key.protected TitledWindow<?> overrideWindow(TopLevelWindow<?> window)
In GUI, the window parameter is returned.
overrideWindow in class OutputManager<GuiPrimitives>window - The currently active window.public void releaseWidgetResources(Widget<?> widget)
releaseWidgetResources in class OutputManager<GuiPrimitives>widget - Widget to have resources releasedpublic void removeEditableFrameForWidget(Widget<?> widget)
removeEditableFrameForWidget in class OutputManager<GuiPrimitives>widget - Widget to have resources releasedpublic void addEditableFrameForWidget(Widget<?> widget)
addEditableFrameForWidget in class OutputManager<GuiPrimitives>widget - Widget to have resources released