public class GuiWebDriver extends AbstractGuiDriver<java.lang.Integer> implements EmbeddedWebServer, ScreenWebDriver, ClientProtocolHooks, EmbeddedClient, DocumentOutputStorage, FileUploadStorage, WebConfigurationConstants
| Modifier and Type | Class and Description |
|---|---|
private class |
GuiWebDriver.RepaintThread
Dedicated thread responsible of processing repaint requests.
|
AbstractGuiDriver.TextMetrics, AbstractGuiDriver.UriScreenDriver.UriPathAnchor| Modifier and Type | Field and Description |
|---|---|
private int |
activeWindowId
The active window.
|
private java.util.Map<java.lang.Integer,java.util.List<MsgBlasterPeer>> |
blasterListeners
The set of listened widgetId.
|
private static java.awt.Component |
BOGUS_AWT_COMPONENT
A bogus AWT component used to raise mouse events, on notification from the JS code.
|
private java.util.function.Supplier<java.lang.Integer> |
browserTimeoutSupplier
The number of milliseconds to wait a page to be loaded in a HTML browser
|
private NativeDimension |
desktop
Desktop bounds.
|
private int |
directUploadsModcount
The cached modification count of the effective list of direct upload definitions
|
private java.util.Map<java.util.UUID,DocumentOutput> |
documentOutputs
Map of document outputs pending to be sent to the Javascript part of the client.
|
private boolean |
embedded
Indicates if the web client embedded mode is on or off.
|
private double[] |
fontScaleX
A cache of font scaling factors, by their remote font ID.
|
private MousePtrWrapper |
globalCursor
The global cursor.
|
private java.util.function.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>> |
helperApplicationsSupplier
The provider of the supported helper applications.
|
private static int[] |
HOVER_ACTIONS
Actions for hoverable widgets
|
private java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> |
imageSeals
Maps the image seal to the unique image identity.
|
private java.util.Map<java.util.List<java.lang.Integer>,org.roaringbitmap.RoaringBitmap> |
imageUsages
Image usages is a mapping of an image loaded by a client to its owner windows.
|
private SupplierWithMemo<KeyboardLayoutsSettings> |
keyboardSupplier
The provider of keyboard layouts settings
|
private java.util.Set<java.lang.String> |
langCache
Language Ids cache
|
private int |
lastFocusedWidget
The focused widget saved during the last processing of interactive widgets
|
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,org.roaringbitmap.RoaringBitmap>> |
lastMouseWidgets
A map with the last widgets sent to the JS side in [ windowid : [widgetId : actions] ]
form.
|
private FontDetails<java.lang.Integer> |
lastUsedFont
The last font set.
|
private LocalStorageAccessor |
localStorageAccessor
Accessor for localStorage
|
private java.lang.Object |
lock
Lock object for shared syncrhonization of the web socket.
|
private static CentralLogger |
LOG
Logger.
|
private static java.lang.String |
MAIN_TARGET
Main page root target.
|
private static long |
MAX_PRINT_OUTPUT_AGE
Max age of print outputs in milliseconds.
|
static java.lang.String |
NAME
Driver name.
|
private boolean |
needsNotificationOnWait
The notify-user-input state.
|
private int |
nextFontId
A counter for font IDs to be mapped on the js-side.
|
private java.net.URL |
originUrl
The origin URL of the embedded web server's index page
|
private java.util.Map<java.lang.Integer,java.util.Set<java.util.List<java.lang.Integer>>> |
ownedImages
Owned images is a mapping of a window to its owned images seals.
|
private boolean |
registerMouseWidgets
Flag indicating if
registerInteractiveWidgets() must be executed. |
private java.util.LinkedList<GuiWebEmulatedWindow> |
repaints
A queue of pending repaint requests which needs to be processed by the
GuiWebDriver.RepaintThread thread. |
private org.roaringbitmap.RoaringBitmap |
stateChanged
Set of widget IDs for which their state has changed.
|
private boolean |
taskbar
Flag indicating if the virtual desktop taskbar is shown.
|
static int |
TASKBAR_HEIGHT
Taskbar height in pixels when it exists.
|
private TaskBarStyle |
taskBarStyle
The task bar style on the virtual desktop
|
private static java.lang.String |
TEXT_SAMPLE
Text sample to calculate scaling factor for variable size fonts.
|
private static java.lang.String |
TEXT_SAMPLE_MONO
Text sample to calculate scaling factor for monospace fonts.
|
private java.util.HashMap<java.lang.Integer,FileUploadInfo> |
uploads
Active uploads
|
private VirtualScreen |
virtualScreen
Virtual screen for drawing in a memory
|
private GuiWebSocket |
websock
Web-Socket which provides a GUI-specific protocol for communication with the browser.
|
private EmbeddedWebServerImpl |
websrv
Delgated implementation for the embedded web server.
|
private static java.lang.String |
WELCOME_PAGE
Welcome page.
|
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,NativeRectangle>> |
widgetsRegions
Collects the mouse widgets belonging to a window.
|
private NativeDimension |
workarea
Work-Area bounds.
|
config, control, driverWidgets, ews, tmpDir, translatedOrigin, win32MousePositionBEEP_FILE_PATH, direct, factoryCONNECTION_RESTORED_MESSAGE, CONNECTION_TIMEOUT, DELAY_BETWEEN_CONNECT_TRIES, DELAY_BETWEEN_PING_TRIES, ENABLE_DEBUG_LOGGING, INFINITE_TIMEOUT, MAX_BINARY_MESSAGE_SIZE, MAX_LOST_PINGS, MAX_TEXT_MESSAGE_SIZE, MAX_WEB_SOCKET_IDLE_TIMEOUT, OUTPUT_AGGREGATION_SIZE, OUTPUT_BUFFER_SIZE, PING_PONG_INTERVAL, REQUEST_HEADER_SIZE, RESPONSE_HEADER_SIZE, SERVER_UNAVAILABLE_MESSAGE, TRY_TO_CONNECT_MESSAGE, WATCH_DOG_TIMEOUT| Constructor and Description |
|---|
GuiWebDriver(BootstrapConfig config)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(org.eclipse.jetty.server.Handler handler)
Adds a custom handler.
|
boolean |
addImageUsage(java.util.List<java.lang.Integer> imageHash,
int windowId)
Register a usage of the given image by the given window.
|
void |
addMessageListener(MsgBlasterPeer listener,
int windowId,
int widgetId)
Add a low-level message listener for a specific window.
|
void |
beep()
Provide an audible feedback to user by generating a beep signal.
|
void |
cacheTextMetrics(java.util.Map<FontDetails<java.lang.Integer>,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.
|
ChooseFileResult |
chooseFiles(java.lang.String title,
boolean multiple,
boolean upload,
java.lang.String uploadDir,
java.lang.String[] filters)
Supported by web-based drivers.
|
void |
clearMessages(int windowId)
Clear all message texts of specified window.
|
void |
clientReady()
Notify the driver that the client is ready (useful for embedded mode, to notify the embedded
app the client can handle messages).
|
java.lang.String |
clipboardContents()
Get the current contents from the OS clipboard.
|
private void |
collectWidgets(Widget w,
java.util.function.Predicate<Widget> filter,
java.util.function.Consumer<Widget> actionsCollector)
Add the widget (and all its possible children) in the specified set, maintaining z-order in
a left-to-right (topmost to bottommost) order.
|
void |
copyToClipboard(java.lang.String txt)
Copy the given text to the system clipboard.
|
FontDetails<java.lang.Integer> |
createFont(FontDetails<java.lang.Integer> details)
Create a font with the given details and register it with the driver.
|
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 |
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.
|
DocumentOutput |
dequeueDocumentOutput(java.util.UUID uuid)
Returns the document outputs previously enqueued with
enqueueDocumentOutput(DocumentOutput). |
void |
deregisterWidget(int wid)
Deregister the specified widget for mouse events.
|
void |
deriveFont(FontDetails<java.lang.Integer> fd)
Scale the given font to match the screen resolution.
|
void |
desktopResized(int width,
int height,
TaskBarStyle taskBarStyle)
Called when the desktop on the client has changed its dimensions.
|
void |
doTextShift(java.lang.String text,
int widthHint)
Draws the cursor for the given text widget.
|
void |
drawCursor(LightweightTextWidget widget)
Draws the cursor for the given text widget.
|
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 |
enableEvents(int[] windowIds,
boolean capture)
Enable or Disable OS-level events for the specified windows.
|
void |
enqueueDocumentOutput(DocumentOutput docOutput)
The method stores document outputs pending to be sent to the Javascript part of FWD client.
|
void |
fillRectAroundText(int x,
int y,
int textWidthHint,
int textHeightHint,
java.lang.String text)
Fill a rectangle around the given text.
|
boolean |
findAnyIdInChannel(java.lang.String channelName,
java.util.List<java.lang.String> channelIds)
Searches for the specified channel instances and returns
true if any found,
false otherwise. |
int[] |
getBasicWebPalette()
Queries the web driver for a basic palette.
|
BrowserDetails |
getBrowserDetails()
Returns the browser details for web drivers.
|
int |
getClientFontHeight(FontDetails<java.lang.Integer> fd)
Get the height of the font from the client native environment.
|
int |
getClientTextWidth(java.lang.String text,
FontDetails<java.lang.Integer> fd)
Get the width of the specified text for the given font from the client native environment,
the browser or swing environments.
|
private java.util.Map<java.lang.Integer,java.util.List<ClientDirectUploadDef>> |
getDirectUploadDefinitions()
Retrieves the effective direct upload definitions.
|
NativeRectangle |
getDisplayBounds()
Since web interface is inherently a single-display setup the method
effectively returns a rectangle with top-level corner equal to 0,0.
|
NativeRectangle |
getDisplayWorkArea()
Returns an application-usable display area.
|
FileUploadInfo |
getFileUpload(int id)
Returns file upload metadata.
|
MousePtrWrapper |
getGlobalCursor()
Retrieves the globally assigned cursor.
|
long |
getHostByName(java.lang.String name)
Returns the currently connected client's machine name for session.
|
java.lang.String |
getHostName()
Returns the currently connected client's machine name for session.
|
KeyValueStorage |
getLocalStorageAccessor(java.lang.String storageId,
java.lang.String fwdUser)
Returns accessor for localStorage for web drivers.
|
private static int |
getMouseModifiers(int button,
int modifiersMask)
Gets the mouse modifiers mask for this event.
|
NativePoint |
getMousePosition()
Returns current mouse cursor display position relative to the display origin.
|
java.lang.String |
getName()
Get the driver name.
|
java.net.URL |
getOriginUrl()
Returns the origin URL of the embedded web server's index page.
|
int |
getScreenResolution()
Reports the screen resolution in dots per inch (DPI).
|
java.lang.String |
getServerURI()
Get the embedded web server's URI.
|
int |
getTextWidth(java.lang.String text,
FontDetails<java.lang.Integer> fd)
Get the width of the specified text, using the given font.
|
int[] |
getTextWidths(java.lang.String text,
FontDetails<java.lang.Integer> fd)
Get the widths of the specified text, using the given font.
|
java.lang.Integer |
getUniqueIdForSeal(java.util.List<java.lang.Integer> imageSeal)
Gets the unique image id by its identity array.
|
VirtualScreen |
getVirtualScreen()
Returns its virtual screen that represents the physical screen in a memory
using a sRGB pixel model.
|
NativeDimension |
getVirtualScreenSize()
Returns the size of the virtual screen, i.e.
|
private static org.roaringbitmap.RoaringBitmap |
getWebActions(Widget widget)
Returns the set of mouse actions handled by this widget.
|
void |
init()
Initialize driver.
|
void |
initClipboardSoftPaste()
Init widget generated PASTE command from the OS clipboard.
|
void |
initRemoteClient()
Called each time a connect occurs, this allows caller-controlled initialization of the
remote client.
|
void |
injectVT100Key(int keyCode,
char charCode)
Input key events when in VT100 mode.
|
boolean |
isEmbeddedClient()
Returns true if this client runs in embedded mode.
|
boolean |
isFontInstalled(java.lang.String fontName,
boolean boldFont)
Returns the boolean value if the target font is installed or not.
|
private boolean |
isInLastMouseWidgets(java.lang.Integer widgetId,
java.lang.Integer windowId)
Tests if the given mouse widget is in the last mouse widgets map.
|
private static boolean |
isInsideVisibleFrameOrStandalone(Widget wid)
Checks if the given widget is belonging to visible frame or not inside any frame, like
window decorations.
|
boolean |
isWeb()
All web-based drivers return
true. |
boolean |
isWindowDecorationSupported()
Returns true if a window can be decorated in this graphics environment, otherwise false.
|
void |
lockMousePointer(int widgetId,
MousePtrWrapper ptr)
Lock the mouse pointer (suppress widget-specific changes) or unlock it
|
void |
lowLevelEvent(int widgetId,
int winId,
int messageId,
int p1,
int p2,
int p3)
Sends a notification of a low-level event for a listening widget.
|
void |
lowLevelMouseEvent(java.awt.event.MouseEvent evt,
MouseOps mop,
int windowId)
Sends a notification of a low-level mouse event for a listening widget.
|
void |
mapSealToUniqueId(java.util.List<java.lang.Integer> imageSeal,
java.lang.Integer uniqueId)
Maps the image identity array to the unique image id.
|
private static java.lang.String |
mimeType(java.lang.String icon)
Detect MIME type of image.
|
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
GuiDriver.cacheTextMetrics(Map, Integer). |
EmulatedWindowState |
newChildWindowEmulator(int windowId,
EmulatedWindowState parentWindow,
java.lang.String windowTitle,
boolean resizable,
boolean isShareActivationWithOwner,
boolean modal)
Create a new child window emulator.
|
EmulatedWindowState |
newEmulator(int windowId,
boolean showInTaskbar)
Create a new window emulator.
|
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.
|
void |
openMimeResource(boolean deleteContent,
java.lang.String mimeType,
java.lang.String uriString,
boolean embedded)
Opens the specified resource in a browser's window.
|
void |
openMimeResource(java.lang.String mimeType,
java.lang.String resourcePath,
ScreenDriver.UriPathAnchor uriPathAnchor)
Opens the specified resource in a browser's window.
|
int[][] |
parseEditorContent(int widgetId,
int windowId,
int maxWidth,
java.lang.String text,
int delta,
FontDetails<java.lang.Integer> font)
Split the text for a editor widget, so that it fits the specified maximum width.
|
boolean |
pingBroadcastChannel(java.lang.String channelName,
java.lang.String targetChannelId)
Returns if the target broadcast channel responds with pong.
|
boolean |
pingOnWebSocket()
Check if the WebSocket connection is alive.
|
protected void |
postRepaint(GuiWebEmulatedWindow ews)
Post a new repaint for the specified window to the
repaints queue. |
void |
propagate(int windowId,
int wid,
MousePtrWrapper ptr)
Push information about the loaded mouse pointer for widget
|
void |
propagateWaitState(boolean isWaitState)
Propagate wait state
|
void |
publish(long subId,
java.lang.String event,
java.lang.String[] param)
Send a PUBLISH notification to a remote application.
|
void |
putFileUpload(int id,
FileUploadInfo uploadInfo)
The method stores an instance with file upload metadata.
|
void |
raiseMouseEvent(int windowId,
int mouseOp,
long tstamp,
int mouseX,
int mouseY,
int button,
int clickCount,
int modifiersMask,
int[] wheelParameters,
int widgetId)
Raise a mouse event.
|
KeyCode |
readKey()
Read single keystroke from keyboard.
|
void |
registerBroadcastChannel(java.lang.String channelName,
java.lang.String channelId)
Opens a broadcast channel in the client's front-end.
|
void |
registerHoverableWidget(MouseHoverAction action)
Register this widget as being editable, so that the mouse cursor will adjust properly when
the widget is entered.
|
void |
registerInteractiveWidgets()
Register all the mouse-aware widgets (in all Windows) with the JS side.
|
void |
registerMoveableWidget(int wid)
Register the specified widget as a moveable widget, via mouse.
|
void |
registerResizeableWidget(int wid)
Register the specified widget as a resizeable widget, via mouse.
|
UnformattedPayload |
remoteCall(UnformattedPayload request)
This is a special API which is used to delegate a call from converted 4GL code
(via _P2J_REMOTE_CALL_ functions) to the remote side.
|
void |
removeDocuments(java.util.Set<java.util.UUID> documents)
Remove the given documents from the storage
|
void |
removeFileUpload(int id)
Removes metadata for a particular upload.
|
void |
removeGlobalCursor()
Removes the assigned global cursor.
|
void |
removeHandler(org.eclipse.jetty.server.Handler handler)
Removes the handler from the list of handlers.
|
void |
removeMessageListener(MsgBlasterPeer listener,
int windowId,
int widgetId)
Removes a low-level message listener for a specific window.
|
int[] |
removeUnusedImages(int windowId)
Returns all unused images.
|
void |
resetSelection()
Reset selection boxes painting mode and return to normal drawing mode.
|
(package private) DocumentOutput |
resolveResource(boolean deleteContent,
java.lang.String mimeType,
ContentDisposition contentDisposition,
java.io.File originalFile)
Resolve the document output used to retrieve the content of the original file.
|
(package private) DocumentOutput |
resolveResource(boolean deleteContent,
java.lang.String mimeType,
ContentDisposition contentDisposition,
java.io.File originalFile,
java.util.function.BiConsumer<java.io.File,java.io.File> customCopy,
boolean cached)
Resolve the document output used to retrieve the content of the original file.
|
void |
restackWindows(int[] windowIds)
Force the list of all GUI windows to be stacked as in the specified order.
|
OsPassChangeInput |
retryPassChangeOnError(java.lang.String osUserName,
java.lang.String errMsg)
Shows an error message in the OS pass change process.
|
void |
saveDropTargetFile(java.lang.String name,
byte[] data,
int size)
Stores the given byte array date as file in Java temporary directory with the given name.
|
void |
saveDropTargetFile(java.lang.String name,
java.nio.channels.FileChannel channel,
int length)
Reads the data from the given file channel starting from its current position and stores
the retrieved data into the file in Java temporary directory with the given name.
|
void |
setControl(boolean control)
Notify the driver which side has control (client-side (when
true) or server,
otherwise). |
void |
setCurrentLanguage(java.lang.String language)
Set new current session language for the client.
|
void |
setCurrentSelection(java.lang.String txt)
Sets the current editors selection.
|
void |
setCursor(MousePtrWrapper ptr)
Set the mouse cursor
|
void |
setCursor(java.lang.String icon)
Set the mouse cursor from a given resource.
|
void |
setGlobalCursor(MousePtrWrapper ptr)
Assign a cursor for the entire web application.
|
void |
setGuiFont(FontDetails<java.lang.Integer> font)
Set current font used on draw operations.
|
void |
setMessageText(int windowId,
java.lang.String[] message)
Add message texts of specified window.
|
void |
setNeedsNotificationOnWait(boolean newState)
The method is executed by the JS client when it requires to be notified when 4GL program execution
enters modal or wait-for event loop, in other words when user input is expected.
|
void |
setOriginUrl(java.net.URL originUrl)
Assigns the origin URL of the embedded web server's index page.
|
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 |
setStatusText(int windowId,
java.lang.String message)
Set status text message of specified window.
|
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.
|
void |
setWindowDimension(int windowId,
int width,
int height)
Set the dimension for the specified window.
|
void |
setWindowLocation(int windowId,
int x,
int y)
Set the location for the specified window.
|
OsPassChangeInput |
showChangePasswordDialog(java.lang.String osUserName,
boolean isModal)
Shows a dialog to allow the change of the OS account password.
|
void |
showSuccessfulPassChange()
Shows that the OS pass has been changed successfully on the front-end and hide the dialog.
|
void |
shutdown()
Perform driver shutdown.
|
void |
shutdownServer()
Shutdown the embedded web server.
|
void |
startDirectManipulation(int opType,
boolean gridSnapOn,
int resizeDir,
NativeRectangle maxBounds,
NativeRectangle[] nr)
Uses websocket to notify the JS side the direct manipulation has started to draw the
selection box(es).
|
void |
startDropTarget(int windowId,
int widgetId,
java.util.List<java.lang.String> fileNameList)
Initiates the process of the file list dropping for web clients.
|
java.lang.String |
startupServer(ServerKeyStore keyStore,
BootstrapConfig config,
java.lang.String host,
int port)
Startup the embedded server using the server's key store to build the web server SSL
context.
|
private void |
syncDesktopDimensions()
Fetches the desktop dimension from the client and calls
updateDesktopDimensions(int, int) with the result. |
private boolean |
updateCachedWidgetBounds(int windowId,
Widget widget,
NativeRectangle[] widgetBounds)
Updates the cached widgets bounds and returns true iff the cached widgets bounds has been
updated.
|
private void |
updateDesktopDimensions(int width,
int height)
Updates the class state that relies on the client desktop dimensions.
|
void |
waitInitialization()
Wait for the page to notify that it has fully initialized its JS code.
|
void |
widgetStateChanged(int widgetId)
Notification that this widget's state has changed (visibility, sensitivity, z-order).
|
void |
windowActivated(int deactivatingWindowId,
int activatingWindowId)
Raise an event indicating that the target window has been activated or deactivated.
|
void |
windowIconified(int windowId,
boolean state)
Raise an event as the window was (de)iconified.
|
private static java.lang.String |
writeLauncherWrapper(java.lang.String uriString)
Create the wrapper for the launcher resource.
|
changeSensitivity, changeVisibility, clear, copyResource, copyResource, createGreyImage, createIcon, createImage, createMouseDirectManipulationInstance, createOutputManager, deiconifyWindow, deregisterTooltipWorkers, deregisterWindow, destroyWidget, draw, draw, draw3DRect, drawEdge, drawEllipse, drawFromOrigin, drawHighlight, drawIbeam, drawImage, drawImage, drawLine, drawParagraph, drawRect, drawRoundRect, drawSelection, drawStringCentered, drawStringScaled, drawStringWithinBox, drawStringWithinBoxScaled, drawStringWithinBoxWithMnemonic, drawStringWithMnemonic, drawTextSelection, endBatch, fill3DRect, fillEllipse, fillPolygon, fillRect, fillRoundRect, fitStringWithEllipsis, getBgColor, getBgStdColor, getChildProcessFactory, getDisplayBounds, getDisplayWorkArea, getDriverWidget, getFgColor, getFgStdColor, getFontHeight, getFontMaxWidth, getFontWidth, getFontWidths, getParagraphHeight, getPrintOutputFile, getSubImage, getSysColor, getTextHeight, getTextMetrics, getTextWidths, getWindowDimension, getWindowLocation, handleMouseEvent, hasWindowEmulator, iconifyWindow, initDragAndDrop, invokeWidgetCommand, invokeWidgetCommand, isActualTextMetricsCached, isEmptyText, isWindowVisible, makeImage, moveResource, placeWidget, registerChildWindow, registerDirectManipulation, registerEmptySelector, registerPendingTooltipWorkers, registerTooltipWorker, registerWidgetPopup, registerWindow, releaseWindow, resetComposite, resetMode, resizeWindow, resolveTextMetrics, restoreDrawingState, resume, resume, saveDrawingState, scaleFont, selectWindow, setColor, setColor, setCursorStatus, setDesktopBgColor, setDisableRedraw, setDrawingArea, setDrawingAreas, setFontStyle, setIcon, setLineStroke, setLineStroke, setTextMetrics, setTitle, setWidgetAttribute, setWidgetBounds, setWin32MousePosition, setWindowBounds, setWindowEnabled, setWindowLocation, setWindowLocation, setWindowVisible, setXORComposite, setXORMode, squeeze, stackWindows, startBatch, suspend, suspend, translatePop, translatePush, updateClientMetricsgetFactory, getPrimitives, getWindowSystem, inBackgroundMode, inBatchMode, isChui, playBeep, setBackgroundMode, setBatchMode, setTerminalType, terminalTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetAlwaysOnTop, withSelectedWindowgetFactory, getPrimitives, getWindowSystem, inBackgroundMode, inBatchMode, isChui, setTerminalType, terminalTypepublic static final java.lang.String NAME
public static final int TASKBAR_HEIGHT
private static final CentralLogger LOG
private static final java.lang.String MAIN_TARGET
private static final java.lang.String WELCOME_PAGE
private static final java.awt.Component BOGUS_AWT_COMPONENT
private static final int[] HOVER_ACTIONS
private static final long MAX_PRINT_OUTPUT_AGE
documentOutputs form where it is later served to JS client. Print outputs are removed
from the map either upon successful delivery to the JS client or when the age extends over this value.private static final java.lang.String TEXT_SAMPLE
private static final java.lang.String TEXT_SAMPLE_MONO
private EmbeddedWebServerImpl websrv
private GuiWebSocket websock
private java.lang.Object lock
private NativeDimension desktop
private NativeDimension workarea
private VirtualScreen virtualScreen
private final java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> imageSeals
private final java.util.Map<java.util.List<java.lang.Integer>,org.roaringbitmap.RoaringBitmap> imageUsages
private final java.util.Map<java.lang.Integer,java.util.Set<java.util.List<java.lang.Integer>>> ownedImages
private int nextFontId
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,org.roaringbitmap.RoaringBitmap>> lastMouseWidgets
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,NativeRectangle>> widgetsRegions
private java.util.LinkedList<GuiWebEmulatedWindow> repaints
GuiWebDriver.RepaintThread thread.private int activeWindowId
private final boolean embedded
private boolean taskbar
private TaskBarStyle taskBarStyle
private java.util.Map<java.util.UUID,DocumentOutput> documentOutputs
private volatile boolean needsNotificationOnWait
private boolean registerMouseWidgets
registerInteractiveWidgets() must be executed. This is to minimize
the amount of calls, and is performed only when client-side receives control.private double[] fontScaleX
private org.roaringbitmap.RoaringBitmap stateChanged
private java.util.HashMap<java.lang.Integer,FileUploadInfo> uploads
private SupplierWithMemo<KeyboardLayoutsSettings> keyboardSupplier
private java.util.function.Supplier<java.lang.Integer> browserTimeoutSupplier
private java.util.function.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>> helperApplicationsSupplier
private FontDetails<java.lang.Integer> lastUsedFont
private java.util.Set<java.lang.String> langCache
private java.net.URL originUrl
private LocalStorageAccessor localStorageAccessor
private int directUploadsModcount
private int lastFocusedWidget
private MousePtrWrapper globalCursor
private final java.util.Map<java.lang.Integer,java.util.List<MsgBlasterPeer>> blasterListeners
public GuiWebDriver(BootstrapConfig config)
config - The BootstrapConfig configuration.public java.lang.String getName()
getName in interface ScreenDriver<GuiOutputManager>public void init()
init in interface ScreenDriver<GuiOutputManager>init in class AbstractDriver<GuiPrimitives,GuiOutputManager>public KeyValueStorage getLocalStorageAccessor(java.lang.String storageId, java.lang.String fwdUser)
getLocalStorageAccessor in interface ScreenWebDriverstorageId - Unique id for the storage.fwdUser - The FWD user name.KeyValueStorage instance.public BrowserDetails getBrowserDetails()
getBrowserDetails in interface ScreenWebDriverpublic OsPassChangeInput showChangePasswordDialog(java.lang.String osUserName, boolean isModal)
showChangePasswordDialog in interface ScreenWebDriverosUserName - The OS account name.isModal - Flag to indicate if the dialog should be modal (non-dismissible).public void showSuccessfulPassChange()
showSuccessfulPassChange in interface ScreenWebDriverpublic OsPassChangeInput retryPassChangeOnError(java.lang.String osUserName, java.lang.String errMsg)
retryPassChangeOnError in interface ScreenWebDriverosUserName - The OS account name.errMsg - The error message.public void registerBroadcastChannel(java.lang.String channelName,
java.lang.String channelId)
registerBroadcastChannel in interface ScreenWebDriverchannelName - The name of the channel. The same for all instances of the app. Usually package root.channelId - The ID of the channel. Unique for this instance of the app. Usually session ID.public boolean pingBroadcastChannel(java.lang.String channelName,
java.lang.String targetChannelId)
pingBroadcastChannel in interface ScreenWebDriverchannelName - The name of the channel. The same for all instances of the app. Usually package root.targetChannelId - The id of the target channel. Unique for this instance of the app. Usually session ID.true if the target broadcast channel responds with pong,
false otherwise.public boolean findAnyIdInChannel(java.lang.String channelName,
java.util.List<java.lang.String> channelIds)
true if any found,
false otherwise.findAnyIdInChannel in interface ScreenWebDriverchannelName - The broadcast channel name.channelIds - A list of channel ids to check for.true if any of the channel instances found, false otherwise.public boolean pingOnWebSocket()
pingOnWebSocket in interface ScreenWebDrivertrue if the websocket connection is alive, false otherwise.public java.net.URL getOriginUrl()
public void setOriginUrl(java.net.URL originUrl)
originUrl - The URL to be assigned.public void clientReady()
clientReady in interface ScreenDriver<GuiOutputManager>public void initRemoteClient()
Whenever the main page is loaded or re-loaded, the WebSocket will connect and we must put the virtual terminal into a known state.
initRemoteClient in interface ClientProtocolHookspublic void waitInitialization()
waitInitialization in interface EmbeddedWebServerpublic void addHandler(org.eclipse.jetty.server.Handler handler)
addHandler in interface EmbeddedWebServerhandler - The handler to add.public void removeHandler(org.eclipse.jetty.server.Handler handler)
removeHandler in interface EmbeddedWebServerhandler - The handler to remove.public UnformattedPayload remoteCall(UnformattedPayload request)
This API is expected to block waiting for a response.
remoteCall in interface EmbeddedClientrequest - The request data incoming from 4GL.public void publish(long subId,
java.lang.String event,
java.lang.String[] param)
publish in interface EmbeddedClientsubId - The subscriber's ID, known by the remote application.event - The published event name.param - The parameters for this event.public void setStatusText(int windowId,
java.lang.String message)
setStatusText in interface EmbeddedClientwindowId - Window ID.message - Text message.public void setMessageText(int windowId,
java.lang.String[] message)
setMessageText in interface EmbeddedClientwindowId - Window ID.message - Text message.public void clearMessages(int windowId)
clearMessages in interface EmbeddedClientwindowId - Window ID.public void injectVT100Key(int keyCode,
char charCode)
injectVT100Key in interface ClientProtocolHookskeyCode - The key code from the input event.charCode - The character code from the input event.public NativeRectangle getDisplayBounds()
public VirtualScreen getVirtualScreen()
public boolean addImageUsage(java.util.List<java.lang.Integer> imageHash,
int windowId)
imageHash - The image hash id.windowId - The window id.public int[] removeUnusedImages(int windowId)
windowId - The window id.public void mapSealToUniqueId(java.util.List<java.lang.Integer> imageSeal,
java.lang.Integer uniqueId)
imageSeal - The image identity array.uniqueId - The image unique id.public java.lang.Integer getUniqueIdForSeal(java.util.List<java.lang.Integer> imageSeal)
imageSeal - The image identity array.public NativeRectangle getDisplayWorkArea()
public void beep()
beep in interface ScreenDriver<GuiOutputManager>public KeyCode readKey()
readKey in interface ScreenDriver<GuiOutputManager>null if no keys were pressed since last call.public java.lang.String getHostName()
getHostName in interface ScreenDriver<GuiOutputManager>getHostName in class AbstractDriver<GuiPrimitives,GuiOutputManager>public long getHostByName(java.lang.String name)
getHostByName in interface ScreenDriver<GuiOutputManager>getHostByName in class AbstractDriver<GuiPrimitives,GuiOutputManager>name - The name of the host to get IP.public EmulatedWindowState newEmulator(int windowId, boolean showInTaskbar)
The method ignores the alwaysOnTop flag.
newEmulator in class AbstractGuiDriver<java.lang.Integer>windowId - The window ID.showInTaskbar - If set to true the window will be shown in the virtual desktop's taskbar.public EmulatedWindowState newChildWindowEmulator(int windowId, EmulatedWindowState parentWindow, java.lang.String windowTitle, boolean resizable, boolean isShareActivationWithOwner, boolean modal)
newChildWindowEmulator in class AbstractGuiDriver<java.lang.Integer>windowId - The window ID.parentWindow - The parent 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 FontDetails<java.lang.Integer> createFont(FontDetails<java.lang.Integer> details)
createFont in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>details - The font specifications.public void deriveFont(FontDetails<java.lang.Integer> fd)
deriveFont in class AbstractGuiDriver<java.lang.Integer>fd - Font to scale. This instance's contained font will be modified.public int getScreenResolution()
getScreenResolution in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public void copyToClipboard(java.lang.String txt)
copyToClipboard in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>txt - The text to be copied.public java.lang.String clipboardContents()
clipboardContents in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public void initClipboardSoftPaste()
public void restackWindows(int[] windowIds)
restackWindows in class AbstractGuiDriver<java.lang.Integer>windowIds - The stack order to be enforced.public void moveToTop(int windowId,
boolean focus)
moveToTop in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>moveToTop in class AbstractGuiDriver<java.lang.Integer>windowId - The window to be moved.focus - If true, the window will become the focused window
and its state changed to active.public void moveToBottom(int windowId)
moveToBottom in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>moveToBottom in class AbstractGuiDriver<java.lang.Integer>windowId - The window to be moved.public void shutdown()
shutdown in interface ScreenDriver<GuiOutputManager>shutdown in class AbstractGuiDriver<java.lang.Integer>public java.lang.String startupServer(ServerKeyStore keyStore, BootstrapConfig config, java.lang.String host, int port)
There are two page handlers. One is for the root ("/") target and the other is for the index ("/index.html") target. Both load the same page index.html.
When the user is first redirected the URL is https://server:port/ and the
target is "/". The index.html page is loaded for this target.
After redirection and the main page is loaded, the URL in the browser address bar will
become https://server:port/index.html and the corresponding target is now
"/index.html".
When the user reloads the main page within the browser environment the "/index.html" target is sent to the web server and the same main page index.html is loaded.
startupServer in interface EmbeddedWebServerkeyStore - The exported server KeyStore.config - Client configuration.port - An explicit port to start the web server or 0 to let the OS assign one.host - An explicit host to start the web server or null to use the server's
host.public void shutdownServer()
shutdownServer in interface EmbeddedWebServerpublic java.lang.String getServerURI()
getServerURI in interface EmbeddedWebServerpublic boolean captureMouseEvents(boolean state)
It also notifies the JS side to enable/disable mouse events.
captureMouseEvents in interface ScreenDriver<GuiOutputManager>captureMouseEvents in class AbstractGuiDriver<java.lang.Integer>state - true to capture mouse events, false to ignore them.public void raiseMouseEvent(int windowId,
int mouseOp,
long tstamp,
int mouseX,
int mouseY,
int button,
int clickCount,
int modifiersMask,
int[] wheelParameters,
int widgetId)
raiseMouseEvent in interface ClientProtocolHookswindowId - The window ID.mouseOp - The mouse event code.tstamp - The event timestamp.mouseX - The absolute mouse X for this event.mouseY - The absolute mouse Y for this event.button - The button which was pressed.clickCount - The click count.modifiersMask - The bit mask that represents the modifiers keys are pressed. The 0-bit corresponds
to the shift key, the 1-bit to the ctrl key, the 2-bit to the meta key and
the 3-bit to the alt key.wheelParameters - The array that represents the wheel rotation amount and its unit.widgetId - The explicit widget ID to which this event needs to be posted.public void startDropTarget(int windowId,
int widgetId,
java.util.List<java.lang.String> fileNameList)
startDropTarget in interface ClientProtocolHookswindowId - The window ID.widgetId - The widget ID.fileNameList - The oredered file name list to be dropped.public void saveDropTargetFile(java.lang.String name,
byte[] data,
int size)
saveDropTargetFile in interface ClientProtocolHooksname - The file name to create.data - The data to store in the file.size - The size of the to create, used to check the input array.public void saveDropTargetFile(java.lang.String name,
java.nio.channels.FileChannel channel,
int length)
saveDropTargetFile in interface ClientProtocolHooksname - The file name to createchannel - The file channellength - The length of the contentpublic void startDirectManipulation(int opType,
boolean gridSnapOn,
int resizeDir,
NativeRectangle maxBounds,
NativeRectangle[] nr)
opType - The operation type.gridSnapOn - The flag indicating the grid snap is turned on.resizeDir - The widget resize direction for respective operation or -1 if not
used.maxBounds - The bounds that must not be exceeded when direct manipulating the widgets.nr - The array of the rectangle coordinates.public void putFileUpload(int id,
FileUploadInfo uploadInfo)
putFileUpload in interface FileUploadStorageid - Upload id.uploadInfo - The object that encapsulates the upload metadata.public FileUploadInfo getFileUpload(int id)
getFileUpload in interface FileUploadStorageid - Upload id.public void removeFileUpload(int id)
removeFileUpload in interface FileUploadStorageid - Id of the upload metadata to remove.public void setCurrentLanguage(java.lang.String language)
setCurrentLanguage in interface ScreenDriver<GuiOutputManager>setCurrentLanguage in interface ScreenWebDriverlanguage - The language identifierprivate static int getMouseModifiers(int button,
int modifiersMask)
button - The mouse button that is currently pressedmodifiersMask - The bit mask that represents the modifiers keys are pressed. The 0-bit corresponds
to the shift key, the 1-bit to the ctrl key, the 2-bit to the meta key and
the 3-bit to the alt key.public void setWindowLocation(int windowId,
int x,
int y)
setWindowLocation in interface ClientProtocolHookswindowId - The window ID.x - The X coordinate of the top-left corner.y - The Y coordinate of the top-left corner.public void setWindowDimension(int windowId,
int width,
int height)
setWindowDimension in interface ClientProtocolHookswindowId - The window ID.width - The window width.height - The window height.public void windowActivated(int deactivatingWindowId,
int activatingWindowId)
windowActivated in interface ClientProtocolHooksdeactivatingWindowId - Id of the window being deactivated, may be negative.activatingWindowId - Id of the window being activated, always valid.public void windowIconified(int windowId,
boolean state)
windowIconified in interface ClientProtocolHookswindowId - The window ID.state - true if the window was iconified.public void desktopResized(int width,
int height,
TaskBarStyle taskBarStyle)
desktopResized in interface ClientProtocolHookswidth - New desktop width.height - New desktop height.taskBarStyle - Updated task bar style.public void setControl(boolean control)
true) or server,
otherwise).
When control is received, registerInteractiveWidgets() is enabled.
setControl in interface ScreenDriver<GuiOutputManager>setControl in class AbstractGuiDriver<java.lang.Integer>control - Flag indicating (when true) that the client-side has control.public void widgetStateChanged(int widgetId)
widgetStateChanged in interface ScreenDriver<GuiOutputManager>public void registerInteractiveWidgets()
To register a widget, it must be visible, displayed and enabled, and part of a visible window.
This method is executed only when registerMouseWidgets flag is set
(via setControl(boolean)). Once executed, it disables this flag.
registerInteractiveWidgets in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>registerInteractiveWidgets in class AbstractGuiDriver<java.lang.Integer>public int[][] parseEditorContent(int widgetId,
int windowId,
int maxWidth,
java.lang.String text,
int delta,
FontDetails<java.lang.Integer> 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.parseEditorContent in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>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.public void resetSelection()
resetSelection in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public void setUploadFileSizeLimits(int single,
int total)
setUploadFileSizeLimits in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>single - Single file size limit.total - Total file size limit for single operation.private boolean updateCachedWidgetBounds(int windowId,
Widget widget,
NativeRectangle[] widgetBounds)
windowId - The target window id.widget - The target widget with its cached bounds.widgetBounds - On index 0, the computed bounds will be saved.private static org.roaringbitmap.RoaringBitmap getWebActions(Widget widget)
widget - The collected mouse widget.private boolean isInLastMouseWidgets(java.lang.Integer widgetId,
java.lang.Integer windowId)
widgetId - The widget id.windowId - The window id.private java.util.Map<java.lang.Integer,java.util.List<ClientDirectUploadDef>> getDirectUploadDefinitions()
public void registerMoveableWidget(int wid)
This is a no-op for the web client: the work is done by registerInteractiveWidgets().
registerMoveableWidget in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>wid - The widget ID.public void registerHoverableWidget(MouseHoverAction action)
This is a no-op for the web client: the work is done by registerInteractiveWidgets().
registerHoverableWidget in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>action - The widget mouse action.public void propagateWaitState(boolean isWaitState)
propagateWaitState in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>isWaitState - wait statepublic void registerResizeableWidget(int wid)
This is a no-op for the web client: the work is done by registerInteractiveWidgets().
registerResizeableWidget in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>wid - The widget ID.public void deregisterWidget(int wid)
deregisterWidget in interface ScreenDriver<GuiOutputManager>deregisterWidget in class AbstractGuiDriver<java.lang.Integer>wid - The widget ID.public void setResizeableWindow(boolean resize,
int minWidth,
int minHeight,
int maxWidth,
int maxHeight)
setResizeableWindow in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>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.public void enqueueDocumentOutput(DocumentOutput docOutput)
Before the supplied print output is inserted into the storage, the method removes all outputs
older than MAX_PRINT_OUTPUT_AGE. The actual age is calculated from the current time
stamp and the time stamp of the document output when enqueued.
enqueueDocumentOutput in interface DocumentOutputStoragedocOutput - The object that encapsulates the document output being enqueued.public DocumentOutput dequeueDocumentOutput(java.util.UUID uuid)
enqueueDocumentOutput(DocumentOutput).
and removes the returned entry from the storage iff the document outputs should not be cached.dequeueDocumentOutput in interface DocumentOutputStorageuuid - The document output uuid.null if the id doesn't represent
a previously enqueued print output.public void removeDocuments(java.util.Set<java.util.UUID> documents)
removeDocuments in interface DocumentOutputStoragedocuments - The given documents to removeprotected void postRepaint(GuiWebEmulatedWindow ews)
repaints queue. This will
be processed by the GuiWebDriver.RepaintThread.ews - The window requiring repaint.private void collectWidgets(Widget w, java.util.function.Predicate<Widget> filter, java.util.function.Consumer<Widget> actionsCollector)
w - The parent widget.filter - The condition predicate that must be evaluated for collected widgets.actionsCollector - Collects a widget's action if the target is selected by the filter condition.private static boolean isInsideVisibleFrameOrStandalone(Widget wid)
wid - Widget to check.TRUE if the widget is inside visible frame or standalone,
FALSE otherwise.public void setCurrentSelection(java.lang.String txt)
setCurrentSelection in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>txt - The current editors selection.public MousePtrWrapper createMousePointer(java.io.InputStream data, java.lang.String ptrName)
createMousePointer in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>data - cursor dataptrName - pointer namenullpublic void setCursor(MousePtrWrapper ptr)
public void setGlobalCursor(MousePtrWrapper ptr)
setGlobalCursor in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>ptr - Wrapper for the cursor.public void removeGlobalCursor()
removeGlobalCursor in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public MousePtrWrapper getGlobalCursor()
getGlobalCursor in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public void setCursor(java.lang.String icon)
public void lockMousePointer(int widgetId,
MousePtrWrapper ptr)
lockMousePointer in interface ScreenDriver<GuiOutputManager>widgetId - the id of the active DropDown which caused the pointer lock or -1ptr - the locked mouse pointer or null for unlockpublic void propagate(int windowId,
int wid,
MousePtrWrapper ptr)
propagate in interface ScreenDriver<GuiOutputManager>windowId - to level window idwid - widgetIdptr - mouse pointerpublic boolean isFontInstalled(java.lang.String fontName,
boolean boldFont)
isFontInstalled in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>fontName - The target font name.boldFont - Indicates that the bold font is queried.public void enableEvents(int[] windowIds,
boolean capture)
enableEvents in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>enableEvents in class AbstractGuiDriver<java.lang.Integer>windowIds - The window IDs which need to be processed.capture - Flag indicating OS level events are captured (when true).public NativeDimension getVirtualScreenSize()
getVirtualScreenSize in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public boolean isWindowDecorationSupported()
isWindowDecorationSupported in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public boolean isEmbeddedClient()
isEmbeddedClient in interface ScreenDriver<GuiOutputManager>isEmbeddedClient in interface EmbeddedClientpublic NativePoint getMousePosition()
getMousePosition in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>nullpublic int[] getTextWidths(java.lang.String text,
FontDetails<java.lang.Integer> fd)
getTextWidths in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>getTextWidths in class AbstractGuiDriver<java.lang.Integer>text - The text.fd - The font details used to draw and measure the text.public int getClientTextWidth(java.lang.String text,
FontDetails<java.lang.Integer> fd)
getClientTextWidth in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>text - The text.fd - The font used to draw and measure the text.public int getClientFontHeight(FontDetails<java.lang.Integer> fd)
getClientFontHeight in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>fd - The used font.public int getTextWidth(java.lang.String text,
FontDetails<java.lang.Integer> fd)
getTextWidth in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>getTextWidth in class AbstractGuiDriver<java.lang.Integer>text - The text.fd - The font details used to draw and measure the text.public void setGuiFont(FontDetails<java.lang.Integer> font)
setGuiFont in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>setGuiFont in class AbstractGuiDriver<java.lang.Integer>font - Drawing font.public void drawString(java.lang.String text,
int x,
int y)
drawString in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>drawString in class AbstractGuiDriver<java.lang.Integer>text - text string to draw.x - left position.y - top position.public void drawStringCentered(java.lang.String text,
int x,
int height)
drawStringCentered in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>drawStringCentered in class AbstractGuiDriver<java.lang.Integer>text - text string to draw.x - left position.height - the height to center on.public void drawCursor(LightweightTextWidget widget)
drawCursor in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>drawCursor in class AbstractGuiDriver<java.lang.Integer>widget - The text widgetpublic void doTextShift(java.lang.String text,
int widthHint)
doTextShift in class AbstractGuiDriver<java.lang.Integer>text - The text widgetwidthHint - The text hint widthpublic void fillRectAroundText(int x,
int y,
int textWidthHint,
int textHeightHint,
java.lang.String text)
fillRectAroundText in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>fillRectAroundText in class AbstractGuiDriver<java.lang.Integer>x - The text left positiony - The text top positiontextWidthHint - The text hint widthtextHeightHint - The text hint heighttext - The given textpublic void deliverDocumentOutput(java.util.function.Consumer<java.io.OutputStream> consumer,
java.lang.Runnable finalizer,
MediaType format,
java.lang.String uuid,
boolean promptUser)
This implementation stores the provided consumer with
enqueueDocumentOutput(DocumentOutput) and notifies the JavaScript part
to download the document output. The document output is identified with a random UUID
generated by this method.
deliverDocumentOutput in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>consumer - Output consumer, must not be null. See above.finalizer - Finalizer callback, may be null. See above.format - Report 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.public void openMimeResource(boolean deleteContent,
java.lang.String mimeType,
java.lang.String uriString,
boolean embedded)
throws java.net.URISyntaxException
openMimeResource in interface ScreenDriver<GuiOutputManager>deleteContent - Indicates if the source content will be deleted after the document is loaded by
the client.mimeType - The resource mime type.uriString - The string presentation of the target resource.embedded - The document is embedded in the template document.java.net.URISyntaxException - If this string presentation of the target resource is not formatted strictly
according to to RFC2396 and cannot be converted to a URI.java.lang.RuntimeException - For other IO errors during file operations.public void openMimeResource(java.lang.String mimeType,
java.lang.String resourcePath,
ScreenDriver.UriPathAnchor uriPathAnchor)
openMimeResource in interface ScreenDriver<GuiOutputManager>mimeType - The resource mime type.resourcePath - The relative path to the target resource.uriPathAnchor - Instructs how to resolve the given resource path.DocumentOutput resolveResource(boolean deleteContent, java.lang.String mimeType, ContentDisposition contentDisposition, java.io.File originalFile)
deleteContent - Indicates if the original file will be deleted after its content loaded by
the client.mimeType - The mime type of the original file contentcontentDisposition - The value of content-disposition http headeroriginalFile - The original file to be loaded by the clientDocumentOutput resolveResource(boolean deleteContent, java.lang.String mimeType, ContentDisposition contentDisposition, java.io.File originalFile, java.util.function.BiConsumer<java.io.File,java.io.File> customCopy, boolean cached)
deleteContent - Indicates if the original file will be deleted after its content loaded by
the client.mimeType - The mime type of the original file contentcontentDisposition - The value of content-disposition http headeroriginalFile - The original file to be loaded by the clientcustomCopy - Do a custom copy process. If this is null, a simple byte-base copy is done.cached - Indicating that the document should be cachedpublic void addMessageListener(MsgBlasterPeer listener, int windowId, int widgetId)
addMessageListener in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>listener - The listener to be added.windowId - The windows id.widgetId - The widget's id.public void removeMessageListener(MsgBlasterPeer listener, int windowId, int widgetId)
removeMessageListener in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>listener - The listener to be removed.windowId - The windows id.widgetId - The widget's id.public void lowLevelEvent(int widgetId,
int winId,
int messageId,
int p1,
int p2,
int p3)
lowLevelEvent in interface ClientProtocolHookswidgetId - The id of the widget that generated the event.winId - The id of the parent window.messageId - The id of the event.p1 - The first parameter of the event.p2 - The first parameter of the event.p3 - The first parameter of the event.public void lowLevelMouseEvent(java.awt.event.MouseEvent evt,
MouseOps mop,
int windowId)
evt - The mouse event to send.mop - The mouse operation type.windowId - The ID of the target window.public void notifyWait()
notifyWait in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public void setNeedsNotificationOnWait(boolean newState)
setNeedsNotificationOnWait in interface ClientProtocolHooksnewState - true turns ON the notification while false turns it OFF.public void cacheTextMetrics(java.util.Map<FontDetails<java.lang.Integer>,java.util.Set<java.lang.String>> texts, java.lang.Integer windowId)
cacheTextMetrics in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>cacheTextMetrics in class AbstractGuiDriver<java.lang.Integer>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<java.lang.Integer,java.awt.image.BufferedImage>needsExplicitTextMetricsCaching in class AbstractGuiDriver<java.lang.Integer>private static java.lang.String writeLauncherWrapper(java.lang.String uriString)
uriString - The target resource.private static java.lang.String mimeType(java.lang.String icon)
icon - Image file namenull if not.private void syncDesktopDimensions()
updateDesktopDimensions(int, int) with the result.private void updateDesktopDimensions(int width,
int height)
width - New desktop width.height - New desktop height.public 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.getBasicWebPalette in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>public void createWidget(java.lang.String type,
int widgetId)
createWidget in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>type - The widget type, one of the LegacyResource widget names.widgetId - The widget ID to be set.public <T extends DriverWidget> void createWidget(java.lang.Class<T> widgetClass, int widgetId)
createWidget in interface GuiDriver<java.lang.Integer,java.awt.image.BufferedImage>widgetClass - The widget class.widgetId - The widget ID to be set.public boolean isWeb()
true.isWeb in interface ScreenDriver<GuiOutputManager>public ChooseFileResult chooseFiles(java.lang.String title, boolean multiple, boolean upload, java.lang.String uploadDir, java.lang.String[] filters)
chooseFiles in interface ScreenDriver<GuiOutputManager>title - Upload title.multiple - true to allow upload or selection of multiple files.upload - When true the selected files will be uploaded to the web server, when false
only the selected file names will be returned.uploadDir - The directory on the web server the files will be uploaded to.filters - Defines the file types the file input should accept. The first element denotes a filter name
and the next element defines a file specification expression.ChooseFileResult instance.