public abstract class AbstractGuiDriver<F> extends AbstractDriver<GuiPrimitives,GuiOutputManager> implements GuiDriver<F,java.awt.image.BufferedImage>
The only exceptions to this no-Swing rule are for events and image loading. We are using the AWT event classes as simple containers to eliminate the need to create our own versions of the same thing. For image loading, there is no better solution than to use ImageIO and AWT.
Modifier and Type | Class and Description |
---|---|
private static class |
AbstractGuiDriver.ParagraphKey<F>
Identify the paragraph metrics in the cache.
|
private static class |
AbstractGuiDriver.TextKey<F>
Identify the text metrics in the cache.
|
protected static class |
AbstractGuiDriver.TextMetrics
A simple container for text metrics.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Deque<java.lang.Boolean> |
batch
Track batch mode, to not allow window switching while batch mode is active.
|
protected BootstrapConfig |
config
Configuration.
|
protected boolean |
control
Flag indicating that the client-side has control.
|
private boolean |
disableRedraw
Holds the state of the SESSION:DISABLE-REDRAW attribute.
|
private java.lang.Thread |
drawingOwner
The
Thread having exclusive access to the GUI driver primitives. |
protected EmulatedWindowState |
ews
Currently selected window emulator.
|
private OutputManager<?> |
inputSrc
Key reading source saved on the time of suspending.
|
private java.util.Set<NativeRectangle> |
lastClips
The last posted clipping rectangles.
|
private java.util.Deque<EmulatedWindowState<F,?>> |
lastWindow
The selected window stack by the
drawingOwner . |
protected static java.util.logging.Logger |
LOG
Logger.
|
private LFUAgingCache<AbstractGuiDriver.ParagraphKey,AbstractGuiDriver.TextMetrics> |
paragraphMetricsCache
A cache of resolved paragraph metrics.
|
private java.util.Map<Widget,MouseWidgetAction> |
pendingTtWorkers
Pending tooltip workers to be registered with mouse handler.
|
private java.util.Set<java.lang.Integer> |
pendingVisibleWindows
Contains the set of windows have attempted to draw whiel
disableRedraw is set. |
private java.util.Map<java.lang.Integer,ColorRgb> |
systemColorsCache
System colors cache.
|
private LFUAgingCache<AbstractGuiDriver.TextKey,AbstractGuiDriver.TextMetrics> |
textMetricsCache
A cache of resolved text metrics.
|
private java.lang.String |
theme
The currently used theme for GUI widgets.
|
protected NativePoint |
translatedOrigin
The real location of the translated origin.
|
private java.util.Deque<NativePoint> |
translations
All current translate() operations in proper nested order.
|
private java.util.Deque<java.lang.Boolean> |
windowSwitched
Stack indicating if last call to
selectWindow(int) ended in a window switch. |
direct, factory
Constructor and Description |
---|
AbstractGuiDriver(GuiPrimitives direct,
BootstrapConfig config)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
captureMouseEvents(boolean state)
Enable or disable capture of mouse events.
|
void |
clear()
Clear the entire screen, with the default window color.
|
ImageWrapper<java.awt.image.BufferedImage> |
createGreyImage(java.awt.image.BufferedImage imageIni)
Create a native grey image from the original initial image to be used for disabled control
states.
|
ImageWrapper<java.awt.image.BufferedImage> |
createIcon(byte[] byts,
boolean small)
Create a native icon from the raw bytes and return a generic wrapper that can be used
for operations.
|
static ImageWrapper<java.awt.image.BufferedImage> |
createImage(byte[] bytes)
Create a native image from the raw bytes and return a generic wrapper that can be used
for operations.
|
GuiOutputManager |
createOutputManager(BootstrapConfig cfg)
Get the
OutputManager instance associated with this driver. |
void |
deiconifyWindow(int windowId)
Selects the target window and then restores it.
|
private void |
deregisterTooltipWorkerInt(int wid)
Deregister the tooltip workers already registered with mouse handler.
|
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 this window from the driver.
|
protected abstract void |
deriveFont(FontDetails<F> fd)
Scale the given font by the specified X and Y factors.
|
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 |
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 |
drawImage(ImageWrapper img,
int x,
int y,
int w,
int h,
int xoff,
int yoff,
boolean transparent,
boolean stretch,
boolean retain,
boolean convert3D)
Draw a 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 |
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 capture)
Enable or Disable OS-level events for the specified windows.
|
private void |
enableEventsForNonModalWnd(boolean capture)
Enable or Disable OS-level events for all current non-modal 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.
|
private static void |
fillPaintStructure(PaintStructure ps,
ImageWrapper<java.awt.image.BufferedImage> img,
int x,
int y,
int w,
int h,
int xoff,
int yoff,
boolean transparent,
boolean stretch,
boolean retain,
boolean convert3D)
Fills the helper paint structure with target values.
|
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.
|
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.
|
ChildProcessFactory |
getChildProcessFactory()
Get driver-specific child process factory.
|
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.
|
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> fd)
Get the height of the specified font.
|
int |
getFontMaxWidth(FontDetails<F> fd)
Get the maximum font width, for the given font.
|
int |
getFontWidth(FontDetails<F> fd)
Get the width of the specified font.
|
int[] |
getFontWidths(FontDetails<F> fd)
Report the advance widths of the first 256 characters in the font.
|
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.
|
protected java.lang.String |
getPrintOutputFile(MediaType format)
Returns file name for a PDF print output file.
|
ImageWrapper<java.awt.image.BufferedImage> |
getSubImage(ImageWrapper<java.awt.image.BufferedImage> 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> fd)
Get the height of the specified text, using the given font.
|
protected AbstractGuiDriver.TextMetrics |
getTextMetrics(java.lang.String text,
FontDetails<F> fd)
Get the metrics for the given text and font from the
textMetricsCache . |
int |
getTextWidth(java.lang.String text,
FontDetails<F> fd)
Get the width of the specified text, using the given font.
|
int[][] |
getTextWidths(java.lang.String[] texts,
FontDetails<F> fd)
Get the widths of the specified texts, using the given font.
|
int[] |
getTextWidths(java.lang.String text,
FontDetails<F> fd)
Get the widths of the specified text, using the given font.
|
NativeDimension |
getWindowDimension()
Get the physical window dimension, in pixel units.
|
NativePoint |
getWindowLocation()
Get the window location on screen.
|
void |
handleMouseEvent(int sourceID,
java.awt.event.MouseEvent evt)
Handle the specified event, in the context of the specified widget.
|
boolean |
hasWindowEmulator(int windowId)
Check if window has an emulator for the given window id.
|
void |
iconifyWindow(int windowId)
Minimizes the supplied window.
|
protected boolean |
isActualTextMetricsCached(java.lang.String text,
FontDetails<F> font)
Returns
true if an actual (not approximate) text metrics is cached for the
given text and font. |
protected boolean |
isEmptyText(java.lang.String text)
Check if the specified text is empty.
|
boolean |
isWindowVisible()
Check if the currently selected window is visible.
|
void |
listenAnyMouseEvent(int wid,
long when)
Notify the widget of any mouse events, generated after the given timestamp (in millis).
|
java.awt.image.BufferedImage |
makeImage(java.io.InputStream data)
Create image from the binary data
|
abstract void |
moveToBottom(int windowId)
Move the specified window to the bottom of the z-order, at the OS level.
|
abstract 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
GuiDriver.cacheTextMetrics(Map, Integer) . |
abstract EmulatedWindowState |
newChildWindowEmulator(int windowId,
EmulatedWindowState owner,
java.lang.String windowTitle,
boolean resizable,
boolean isShareActivationWithOwner,
boolean modal)
Create a new child window emulator.
|
abstract EmulatedWindowState |
newEmulator(int windowId,
boolean showInTaskbar)
Create a new window emulator.
|
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 |
registerMouseWidgets()
Register all the mouse-aware widgets (in all Windows) with the driver.
|
private boolean |
registerPendingTooltipWorkerInt(Widget<GuiOutputManager> widget)
Register the tooltip worker if this process was dalayed with regular registration.
|
void |
registerPendingTooltipWorkers(int wid)
Register the tooltip workers if this process was dalayed with regular registration.
|
void |
registerTooltipWorker(Widget<GuiOutputManager> widget,
int fnt,
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 |
resetComposite()
Reset composite mode and return to normal drawing mode.
|
void |
resetMode()
Reset current screen mode.
|
void |
resizeWindow(int width,
int height)
Resize window.
|
private AbstractGuiDriver.TextMetrics |
resolveParagraphMetrics(java.lang.String text,
FontDetails<F> fd,
int maxWidth)
Resolve the metrics for the given paragraph, font and max width.
|
protected AbstractGuiDriver.TextMetrics |
resolveTextMetrics(java.lang.String text,
FontDetails<F> fd)
Resolve the metrics for the given text and font.
|
abstract void |
restackWindows(int[] windowIds)
Force the list of all GUI windows to be stacked as in the specified order.
|
void |
restoreDrawingState(java.lang.Object state)
Restore the drawing state to the specified state.
|
void |
resume()
Resume normal driver operation.
|
void |
resume(boolean silent)
Resume normal driver operation.
|
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.
|
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 |
setControl(boolean control)
Notify the driver which side has control (client-side (when
true ) or server,
otherwise). |
boolean |
setCursorStatus(boolean on)
Set cursor status (ON/OFF).
|
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<java.awt.image.BufferedImage> 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.
|
protected void |
setTextMetrics(java.lang.String text,
FontDetails<F> fd,
AbstractGuiDriver.TextMetrics metrics)
Set the metrics for the given text and font to the
textMetricsCache . |
void |
setTitle(java.lang.String title)
Set the window title at the OS level.
|
void |
setWindowBounds(int x,
int y,
int width,
int height)
Set window bounds.
|
void |
setWindowEnabled(boolean enable)
Set the window' 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 |
shutdown()
Perform driver shutdown.
|
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 |
suspend()
Suspend all screen I/O operations.
|
void |
suspend(boolean silent)
Suspend all screen I/O operations.
|
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.
|
getFactory, getPrimitives, getWindowSystem, inBackgroundMode, inBatchMode, init, isChui, setBackgroundMode, setBatchMode, setTerminalType, terminalType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clipboardContents, copyToClipboard, createFont, createMousePointer, deliverDocumentOutput, getMousePosition, getScreenResolution, initDragAndDrop, isFontInstalled, isWindowDecorationSupported, notifyWait, parseEditorContent, propagateWaitState, registerHoverableWidget, registerMoveableWidget, registerResizeableWidget, resetSelection, setAlwaysOnTop, setCurrentSelection, setCursor, setResizeableWindow, setUploadFileSizeLimits, withSelectedWindow
beep, clientReady, getFactory, getPrimitives, getWindowSystem, inBackgroundMode, inBatchMode, init, isChui, lockMousePointer, openMimeResource, propagate, readKey, setTerminalType, terminalType
protected static final java.util.logging.Logger LOG
protected EmulatedWindowState ews
protected NativePoint translatedOrigin
protected BootstrapConfig config
private java.util.Deque<NativePoint> translations
private java.util.Map<Widget,MouseWidgetAction> pendingTtWorkers
private java.util.Map<java.lang.Integer,ColorRgb> systemColorsCache
private java.lang.String theme
private LFUAgingCache<AbstractGuiDriver.TextKey,AbstractGuiDriver.TextMetrics> textMetricsCache
private LFUAgingCache<AbstractGuiDriver.ParagraphKey,AbstractGuiDriver.TextMetrics> paragraphMetricsCache
private java.util.Deque<java.lang.Boolean> batch
private java.util.Set<NativeRectangle> lastClips
private java.lang.Thread drawingOwner
Thread
having exclusive access to the GUI driver primitives. If this is
null
, any thread can gain exclusive access immediately in selectWindow(int)
.
Otherwise, it will wait for the owner to finish.private java.util.Deque<java.lang.Boolean> windowSwitched
selectWindow(int)
ended in a window switch.
This indicates when releaseWindow()
will release the GUI driver exclusive access hold
by the current drawingOwner
.private java.util.Deque<EmulatedWindowState<F,?>> lastWindow
drawingOwner
.private boolean disableRedraw
private java.util.Set<java.lang.Integer> pendingVisibleWindows
disableRedraw
is set.protected boolean control
private OutputManager<?> inputSrc
public AbstractGuiDriver(GuiPrimitives direct, BootstrapConfig config)
direct
- The output primitives.config
- The BootstrapConfig
configuration.public void setControl(boolean control)
true
) or server,
otherwise).setControl
in interface ScreenDriver<GuiOutputManager>
control
- Flag indicating (when true
) that the client-side has control.public GuiOutputManager createOutputManager(BootstrapConfig cfg)
OutputManager
instance associated with this driver.createOutputManager
in interface ScreenDriver<GuiOutputManager>
cfg
- The initial configuration for this driver.GuiOutputManager
instance.public void clear()
clear
in interface ScreenDriver<GuiOutputManager>
public static ImageWrapper<java.awt.image.BufferedImage> createImage(byte[] bytes)
bytes
- The image as persisted in the file system or a JAR file.null
if the
image cannot be created (e.g. if the bytes are not a valid image type).public java.awt.image.BufferedImage makeImage(java.io.InputStream data) throws java.io.IOException
data
- image datajava.io.IOException
public ImageWrapper<java.awt.image.BufferedImage> createGreyImage(java.awt.image.BufferedImage imageIni)
createGreyImage
in interface GuiDriver<F,java.awt.image.BufferedImage>
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).public ImageWrapper<java.awt.image.BufferedImage> createIcon(byte[] byts, boolean small)
createIcon
in interface GuiDriver<F,java.awt.image.BufferedImage>
byts
- The image as persisted in the file system or a JAR file.small
- true
if the small icon size is to be loaded.null
if the
icon cannot be created (e.g. if the bytes are not a valid icon type).public ChildProcessFactory getChildProcessFactory()
getChildProcessFactory
in interface ScreenDriver<GuiOutputManager>
public ColorRgb getBgColor(int index)
getBgColor
in interface GuiDriver<F,java.awt.image.BufferedImage>
index
- Color number.public ColorRgb getFgColor(int index)
getFgColor
in interface GuiDriver<F,java.awt.image.BufferedImage>
index
- Color number.public ColorRgb getSysColor(int index)
ColorRgb
instances.getSysColor
in interface GuiDriver<F,java.awt.image.BufferedImage>
index
- Color index.public ColorRgb getFgStdColor(java.lang.String stdColor)
getFgStdColor
in interface GuiDriver<F,java.awt.image.BufferedImage>
stdColor
- Color name.public ColorRgb getBgStdColor(java.lang.String stdColor)
getBgStdColor
in interface GuiDriver<F,java.awt.image.BufferedImage>
stdColor
- Color name.public 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.
translatePush
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- the specified x coordinatey
- the specified y coordinatepublic void 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.
translatePop
in interface GuiDriver<F,java.awt.image.BufferedImage>
public void drawStringWithMnemonic(java.lang.String text, NativePoint tp, MnemonicInfo info, GuiFontResolver gf, AbstractWidget<GuiOutputManager> widget, boolean centered)
drawStringWithMnemonic
in interface GuiDriver<F,java.awt.image.BufferedImage>
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 centering 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.public void drawString(java.lang.String text, int x, int y)
drawString
in interface GuiDriver<F,java.awt.image.BufferedImage>
text
- text string to draw.x
- left position.y
- top position.public void drawStringScaled(java.lang.String text, int legacyWidth, int legacyHeight, int x, int y)
The string will be drawn at the specified location.
drawStringScaled
in interface GuiDriver<F,java.awt.image.BufferedImage>
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.public void drawStringCentered(java.lang.String text, int legacyWidth, int legacyHeight, int x, int height)
The string will be drawn at the specified location.
drawStringCentered
in interface GuiDriver<F,java.awt.image.BufferedImage>
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.public 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.
getParagraphHeight
in interface GuiDriver<F,java.awt.image.BufferedImage>
text
- The text to measure.font
- The font to use during layout.maxWidth
- The maximum paragraph width.public 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.
drawParagraph
in interface GuiDriver<F,java.awt.image.BufferedImage>
text
- The text to draw.font
- The drawing font.x
- The x position.y
- The y position.maxWidth
- The maximum paragraph width.public void drawStringCentered(java.lang.String text, int x, int height)
drawStringCentered
in interface GuiDriver<F,java.awt.image.BufferedImage>
text
- text string to draw.x
- left position.height
- the height to center on.public void drawLine(int x1, int y1, int x2, int y2)
(x1, y1)
and (x2, y2)
in this graphics context's coordinate system.public void drawRect(int x, int y, int width, int height)
public void drawRoundRect(int x, int y, int width, int height, int arcDiameter)
drawRoundRect
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- left positiony
- top positionwidth
- rectangle width.height
- rectangle height.arcDiameter
- diameter of the arc at corners.public void fillRect(int x, int y, int width, int height)
public void fillRectAroundText(int x, int y, int textWidthHint, int textHeightHint, java.lang.String text)
fillRectAroundText
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- The text left positiony
- The text top positiontextWidthHint
- The text hint widthtextHeightHint
- The text hint heighttext
- The given textpublic void fillRoundRect(int x, int y, int width, int height, int arcDiameter)
fillRoundRect
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- left positiony
- top positionwidth
- rectangle width.height
- rectangle height.arcDiameter
- diameter of the arc at corners.public void drawEllipse(int x, int y, int width, int height)
drawEllipse
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- Left position.y
- Top position.width
- Ellipse width.height
- Ellipse height.public void fillEllipse(int x, int y, int width, int height)
fillEllipse
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- Left position.y
- Top position.width
- Ellipse width.height
- Ellipse height.public 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
.
draw3DRect
in interface GuiDriver<F,java.awt.image.BufferedImage>
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.public 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
.fill3DRect
in interface GuiDriver<F,java.awt.image.BufferedImage>
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.public void drawSelection(int x, int y, int width, int height, boolean clear)
drawSelection
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- left positiony
- top positionwidth
- rectangle width.height
- rectangle height.clear
- TRUE
means clean up area instead of drawing selections.public void fillPolygon(int[] xPoints, int[] yPoints)
fillPolygon
in interface GuiDriver<F,java.awt.image.BufferedImage>
xPoints
- X coordinates.yPoints
- Y coordinates.public void drawImage(ImageWrapper img, int x, int y, int w, int h, int xoff, int yoff, boolean transparent, boolean stretch, boolean retain, boolean convert3D)
drawImage
in interface GuiDriver<F,java.awt.image.BufferedImage>
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.public ImageWrapper<java.awt.image.BufferedImage> getSubImage(ImageWrapper<java.awt.image.BufferedImage> img, int x, int y, int width, int height)
getSubImage
in interface GuiDriver<F,java.awt.image.BufferedImage>
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.public void drawHighlight(int x, int y, int width, int height, ColorRgb color)
drawHighlight
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- left positiony
- top positionwidth
- area widthheight
- area heightcolor
- The highlight color.public void setColor(ColorRgb color)
public void setColor(java.awt.Color color)
public void setDesktopBgColor(ColorRgb color)
setDesktopBgColor
in interface GuiDriver<F,java.awt.image.BufferedImage>
color
- The new desktop background color.public void setXORComposite()
setXORComposite
in interface GuiDriver<F,java.awt.image.BufferedImage>
public void setXORMode(ColorRgb color)
setXORMode
in interface GuiDriver<F,java.awt.image.BufferedImage>
color
- XOR alternation color.public void resetComposite()
resetComposite
in interface GuiDriver<F,java.awt.image.BufferedImage>
public void setTitle(java.lang.String title)
public void setIcon(ImageWrapper<java.awt.image.BufferedImage> icon, int x, int y, int width, int height, int xoff, int yoff, boolean transparent, boolean stretch, boolean retain, boolean convert3D)
setIcon
in interface GuiDriver<F,java.awt.image.BufferedImage>
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.private static void fillPaintStructure(PaintStructure ps, ImageWrapper<java.awt.image.BufferedImage> img, int x, int y, int w, int h, int xoff, int yoff, boolean transparent, boolean stretch, boolean retain, boolean convert3D)
ps
- The paint structure to be filled with the provided values.img
- The wrapped image.x
- The image left location.y
- The image top location.w
- The image width.h
- The image height.xoff
- x offset inside image to select the drawing region.yoff
- y offset inside image to select the 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.public void setGuiFont(FontDetails<F> font)
setGuiFont
in interface GuiDriver<F,java.awt.image.BufferedImage>
font
- Drawing font.public int getFontWidth(FontDetails<F> fd)
getFontWidth
in interface GuiDriver<F,java.awt.image.BufferedImage>
fd
- The font details.public int getFontMaxWidth(FontDetails<F> fd)
getFontMaxWidth
in interface GuiDriver<F,java.awt.image.BufferedImage>
fd
- The font details.public int[] getFontWidths(FontDetails<F> fd)
getFontWidths
in interface GuiDriver<F,java.awt.image.BufferedImage>
fd
- The font details.public int getFontHeight(FontDetails<F> fd)
getFontHeight
in interface GuiDriver<F,java.awt.image.BufferedImage>
fd
- The font details.public void cacheTextMetrics(java.util.Map<FontDetails<F>,java.util.Set<java.lang.String>> texts, java.lang.Integer windowId)
cacheTextMetrics
in interface GuiDriver<F,java.awt.image.BufferedImage>
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.public boolean needsExplicitTextMetricsCaching()
true
if getting actual text metrics is an expensive operation for this
driver and you want to manually manage metrics cache using
GuiDriver.cacheTextMetrics(Map, Integer)
.needsExplicitTextMetricsCaching
in interface GuiDriver<F,java.awt.image.BufferedImage>
public int getTextWidth(java.lang.String text, FontDetails<F> fd)
getTextWidth
in interface GuiDriver<F,java.awt.image.BufferedImage>
text
- The text.fd
- The font details used to draw and measure the text.public int[] getTextWidths(java.lang.String text, FontDetails<F> fd)
getTextWidths
in interface GuiDriver<F,java.awt.image.BufferedImage>
text
- The text.fd
- The font details used to draw and measure the text.public int[][] getTextWidths(java.lang.String[] texts, FontDetails<F> fd)
getTextWidths
in interface GuiDriver<F,java.awt.image.BufferedImage>
texts
- The texts.fd
- The font details used to draw and measure the text.public int getTextHeight(java.lang.String text, FontDetails<F> fd)
getTextHeight
in interface GuiDriver<F,java.awt.image.BufferedImage>
text
- The text.fd
- The font details used to draw and measure the text.public final void scaleFont(FontDetails<F> font)
protected abstract void deriveFont(FontDetails<F> fd)
fd
- Font to scale. This instance's contained font will be modified.public void setFontStyle(FontStyle style)
setFontStyle
in interface GuiDriver<F,java.awt.image.BufferedImage>
style
- Font style.public void setLineStroke(LineStroke stroke)
setLineStroke
in interface GuiDriver<F,java.awt.image.BufferedImage>
stroke
- Line style.public void setLineStroke(LineStroke stroke, float width)
setLineStroke
in interface GuiDriver<F,java.awt.image.BufferedImage>
stroke
- Line style.width
- Width value for the line.public void resizeWindow(int width, int height)
resizeWindow
in interface GuiDriver<F,java.awt.image.BufferedImage>
width
- new width.height
- new heightpublic void setWindowBounds(int x, int y, int width, int height)
setWindowBounds
in interface GuiDriver<F,java.awt.image.BufferedImage>
x
- new xy
- new ywidth
- new width.height
- new heightpublic void setWindowLocation(int left, int top)
setWindowLocation
in interface GuiDriver<F,java.awt.image.BufferedImage>
left
- left coordinatetop
- top coordinatepublic boolean hasWindowEmulator(int windowId)
hasWindowEmulator
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- Window ID.true
if window has an associated emulator, true
otherwise.public void registerWindow(int windowId, boolean showInTaskbar)
registerWindow
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- The window ID.showInTaskbar
- If set to true
the window will be shown in the system taskbar.public void registerChildWindow(int ownerId, int windowId, java.lang.String windowTitle, boolean resizable, boolean isShareActivationWithOwner, boolean modal)
registerChildWindow
in interface GuiDriver<F,java.awt.image.BufferedImage>
ownerId
- The owning window ID.windowId
- The window ID.windowTitle
- Title of the window emulator.resizable
- true
if the window should be created as resizable.isShareActivationWithOwner
- Indicates whether the window shares activation state with its owner.modal
- true
if this is a modal window.public void deregisterWindow(int windowId)
deregisterWindow
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- The window ID.public abstract EmulatedWindowState newEmulator(int windowId, boolean showInTaskbar)
windowId
- The window ID.showInTaskbar
- If set to true
the window will be shown in the system taskbar.public abstract EmulatedWindowState newChildWindowEmulator(int windowId, EmulatedWindowState owner, java.lang.String windowTitle, boolean resizable, boolean isShareActivationWithOwner, boolean modal)
windowId
- The window ID.owner
- The owning window.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.public abstract void restackWindows(int[] windowIds)
windowIds
- The stack order to be enforced.public abstract void moveToTop(int windowId, boolean focus)
public abstract void moveToBottom(int windowId)
moveToBottom
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- The window to be moved.public 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 drawingOwner
is null
, the current thread will gain exclusive
access immediately and will hold it until has finished work.
selectWindow
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- Window ID.java.lang.IllegalStateException
- If the window is switched by the current thread while batch mode is on or the wait
is interrupted.public void releaseWindow()
thread
which acquired the exclusive drawing access.
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.
releaseWindow
in interface GuiDriver<F,java.awt.image.BufferedImage>
java.lang.NullPointerException
- If drawingOwner
is null
java.lang.IllegalStateException
- If called from other thread than the drawingOwner
.public java.lang.Object saveDrawingState()
saveDrawingState
in interface GuiDriver<F,java.awt.image.BufferedImage>
public void restoreDrawingState(java.lang.Object state)
drawingOwner
, then wait for it to relinquish the exclusive lock, before
restoring the state.restoreDrawingState
in interface GuiDriver<F,java.awt.image.BufferedImage>
state
- The drawing state.public void iconifyWindow(int windowId)
iconifyWindow
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- Target window.public void deiconifyWindow(int windowId)
deiconifyWindow
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- Target window.public void draw(WidgetId id, NativePoint origin, NativeRectangle clip, java.lang.Runnable core)
When the widget ID is specified, all the drawing operations for this widget will be
bracketed in PaintPrimitives.START_RECORDING
and
PaintPrimitives.STOP_RECORDING
. If the driver implementation handles these
primitives, it is expected to hash the resulted and either save the resulted image in a
cache or, if the image hash is already cached, replace the drawing operations with a
PaintPrimitives.DRAW_CACHED
operation, so that the cached image will be drawn
instead.
The method intersects the supplied clip
with the screen bitmap rectangles
retrieved by ScreenBitmap.getClippings(NativeRectangle)
.
public 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)
.
public 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.
drawFromOrigin
in interface GuiDriver<F,java.awt.image.BufferedImage>
origin
- The drawing origin (relative to window's real origin).clip
- Clip rectangle.core
- The drawing worker.public void drawCursor(LightweightTextWidget widget)
drawCursor
in interface GuiDriver<F,java.awt.image.BufferedImage>
widget
- The text widgetpublic void drawTextSelection(LightweightTextWidget.TextLineSelection textLine, Theme.TextLookAndFeel textLookAndFeel, int x, int y, int lineHeight, int fontDescent)
drawTextSelection
in interface GuiDriver<F,java.awt.image.BufferedImage>
textLine
- The text selection objecttextLookAndFeel
- The text look and feelx
- The left positiony
- The top positionlineHeight
- The line heightfontDescent
- The font descentpublic 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.
setDrawingAreas
in interface GuiDriver<F,java.awt.image.BufferedImage>
bounds
- The bounds for the drawing area.public 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.
setDrawingArea
in interface GuiDriver<F,java.awt.image.BufferedImage>
bounds
- The bounds for the drawing area.public void setDisableRedraw(boolean value)
If it was active and it gets disabled, all pendingVisibleWindows
are repainted.
setDisableRedraw
in interface GuiDriver<F,java.awt.image.BufferedImage>
value
- Value to set to DISABLE-REDRAW attribute.public void startBatch()
startBatch
in interface GuiDriver<F,java.awt.image.BufferedImage>
public void endBatch()
public void setWindowVisible(boolean visible)
visible
flag.setWindowVisible
in interface GuiDriver<F,java.awt.image.BufferedImage>
visible
- The window visibility state.public void setWindowEnabled(boolean enable)
enable
flag.setWindowEnabled
in interface GuiDriver<F,java.awt.image.BufferedImage>
enable
- The window sensitive state.public NativePoint getWindowLocation()
getWindowLocation
in interface GuiDriver<F,java.awt.image.BufferedImage>
public NativeDimension getWindowDimension()
getWindowDimension
in interface GuiDriver<F,java.awt.image.BufferedImage>
public void stackWindows(int[] windowIds)
stackWindows
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowIds
- The stack order to be enforced.public void enableEvents(int[] windowIds, boolean capture)
enableEvents
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowIds
- The window IDs which need to be processed.capture
- Flag indicating OS level events are captured (when true
).public boolean setCursorStatus(boolean on)
For GUI, this does nothing.
setCursorStatus
in interface ScreenDriver<GuiOutputManager>
on
- true
- show cursor, false
- hide cursor.false
.public void resetMode()
Upon exit from this method P2J assumes that screen is in correct state and can be used for interaction with the user.
resetMode
in interface ScreenDriver<GuiOutputManager>
public void resume(boolean silent)
resume
in interface ScreenDriver<GuiOutputManager>
silent
- silent mode flag value that can change driver reaction for some suspend/resume.public void resume()
resume
in interface ScreenDriver<GuiOutputManager>
public void suspend(boolean silent)
suspend
in interface ScreenDriver<GuiOutputManager>
silent
- silent mode flag value that can change driver reaction for some suspend/resume.public void suspend()
suspend
in interface ScreenDriver<GuiOutputManager>
public void shutdown()
shutdown
in interface ScreenDriver<GuiOutputManager>
shutdown
in class AbstractDriver<GuiPrimitives,GuiOutputManager>
public 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.
getDisplayBounds
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- A valid window id.public NativeRectangle getDisplayWorkArea(int windowId)
getDisplayWorkArea
in interface GuiDriver<F,java.awt.image.BufferedImage>
windowId
- A valid window id.public boolean isWindowVisible()
isWindowVisible
in interface GuiDriver<F,java.awt.image.BufferedImage>
public boolean captureMouseEvents(boolean state)
captureMouseEvents
in interface ScreenDriver<GuiOutputManager>
state
- true
to capture mouse events, false
to ignore them.public void handleMouseEvent(int sourceID, java.awt.event.MouseEvent evt)
handleMouseEvent
in interface ScreenDriver<GuiOutputManager>
sourceID
- The source widget ID.evt
- The mouse event.public void listenAnyMouseEvent(int wid, long when)
listenAnyMouseEvent
in interface GuiDriver<F,java.awt.image.BufferedImage>
wid
- The widget to be notified.when
- Only events generated after this timestamp will be notified.public 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.
registerWidgetPopup
in interface GuiDriver<F,java.awt.image.BufferedImage>
wid
- The widget id.btn
- The button to be pressed, when showing the popup.pid
- The popup widget ID.public void registerTooltipWorker(Widget<GuiOutputManager> widget, int fnt, boolean now)
registerTooltipWorker
in interface GuiDriver<F,java.awt.image.BufferedImage>
widget
- The widget object to register.fnt
- The font to draw tooltip text.now
- The flag indicating whether the action be registered immediately or later.public void registerPendingTooltipWorkers(int wid)
registerPendingTooltipWorkers
in interface GuiDriver<F,java.awt.image.BufferedImage>
wid
- The widget id. 0 means register all pending workers.public void deregisterTooltipWorkers(int wid)
deregisterTooltipWorkers
in interface GuiDriver<F,java.awt.image.BufferedImage>
wid
- The widget id. 0 means deregister all registered workers.public void deregisterWidget(int wid)
deregisterWidget
in interface GuiDriver<F,java.awt.image.BufferedImage>
wid
- The widget ID.public void registerMouseWidgets()
No-op by default.
registerMouseWidgets
in interface GuiDriver<F,java.awt.image.BufferedImage>
public void registerDirectManipulation(Widget<GuiOutputManager> widget)
registerDirectManipulation
in interface GuiDriver<F,java.awt.image.BufferedImage>
widget
- The widget object to register.protected java.lang.String getPrintOutputFile(MediaType format)
format
- Report output format.private boolean registerPendingTooltipWorkerInt(Widget<GuiOutputManager> widget)
widget
- The widget object. Null means register all pending workers.TRUE
if worker registered, FALSE
otherwise.private void deregisterTooltipWorkerInt(int wid)
wid
- The widget id.protected AbstractGuiDriver.TextMetrics resolveTextMetrics(java.lang.String text, FontDetails<F> fd)
If the textMetricsCache
doesn't already contain it, they are resolved now.
text
- The text for which metrics are needed.fd
- The font details.protected AbstractGuiDriver.TextMetrics getTextMetrics(java.lang.String text, FontDetails<F> fd)
textMetricsCache
.text
- The text for which metrics are needed.fd
- The font details.null
if they don't yet exist.protected void setTextMetrics(java.lang.String text, FontDetails<F> fd, AbstractGuiDriver.TextMetrics metrics)
textMetricsCache
.text
- The text for which metrics are needed.fd
- The font details.metrics
- The metrics.protected boolean isActualTextMetricsCached(java.lang.String text, FontDetails<F> font)
true
if an actual (not approximate) text metrics is cached for the
given text and font.text
- Text for which we check the existence of the metrics.font
- Font (which is used to draw the text) for which we check the existence of the
metrics.private void enableEventsForNonModalWnd(boolean capture)
capture
- Flag indicating OS level events are captured (when true
).private AbstractGuiDriver.TextMetrics resolveParagraphMetrics(java.lang.String text, FontDetails<F> fd, int maxWidth)
If the paragraphMetricsCache
doesn't already contain it, they are resolved now.
text
- The text for which metrics are needed.fd
- The font details.maxWidth
- The maximum width in which the paragraph must fit.protected boolean isEmptyText(java.lang.String text)
text
- The text to check.true
if the text is null
or empty string.