public interface GuiDriver<F,I> extends ScreenDriver<GuiOutputManager>
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(MsgBlasterPeer listener,
int windowId,
int widgetId)
Add a low-level message listener for a specific window.
|
void |
cacheTextMetrics(java.util.Map<FontDetails<F>,java.util.Set<java.lang.String>> texts,
java.lang.Integer windowId)
Get and cache metrics for the given texts.
|
void |
changeSensitivity(int widgetId,
boolean sensitive)
Change the sensitivity of a driver-implemented widget.
|
void |
changeVisibility(int widgetId,
boolean visible)
Change the visibility of a driver-implemented widget.
|
java.lang.String |
clipboardContents()
Get the current contents from the OS clipboard.
|
void |
copyToClipboard(java.lang.String txt)
Copy the given text to the system clipboard.
|
FontDetails<F> |
createFont(FontDetails<F> details)
Create a font with the given details and register it with the driver.
|
ImageWrapper<I> |
createGreyImage(I imageIni)
Create a native grey image from the original initial image to be used for disabled control
states.
|
MousePtrWrapper |
createMousePointer(java.io.InputStream data,
java.lang.String ptrName)
Load mouse pointer from the InputStream
|
<T extends DriverWidget> |
createWidget(java.lang.Class<T> widgetClass,
int widgetId)
Create a driver-implemented widget.
|
void |
createWidget(java.lang.String type,
int widgetId)
Create a driver-implemented widget.
|
void |
deiconifyWindow(int windowId)
De-iconify the window.
|
void |
deliverDocumentOutput(java.util.function.Consumer<java.io.OutputStream> consumer,
java.lang.Runnable finalizer,
MediaType format,
java.lang.String uuid,
boolean promptUser)
The method delivers document output to the client.
|
void |
deregisterTooltipWorkers(int wid)
Deregister the tooltip workers already registered with mouse handler.
|
void |
deregisterWidget(int wid)
Deregister the specified widget for mouse events.
|
void |
deregisterWindow(int windowId)
Deregister a given window from the driver.
|
void |
destroyWidget(int widgetId)
Destroy the driver-specific widget.
|
void |
draw(NativePoint origin,
NativeRectangle clip,
java.lang.Runnable core)
Execute a widget drawing bracket.
|
void |
draw(WidgetId id,
NativePoint origin,
NativeRectangle clip,
java.lang.Runnable core)
Execute a widget drawing bracket.
|
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draws a 3-D highlighted outline of the specified rectangle.
|
void |
drawCursor(LightweightTextWidget widget)
Draws the cursor for the given text widget.
|
void |
drawEdge(int left,
int top,
int width,
int height,
int edgeType,
int flags)
Draw one or more edges of rectangle.
|
void |
drawEllipse(int x,
int y,
int width,
int height)
Draws an ellipse.
|
void |
drawFromOrigin(NativePoint origin,
NativeRectangle clip,
java.lang.Runnable core)
Execute a widget drawing bracket.
|
void |
drawHighlight(int x,
int y,
int width,
int height,
ColorRgb color)
Draws a highlighted rectangular area of the specified color and bounds.
|
void |
drawIbeam(int x1,
int y1,
int x2,
int y2)
Draws a text fields caret, using the current color, between the points
(x1, y1) and (x2, y2)
in this graphics context's coordinate system. |
void |
drawImage(ImageWrapper<I> img,
int x,
int y,
int w,
int h,
int xoff,
int yoff,
boolean transparent,
boolean stretch,
boolean retain,
boolean convert3D)
Draw an image at the specified location.
|
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line, using the current color, between the points
(x1, y1) and (x2, y2)
in this graphics context's coordinate system. |
void |
drawParagraph(java.lang.String text,
FontDetails<F> font,
int x,
int y,
int maxWidth)
Draws a multiline text (paragraph) at the supplied position and
with the specified font.
|
void |
drawRect(int x,
int y,
int width,
int height)
Draw a rectangle.
|
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcDiameter)
Draw a rounded rectangle.
|
void |
drawSelection(int x,
int y,
int width,
int height,
boolean clear)
Draw a selection box rectangular area with current color.
|
void |
drawString(java.lang.String text,
int x,
int y)
Draw a string at the specified location.
|
void |
drawStringCentered(java.lang.String text,
int x,
int height)
Draw a string at the specified location.
|
void |
drawStringCentered(java.lang.String text,
int legacyWidth,
int legacyHeight,
int x,
int height)
Draw a string using the current font, which will be scaled so that the final string will
have the specified legacy width and height.
|
void |
drawStringScaled(java.lang.String text,
int legacyWidth,
int legacyHeight,
int x,
int y)
Draw a string using the current font, which will be scaled so that the final string will
have the specified legacy width and height.
|
void |
drawStringWithinBox(int xPosition,
int yPosition,
int boxWidth,
int boxHeight,
java.lang.String text,
int[] indices,
boolean centered)
Draw a given text within a box given by its relative coordinates.
|
void |
drawStringWithinBoxScaled(int xPosition,
int yPosition,
int boxWidth,
int boxHeight,
java.lang.String text,
int[] indices,
boolean centered)
Draw a given text within a box given by its relative coordinates.
|
void |
drawStringWithinBoxWithMnemonic(java.lang.String text,
int xPosition,
int yPosition,
int boxWidth,
int boxHeight,
MnemonicInfo info,
GuiFontResolver gf,
AbstractWidget<GuiOutputManager> widget,
boolean centered)
Draw a string with a mnemonic within the given box.
|
void |
drawStringWithMnemonic(java.lang.String text,
NativePoint tp,
MnemonicInfo info,
GuiFontResolver gf,
AbstractWidget<GuiOutputManager> widget,
boolean centered)
Draw a string with a mnemonic.
|
void |
drawTextSelection(LightweightTextWidget.TextLineSelection textLine,
Theme.TextLookAndFeel textLookAndFeel,
int x,
int y,
int lineHeight,
int fontDescent)
Draw a text selection.
|
void |
enableEvents(int[] windowIds,
boolean process)
Enable or Disable OS-level events for the specified windows.
|
void |
endBatch()
End a batch drawing routine.
|
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
Paints a 3-D highlighted rectangle filled with the current color.
|
void |
fillEllipse(int x,
int y,
int width,
int height)
Fills an ellipse.
|
void |
fillPolygon(int[] xPoints,
int[] yPoints)
Fill polygon.
|
void |
fillRect(int x,
int y,
int width,
int height)
Fill a rectangle.
|
void |
fillRectAroundText(int x,
int y,
int textWidthHint,
int textHeightHint,
java.lang.String text)
Fill a rectangle around the given text.
|
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcDiameter)
Fill a rounded rectangle.
|
java.lang.String |
fitStringWithEllipsis(java.lang.String text,
FontDetails<F> font,
int maxWidth)
Shortens the input string so that it fits the specified width.
|
default int[] |
getBasicWebPalette()
Queries the web driver for a basic palette.
|
ColorRgb |
getBgColor(int index)
Get BGCOLOR color.
|
ColorRgb |
getBgStdColor(java.lang.String stdColor)
Get background color for a standard color like NORMAL, INPUT or MESSAGES.
|
NativeRectangle |
getDisplayBounds(int windowId)
Returns bounds of a physical screen the passed in window is positioned on.
|
NativeRectangle |
getDisplayWorkArea(int windowId)
Returns an application-usable display area.
|
DriverWidget |
getDriverWidget(int widgetId)
Returns driver widget from the supplied id.
|
ColorRgb |
getFgColor(int index)
Get FGCOLOR color.
|
ColorRgb |
getFgStdColor(java.lang.String stdColor)
Get foreground color for a standard color like NORMAL, INPUT or MESSAGES.
|
int |
getFontHeight(FontDetails<F> font)
Get the height of the specified font.
|
int |
getFontMaxWidth(FontDetails<F> font)
Get the maximum font width, for the given font.
|
int |
getFontWidth(FontDetails<F> font)
Get the width of the specified font.
|
int[] |
getFontWidths(FontDetails<F> fd)
Report the advance widths of the first 256 characters in the font.
|
NativePoint |
getMousePosition()
Returns current mouse cursor display position relative to the display origin.
|
int |
getParagraphHeight(java.lang.String text,
FontDetails<F> font,
int maxWidth)
The method performs a layout operation on the supplied text and
returns the resulting paragraph height while maintaining the
supplied maximum width.
|
int |
getScreenResolution()
Reports the screen resolution in dots per inch (DPI).
|
ImageWrapper<I> |
getSubImage(ImageWrapper<I> img,
int x,
int y,
int width,
int height)
Creates a sub image from the supplied source image, offset coordinates and size.
|
ColorRgb |
getSysColor(int index)
Get a system color.
|
int |
getTextHeight(java.lang.String text,
FontDetails<F> font)
Get the height of the specified text, using the given font.
|
int |
getTextWidth(java.lang.String text,
FontDetails<F> font)
Get the width of the specified text, using the given font.
|
int[][] |
getTextWidths(java.lang.String[] texts,
FontDetails<F> font)
Get the widths of the specified texts, using the given font.
|
int[] |
getTextWidths(java.lang.String text,
FontDetails<F> font)
Get the widths of the specified text, using the given font.
|
NativeDimension |
getVirtualScreenSize()
Returns the size of the virtual screen, i.e.
|
NativeDimension |
getWindowDimension()
Get the physical window dimension, in pixel units.
|
NativePoint |
getWindowLocation()
Get the window location on screen.
|
boolean |
hasWindowEmulator(int windowId)
Check if window has an emulator for the given window id.
|
void |
iconifyWindow(int windowId)
Iconify the window.
|
default void |
initDragAndDrop(ServerExports srv)
Initializes several client specific internal variables used with drag-n-drop.
|
java.lang.Object |
invokeWidgetCommand(int widgetId,
java.lang.Enum command,
java.lang.Object[] args)
Invokes command on a widget implemented at the driver level.
|
java.lang.Object |
invokeWidgetCommand(int widgetId,
java.lang.String command,
java.lang.Object[] args)
Invokes command on a widget implemented at the driver level.
|
boolean |
isFontInstalled(java.lang.String fontName,
boolean boldFont,
boolean webScale)
Queries if the target font is installed.
|
boolean |
isWindowDecorationSupported()
Returns true if a window can be decorated in this graphics environment, otherwise false.
|
boolean |
isWindowVisible()
Check if the currently selected window is visible.
|
void |
moveToBottom(int windowId)
Move the specified window to the bottom of the z-order, at the OS level.
|
void |
moveToTop(int windowId,
boolean focus)
Move the specified window to the top of the z-order, at the OS level.
|
boolean |
needsExplicitTextMetricsCaching()
Returns
true if getting actual text metrics is an expensive operation for this
driver and you want to manually manage metrics cache using
cacheTextMetrics(Map, Integer) . |
default void |
notifyWait()
The method is called when the 4GL program execution enters a modal or wait-for event loop,
in other words when user input is expected.
|
default int[][] |
parseEditorContent(int widgetId,
int windowId,
int maxWidth,
java.lang.String text,
int delta,
FontDetails<F> font)
Split the text for a editor widget, so that it fits the specified maximum width.
|
void |
placeWidget(int widgetId,
NativeRectangle bounds)
Place the driver-specific widget at the specified bounds, using the currently selected
window.
|
default void |
propagateWaitState(boolean isWaitState)
Propagate wait state
|
void |
registerChildWindow(int ownerId,
int windowId,
java.lang.String windowTitle,
boolean resizable,
boolean isShareActivationWithOwner,
boolean modal)
Register new child window with the driver.
|
void |
registerDirectManipulation(Widget<GuiOutputManager> widget)
Register the specified widget as a container able to use direct manipulation via mouse.
|
void |
registerEmptySelector(Widget<GuiOutputManager> widget)
Register the specified widget as a container able to deselect all widgets from the window.
|
void |
registerHoverableWidget(MouseHoverAction action)
Register this widget as being editable, so that the mouse cursor will adjust properly when
the widget is entered.
|
void |
registerMouseWidgets()
Register all the mouse-aware widgets (in all Windows) with the driver.
|
void |
registerMoveableWidget(int wid)
Register the specified widget as a moveable widget, via mouse.
|
void |
registerPendingTooltipWorkers(int wid)
Register the tooltip workers if this process was dalayed with regular registration.
|
void |
registerResizeableWidget(int wid)
Register the specified widget as a resizeable widget, via mouse.
|
void |
registerTooltipWorker(Widget<GuiOutputManager> widget,
int font,
boolean now)
Register this widget as having tooltip functionality reacting on mouse entering and exiting
events.
|
void |
registerWidgetPopup(int wid,
int btn,
int pid)
Register the specified widget for popup events, via mouse.
|
void |
registerWindow(int windowId,
boolean showInTaskbar)
Register a new window with the driver.
|
void |
releaseWindow()
Release the last window used by the current thread.
|
void |
removeMessageListener(MsgBlasterPeer listener,
int windowId,
int widgetId)
Removes a low-level message listener for a specific window.
|
void |
resetComposite()
Reset composite mode and return to normal drawing mode.
|
default void |
resetSelection()
Reset selection boxes painting mode and return to normal drawing mode.
|
void |
resizeWindow(int width,
int height)
Resize window.
|
void |
restoreDrawingState(java.lang.Object state)
Restore the drawing state to the specified state.
|
java.lang.Object |
saveDrawingState()
Save the current drawing state and release the drawing lock, so that other threads can
acquire it.
|
void |
scaleFont(FontDetails<F> font)
Scale the font so its width and height match the legacy values.
|
void |
selectWindow(int windowId)
On a GUI interface multiple windows could be created.
|
default void |
setAlwaysOnTop(int windowId,
boolean topOnly,
boolean alwaysOnTop)
Makes the supplied window to be on top of other windows.
|
void |
setColor(java.awt.Color color)
Set current color used on draw operations.
|
void |
setColor(ColorRgb color)
Set current color used on draw operations.
|
void |
setCurrentSelection(java.lang.String txt)
Sets the current selection.
|
default void |
setCursor(MousePtrWrapper ptr)
Set the mouse cursor
|
default void |
setCursor(java.lang.String image)
Set the mouse cursor from resource
|
void |
setDesktopBgColor(ColorRgb color)
Set the desktop background color.
|
void |
setDisableRedraw(boolean value)
Sets the global SESSION:DISABLE-REDRAW attribute.
|
void |
setDrawingArea(NativeRectangle bounds)
Limit the available drawing area to the specified boundaries.
|
void |
setDrawingAreas(java.util.Set<NativeRectangle> bounds)
Limit the available drawing area to the specified boundaries provided in the
bounds parameter. |
void |
setFontStyle(FontStyle style)
Set the style of the current font used on draw operations.
|
void |
setGuiFont(FontDetails<F> font)
Set current font used on draw operations.
|
void |
setIcon(ImageWrapper<I> icon,
int x,
int y,
int width,
int height,
int xoff,
int yoff,
boolean transparent,
boolean stretch,
boolean retain,
boolean convert3D)
Sets the image to the window to be displayed as the window icon representation
for the system task bar, the title window panel or the system tray icons panel.
|
void |
setLineStroke(LineStroke stroke)
Set the style of the current line drawing primitives.
|
void |
setLineStroke(LineStroke stroke,
float width)
Set the style of the current line drawing primitives.
|
void |
setResizeableWindow(boolean resize,
int minWidth,
int minHeight,
int maxWidth,
int maxHeight)
Set the window details for resize; this includes the minimum and maximun dimensions, and
also the window's resizeable state.
|
void |
setTitle(java.lang.String title)
Set the window title at the OS level.
|
default void |
setUploadFileSizeLimits(int single,
int total)
Setting up file size limits for cases when drag and drop needs file uploads from web client
to Java side.
|
boolean |
setWidgetAttribute(int widgetId,
java.lang.String attr,
java.lang.String val)
Set an attribute for a widget implemented at the driver level.
|
void |
setWindowBounds(int x,
int y,
int width,
int height)
Set window bounds.
|
void |
setWindowEnabled(boolean enable)
Set the window's sensitive state, depending on the
enable flag. |
void |
setWindowLocation(int left,
int top)
Set window location.
|
void |
setWindowVisible(boolean visible)
Hide or show the window, depending on the
visible flag. |
void |
setXORComposite()
Set "XOR composite" mode: color of the drawn elements is calculated as XOR (for each RGB
component) of their color with color of underlying pixels.
|
void |
setXORMode(ColorRgb color)
Set XOR mode painting allowing to invert the destination color with current drawing
primitive color.
|
void |
stackWindows(int[] windowIds)
Force the list of all GUI windows to be stacked as in the specified order.
|
void |
startBatch()
Start a batch drawing routine.
|
void |
translatePop()
Reverses the translation at the top of the stack.
|
void |
translatePush(int x,
int y)
Translates the origin of the graphics context to the point (x, y) in the
current coordinate system.
|
default void |
withSelectedWindow(int windowId,
java.lang.Runnable run)
The method works as an envelope for
selectWindow(int) and
releaseWindow() methods. |
beep, captureMouseEvents, chooseFiles, clear, clientReady, createOutputManager, getChildProcessFactory, getClientStorage, getFactory, getHostByName, getHostName, getPrimitives, getWindowSystem, handleMouseEvent, inBackgroundMode, inBatchMode, init, isChui, isWeb, lockMousePointer, openMimeResource, propagate, readKey, resetMode, resume, resume, setControl, setCursorStatus, setTerminalType, shutdown, suspend, suspend, terminalType, updateClientMetrics, widgetStateChanged
void translatePush(int x, int y)
All usage of this method MUST be paired with a subsequent translatePop()
. A stack
of translations is maintained, so that translate calls can be nested.
Warning: unbalanced translate push/pop will cause an infinite loop in web driver, as it will keep waiting for the translate to reach 0. In Swing driver, it will not flush until all batch, translate and clip brackets reach 0.
x
- the specified x coordinatey
- the specified y coordinatevoid translatePop()
Warning: unbalanced translate push/pop will cause an infinite loop in web driver, as it will keep waiting for the translate to reach 0. In Swing driver, it will not flush until all batch, translate and clip brackets reach 0.
void drawStringWithMnemonic(java.lang.String text, NativePoint tp, MnemonicInfo info, GuiFontResolver gf, AbstractWidget<GuiOutputManager> widget, boolean centered)
text
- The full text, which needs to be drawn.tp
- The text's coordinates. If centered
parameter is set to
true
, then the NativePoint.y
will represent the height on
which centerin will be done.info
- The mnemonic details.gf
- The widget's font details.widget
- The widget instance to which the text belongs.centered
- Flag indicating if the text needs to be centered vertically.java.lang.String fitStringWithEllipsis(java.lang.String text, FontDetails<F> font, int maxWidth)
null
is
returned.text
- The full text, which needs to be drawn.font
- The font details to use for text measuring.maxWidth
- The maximum width the input string may occupy.void drawStringWithinBoxWithMnemonic(java.lang.String text, int xPosition, int yPosition, int boxWidth, int boxHeight, MnemonicInfo info, GuiFontResolver gf, AbstractWidget<GuiOutputManager> widget, boolean centered)
text
- The full text, which needs to be drawn.xPosition
- The box horizontal positionyPosition
- The box vertical positionboxWidth
- The box widthboxHeight
- The box heightinfo
- The mnemonic details.gf
- The widget's font details.widget
- The widget instance to which the text belongs.centered
- Flag indicating if the text needs to be centered vertically.void drawStringWithinBox(int xPosition, int yPosition, int boxWidth, int boxHeight, java.lang.String text, int[] indices, boolean centered)
xPosition
- The box horizontal positionyPosition
- The box vertical positionboxWidth
- The box widthboxHeight
- The box heighttext
- The given textindices
- Represents a text segment within the given text that should be drawn; if it isn't
given, then all given text should be drawncentered
- Flag indicating if the text needs to be centered vertically.void drawStringWithinBoxScaled(int xPosition, int yPosition, int boxWidth, int boxHeight, java.lang.String text, int[] indices, boolean centered)
xPosition
- The box horizontal positionyPosition
- The box vertical positionboxWidth
- The box widthboxHeight
- The box heighttext
- The given textindices
- Represents a text segment within the given text that should be drawn; if it isn't
given, then all given text should be drawncentered
- Flag indicating if the text needs to be centered vertically.void drawString(java.lang.String text, int x, int y)
text
- text string to draw.x
- left position.y
- top position.void drawStringCentered(java.lang.String text, int x, int height)
text
- text string to draw.x
- left position.height
- the height to center on.void drawStringScaled(java.lang.String text, int legacyWidth, int legacyHeight, int x, int y)
The string will be drawn at the specified location.
text
- text string to draw.legacyWidth
- The legacy width, which needs to be matched when drawing.legacyHeight
- The legacy width, which needs to be matched when drawing.x
- left position.y
- top position.void drawStringCentered(java.lang.String text, int legacyWidth, int legacyHeight, int x, int height)
The string will be drawn at the specified location.
text
- text string to draw.legacyWidth
- The legacy width, which needs to be matched when drawing.legacyHeight
- The legacy width, which needs to be matched when drawing.x
- left position.height
- the height to center on.int getParagraphHeight(java.lang.String text, FontDetails<F> font, int maxWidth)
Note that the algorithm for text layout is compatible with
drawParagraph(String, FontDetails, int, int, int)
and so
can be used in conjunction with this method.
text
- The text to measure.font
- The font to use during layout.maxWidth
- The maximum paragraph width.void drawParagraph(java.lang.String text, FontDetails<F> font, int x, int y, int maxWidth)
Note that the algorithm for text layout is compatible with
getParagraphHeight(String, FontDetails, int)
and so
can be used in conjunction with this method.
text
- The text to draw.font
- The drawing font.x
- The x position.y
- The y position.maxWidth
- The maximum paragraph width.void drawLine(int x1, int y1, int x2, int y2)
(x1, y1)
and (x2, y2)
in this graphics context's coordinate system.x1
- the first point's x coordinate.y1
- the first point's y coordinate.x2
- the second point's x coordinate.y2
- the second point's y coordinate.void drawIbeam(int x1, int y1, int x2, int y2)
(x1, y1)
and (x2, y2)
in this graphics context's coordinate system.x1
- the first point's x coordinate.y1
- the first point's y coordinate.x2
- the second point's x coordinate.y2
- the second point's y coordinate.void drawRect(int x, int y, int width, int height)
x
- left positiony
- top positionwidth
- rectangle width.height
- rectangle height.void drawRoundRect(int x, int y, int width, int height, int arcDiameter)
x
- left positiony
- top positionwidth
- rectangle width.height
- rectangle height.arcDiameter
- diameter of the arc at corners.void fillRect(int x, int y, int width, int height)
x
- left positiony
- top positionwidth
- rectangle width.height
- rectangle height.void fillRectAroundText(int x, int y, int textWidthHint, int textHeightHint, java.lang.String text)
x
- The text left positiony
- The text top positiontextWidthHint
- The text hint widthtextHeightHint
- The text hint heighttext
- The given textvoid fillRoundRect(int x, int y, int width, int height, int arcDiameter)
x
- left positiony
- top positionwidth
- rectangle width.height
- rectangle height.arcDiameter
- diameter of the arc at corners.void drawEllipse(int x, int y, int width, int height)
x
- Left position.y
- Top position.width
- Ellipse width.height
- Ellipse height.void fillEllipse(int x, int y, int width, int height)
x
- Left position.y
- Top position.width
- Ellipse width.height
- Ellipse height.void drawSelection(int x, int y, int width, int height, boolean clear)
x
- left positiony
- top positionwidth
- rectangle width.height
- rectangle height.clear
- TRUE
means clean up area instead of drawing selections.void drawTextSelection(LightweightTextWidget.TextLineSelection textLine, Theme.TextLookAndFeel textLookAndFeel, int x, int y, int lineHeight, int fontDescent)
textLine
- The text selection objecttextLookAndFeel
- The text look and feelx
- The left positiony
- The top positionlineHeight
- The line heightfontDescent
- The font descentvoid drawEdge(int left, int top, int width, int height, int edgeType, int flags)
The edgeType parameter is a bit mask, defining which edges of the rectangle must be drawn and some other features:
The edgeFlags parameter is a bit mask, the types of inner and outer edges:
See https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-drawedge.
Not all the features of the original MS-Windows function are implemented in FWD.
left
- the rectangle left side coordinatetop
- the rectangle top side coordinatewidth
- the rectangle widthheight
- the rectangle heightedgeType
- Flags defining the edge type (flat, bevelled etc.)flags
- Flags defining which rectangle edges to draw
(left, top, right, bottom)default void resetSelection()
default void initDragAndDrop(ServerExports srv)
srv
- Server to make config related calls.default void setUploadFileSizeLimits(int single, int total)
single
- Single file size limit.total
- Total file size limit for single operation.void fillPolygon(int[] xPoints, int[] yPoints)
xPoints
- X coordinates.yPoints
- Y coordinates.void fill3DRect(int x, int y, int width, int height, boolean raised)
ColorRgb
. This method uses
the current ColorRgb
exclusively and ignores the current
Paint
.x
- the x coordinate of the rectangle to be filled.y
- the y coordinate of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.raised
- a boolean value that determines whether the rectangle appears
to be raised above the surface or etched into the surface.void draw3DRect(int x, int y, int width, int height, boolean raised)
The colors used for the highlighting effect are determined
based on the current color.
The resulting rectangle covers an area that is
width + 1
pixels wide
by height + 1
pixels tall. This method
uses the current ColorRgb
exclusively and ignores
the current Paint
.
x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.raised
- A boolean that determines whether the rectangle appears to be raised
above the surface or sunk into the surface.void drawImage(ImageWrapper<I> img, int x, int y, int w, int h, int xoff, int yoff, boolean transparent, boolean stretch, boolean retain, boolean convert3D)
img
- Image to draw.x
- left location.y
- top location.w
- the image width.h
- the image height.xoff
- x offset inside image to start drawing.yoff
- y offset inside image to start drawing.transparent
- Flag indicating to use lower-left pixel as color marker to draw part of image as
transparent.stretch
- Flag indicating stretch or shrink the image to fit display area.retain
- Flag indicating keep original image aspect ratio when stretching the image.convert3D
- Flag indicating autoconvert some image colors to the corresponding system wide 3D
colors.ImageWrapper<I> getSubImage(ImageWrapper<I> img, int x, int y, int width, int height)
img
- The source image to cut, the instance is not modified, instead new image wrapper is returned.x
- The offset x.y
- The offset y.width
- The width relative to the offset.height
- The height relative to the offset/.void drawHighlight(int x, int y, int width, int height, ColorRgb color)
x
- left positiony
- top positionwidth
- area widthheight
- area heightcolor
- the highlight colorvoid setColor(ColorRgb color)
color
- Drawing color.void setColor(java.awt.Color color)
color
- Drawing color.void setDesktopBgColor(ColorRgb color)
color
- The new desktop background color.void setXORComposite()
void setXORMode(ColorRgb color)
color
- XOR alternation color.void resetComposite()
void setTitle(java.lang.String title)
title
- The window's title.void setGuiFont(FontDetails<F> font)
font
- Drawing font.void scaleFont(FontDetails<F> font)
font
- The font to be scaled. This will be modified on return.void setFontStyle(FontStyle style)
style
- Font style.void setLineStroke(LineStroke stroke)
stroke
- Line style.void setLineStroke(LineStroke stroke, float width)
stroke
- Line style.width
- Width value for the line.void resizeWindow(int width, int height)
width
- new width.height
- new heightvoid setWindowBounds(int x, int y, int width, int height)
x
- new xy
- new ywidth
- new width.height
- new heightboolean hasWindowEmulator(int windowId)
windowId
- Window ID.true
if window has an associated emulator, false
otherwise.void registerWindow(int windowId, boolean showInTaskbar)
windowId
- The window ID.showInTaskbar
- If set to true
the window will be shown in the system taskbar.void registerChildWindow(int ownerId, int windowId, java.lang.String windowTitle, boolean resizable, boolean isShareActivationWithOwner, boolean modal)
ownerId
- The owning window ID.windowId
- The window ID.windowTitle
- Title of the window emulator.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.void deregisterWindow(int windowId)
windowId
- The window ID.void selectWindow(int windowId)
The GUI driver primitives can be accessed by only a single thread at a time. This requires
all GUI driver API calls to be bracketed in selectWindow(int)
and releaseWindow()
calls.
If the thread drawing owner is null
, the current thread will gain exclusive
access immediately and will hold it until has finished work.
windowId
- Window ID.default void withSelectedWindow(int windowId, java.lang.Runnable run)
selectWindow(int)
and
releaseWindow()
methods.windowId
- Window ID.run
- The code to run after the window is selected in the driver.void releaseWindow()
If no more windows are in use by the current thread, then the exclusive drawing access is
released and other other threads waiting in selectWindow(int)
can acquire it.
java.lang.Object saveDrawingState()
void restoreDrawingState(java.lang.Object state)
state
- The drawing state.void setWindowLocation(int left, int top)
left
- left coordinatetop
- top coordinatevoid setResizeableWindow(boolean resize, int minWidth, int minHeight, int maxWidth, int maxHeight)
resize
- Flag indicating if the window can be resized or not.minWidth
- The window's minimum width.minHeight
- The window's minimum height.maxWidth
- The window's maximum width.maxHeight
- The window's maximum height.NativePoint getWindowLocation()
ImageWrapper<I> createGreyImage(I imageIni)
imageIni
- The image to be used as source for grey transformation.null
if the
image cannot be created (e.g. if the bytes are not a valid image type).FontDetails<F> createFont(FontDetails<F> details)
details
- The font specifications.boolean isFontInstalled(java.lang.String fontName, boolean boldFont, boolean webScale)
fontName
- The target font name.boldFont
- Indicates that the bold font is queried.webScale
- Check if the font is installed such that it can be web scaled.int getFontWidth(FontDetails<F> font)
font
- The font.int getFontMaxWidth(FontDetails<F> font)
font
- The font to calculate.int[] getFontWidths(FontDetails<F> fd)
fd
- The font details.int getFontHeight(FontDetails<F> font)
font
- The font.int getTextWidth(java.lang.String text, FontDetails<F> font)
text
- The text.font
- The font used to draw and measure the text.void cacheTextMetrics(java.util.Map<FontDetails<F>,java.util.Set<java.lang.String>> texts, java.lang.Integer windowId)
texts
- Map of texts for which metrics should be calculated, keyed by fonts which are used
for drawing specific texts.windowId
- ID of the parent window. Can be null
if there is no need to select a
window.boolean needsExplicitTextMetricsCaching()
true
if getting actual text metrics is an expensive operation for this
driver and you want to manually manage metrics cache using
cacheTextMetrics(Map, Integer)
.int getTextHeight(java.lang.String text, FontDetails<F> font)
text
- The text.font
- The font used to draw and measure the text.void setWindowVisible(boolean visible)
visible
flag.visible
- The window visibility state.void setWindowEnabled(boolean enable)
enable
flag.enable
- The window sensitive state.void iconifyWindow(int windowId)
windowId
- Target window.void deiconifyWindow(int windowId)
windowId
- Target window.NativeDimension getWindowDimension()
void draw(WidgetId id, NativePoint origin, NativeRectangle clip, java.lang.Runnable core)
id
- When not-null, it caches the drawing result of this widget.origin
- The drawing origin.clip
- Clip rectangle.core
- The drawing worker.void draw(NativePoint origin, NativeRectangle clip, java.lang.Runnable core)
The method intersects the supplied clip
with the screen bitmap rectangles
retrieved by ScreenBitmap.getClippings(NativeRectangle)
.
origin
- The drawing origin.clip
- Clip rectangle.core
- The drawing worker.void drawFromOrigin(NativePoint origin, NativeRectangle clip, java.lang.Runnable core)
The translated origin (as before this was called) needs to be restored, before this call ends.
origin
- The drawing origin (relative to window's real origin).clip
- Clip rectangle.core
- The drawing worker.void setDrawingAreas(java.util.Set<NativeRectangle> bounds)
bounds
parameter. The individual rectangular areas may or may not overlap.
Warning: unbalanced CLIP/NO_CLIP will cause an infinite loop in web driver, as it will keep waiting for the clip brackets to reach 0. In Swing driver, it will not flush until all batch, translate and clip brackets reach 0.
bounds
- The bounds for the drawing area.void setDrawingArea(NativeRectangle bounds)
Warning: unbalanced CLIP/NO_CLIP will cause an infinite loop in web driver, as it will keep waiting for the clip brackets to reach 0. In Swing driver, it will not flush until all batch, translate and clip brackets reach 0.
bounds
- The bounds for the drawing area.void setDisableRedraw(boolean value)
value
- Value to set to DISABLE-REDRAW attribute.void registerMoveableWidget(int wid)
wid
- The widget ID.void registerResizeableWidget(int wid)
wid
- The widget ID.void deregisterWidget(int wid)
wid
- The widget ID.void registerWidgetPopup(int wid, int btn, int pid)
The popup with the given ID will be shown when the specified mouse button is pressed inside the specified widget.
wid
- The widget id.btn
- The button to be pressed, when showing the popup.pid
- The popup widget ID.void registerHoverableWidget(MouseHoverAction action)
action
- The widget mouse action.void registerTooltipWorker(Widget<GuiOutputManager> widget, int font, boolean now)
widget
- The widget object to register.font
- The font to draw tooltip text.now
- The flag indicating whether the action be registered immediately or later.void registerPendingTooltipWorkers(int wid)
wid
- The widget id. 0 means register all pending workers.void deregisterTooltipWorkers(int wid)
wid
- The widget id. 0 means deregister all registered workers.void registerEmptySelector(Widget<GuiOutputManager> widget)
widget
- The widget object to register.void registerDirectManipulation(Widget<GuiOutputManager> widget)
widget
- The widget object to register.ColorRgb getBgColor(int index)
index
- Color number.ColorRgb getFgColor(int index)
index
- Color number.ColorRgb getSysColor(int index)
index
- Color index.ColorRgb getFgStdColor(java.lang.String stdColor)
stdColor
- Color name.ColorRgb getBgStdColor(java.lang.String stdColor)
stdColor
- Color name.void startBatch()
void endBatch()
boolean isWindowVisible()
void stackWindows(int[] windowIds)
windowIds
- The stack order to be enforced.void moveToTop(int windowId, boolean focus)
windowId
- The window to be moved.focus
- If true
, the window will become the focused window
and its state changed to active.void moveToBottom(int windowId)
windowId
- The window to be moved.void enableEvents(int[] windowIds, boolean process)
windowIds
- The window IDs which need to be processed.process
- Flag indicating OS level events are captured (when true
).NativeRectangle getDisplayBounds(int windowId)
TopLevelWindow
.
For single-display setups the top-left corner of the returned rectangle is always 0,0. For multiple-display setups it can be 0,0 or positive.
windowId
- A valid window id.NativeRectangle getDisplayWorkArea(int windowId)
windowId
- A valid window id.NativeDimension getVirtualScreenSize()
int getScreenResolution()
void copyToClipboard(java.lang.String txt)
txt
- The text to be copied.java.lang.String clipboardContents()
void setCurrentSelection(java.lang.String txt)
txt
- The current selection.void registerMouseWidgets()
void setIcon(ImageWrapper<I> icon, int x, int y, int width, int height, int xoff, int yoff, boolean transparent, boolean stretch, boolean retain, boolean convert3D)
icon
- The wrapped icon.x
- The icon left location.y
- The icon top location.width
- The icon width.height
- The icon height.xoff
- x offset inside image of the icon to select drawing region.yoff
- y offset inside image of the icon to select drawing region.transparent
- Flag indicating to use lower-left pixel as color marker to draw part of image as
transparent.stretch
- Flag indicating stretch or shrink the image to fit display area.retain
- Flag indicating keep original image aspect ratio when stretching the image.convert3D
- Flag indicating autoconvert some image colors to the corresponding system wide 3D
colors.MousePtrWrapper createMousePointer(java.io.InputStream data, java.lang.String ptrName)
data
- cursor dataptrName
- pointer namenull
default void propagateWaitState(boolean isWaitState)
isWaitState
- wait statedefault void setCursor(MousePtrWrapper ptr)
ptr
- mouse cursordefault void setCursor(java.lang.String image)
image
- resource nameboolean isWindowDecorationSupported()
default int[][] parseEditorContent(int widgetId, int windowId, int maxWidth, java.lang.String text, int delta, FontDetails<F> font)
delta
parameter represents the start position of this text, in the editor's
content; when the full content is parsed, this will be zero.widgetId
- The editor's ID.windowId
- The editor's window ID.maxWidth
- The width for the content to fit (the editor's editable area).text
- The text to split into lines.delta
- The start position of this text in the editor's full content.font
- The editor's font.int[] getTextWidths(java.lang.String text, FontDetails<F> font)
text
- The text.font
- The font details used to draw and measure the text.int[][] getTextWidths(java.lang.String[] texts, FontDetails<F> font)
texts
- The texts.font
- The font details used to draw and measure the text.NativePoint getMousePosition()
null
void deliverDocumentOutput(java.util.function.Consumer<java.io.OutputStream> consumer, java.lang.Runnable finalizer, MediaType format, java.lang.String uuid, boolean promptUser)
consumer
- Output consumer, must not be null. See above.finalizer
- Finalizer callback, may be null. See above.format
- Document output format.uuid
- Unique id of the operation.promptUser
- if true
the user is eventually prompted for a name for the output file,
otherwise a name is picked automatically if needed.void drawCursor(LightweightTextWidget widget)
widget
- The text widgetvoid addMessageListener(MsgBlasterPeer listener, int windowId, int widgetId)
listener
- The listener to be added.windowId
- The windows id.widgetId
- The widget's id.void removeMessageListener(MsgBlasterPeer listener, int windowId, int widgetId)
listener
- The listener to be removed.windowId
- The windows id.widgetId
- The widget's id.default void setAlwaysOnTop(int windowId, boolean topOnly, boolean alwaysOnTop)
stackWindows(int[])
is not fully supported by the driver.windowId
- The window to be changed.topOnly
- Corresponds to the WINDOW:TOP-ONLY attribute.alwaysOnTop
- Corresponds to the WINDOW:ALWAYS-ON-TOP attribute.default void notifyWait()
default int[] getBasicWebPalette()
null
or incomplete can be returned.
The basic palette has five entries: BACKGROUND, FOREGROUND, NORMAL, HIGHLIGHTED and DISABLED
in that order.
The returned palette can contain null
values that will not overwrite the default
entries of the Theme
.
Additional entries will be ignored.boolean setWidgetAttribute(int widgetId, java.lang.String attr, java.lang.String val)
This works only for GUI drivers.
widgetId
- The widget ID.attr
- The attribute name.val
- The attribute's value.true
if setting this attribute completed.java.lang.Object invokeWidgetCommand(int widgetId, java.lang.String command, java.lang.Object[] args)
widgetId
- Widget id.command
- The command to invoke.args
- Optional event arguments.java.lang.Object invokeWidgetCommand(int widgetId, java.lang.Enum command, java.lang.Object[] args)
widgetId
- Widget id.command
- The command to invoke.args
- Optional event arguments.void createWidget(java.lang.String type, int widgetId)
type
- The widget type, one of the LegacyResource
widget names.widgetId
- The widget ID to be set.<T extends DriverWidget> void createWidget(java.lang.Class<T> widgetClass, int widgetId)
widgetClass
- The widget class.widgetId
- The widget ID to be set.void destroyWidget(int widgetId)
widgetId
- The widget ID.void placeWidget(int widgetId, NativeRectangle bounds)
widgetId
- The widget ID.bounds
- The widget's boundaries.void changeVisibility(int widgetId, boolean visible)
widgetId
- The widget ID.visible
- The visibility state.void changeSensitivity(int widgetId, boolean sensitive)
widgetId
- The widget ID.sensitive
- The enabled state.DriverWidget getDriverWidget(int widgetId)
widgetId
- Widget id.null
.