public class GuiWebEmulatedWindow extends EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
Modifier and Type | Field and Description |
---|---|
private BufferedImageDrawHelper |
drawHelper
Helper to generate image wrappers.
|
private boolean |
enabled
Locally cached sensitivity state flag.
|
private int |
height
Locally cached height (pixels).
|
private boolean |
initLocation
Flag indicating that the initial location should be initialized.
|
private java.lang.Object |
lock
Lock object for shared syncrhonization of the web socket.
|
private java.lang.String |
title
Locally cached title text.
|
private boolean |
visible
Locally cached visibility state flag.
|
private GuiWebDriver |
webdriver
Web driver instance.
|
private GuiWebSocket |
websock
Web-Socket which provides a GUI-specific protocol for communication with the browser.
|
private int |
width
Locally cached width (pixels).
|
private int |
x
Locally cached X coordinate (pixels).
|
private int |
y
Locally cached Y coordinate (pixels).
|
LOG, mouseHandler, windowId
Constructor and Description |
---|
GuiWebEmulatedWindow(java.lang.Object lock,
GuiWebSocket websock,
GuiWebDriver webdriver)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(PaintStructure<java.lang.Integer,java.awt.image.BufferedImage> ps)
Draw using a paint operation.
|
void |
drawOnScreenBitmap()
Update screen by iterating over the pool and render each pending operation.
|
void |
enableEvents(boolean capture)
Enable or Disable OS-level events for the specified windows.
|
private java.lang.Object[] |
encodeImage(PaintStructure<java.lang.Integer,java.awt.image.BufferedImage> ps)
Encodes the image if it isn't already loaded and returns the 3-elements array that holds
the image hash in its first element, the image encoding in its second element
and the encoded image or null in its third element depending on its loaded state.
|
void |
flush()
Render the given paint operation.
|
BufferedImageDrawHelper |
getBufferedImageDrawHelper()
Gets the instance of the helper to work with buffered images.
|
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.
|
FontMetricsHelper |
getFontMetrics(FontDetails<java.lang.Integer> f)
Get the metrics of the given font.
|
int |
getHeight()
Get the window height.
|
int |
getParagraphHeight(java.lang.String text,
FontDetails<java.lang.Integer> font,
int maxWidth)
The method performs a layout operation on the supplied text and
returns the resulting paragraph height while maintaining the
supplied maximum width.
|
int |
getTextHeight(java.lang.String text,
FontDetails<java.lang.Integer> f)
Get the height of the specified text, using the given font.
|
int |
getWidth()
Get the window width.
|
NativePoint |
getWindowLocation()
Get the window location on screen.
|
boolean |
isWindowVisible()
Check if the simulated window is visible.
|
protected java.lang.Object |
lock()
Obtain the lock object that can be used to synchronize drawing operations.
|
void |
quit()
Cause the outer frame to be disposed, as the window is being terminated.
|
void |
repaint()
Cause repaint processing to occur.
|
void |
setIconificationState(boolean iconify)
Manage any window state related to iconification.
|
void |
setWindowEnabled(boolean enable)
Set the window's sensitive state, depending on the
enable flag. |
void |
setWindowVisible(boolean visible)
Hide or show the window, depending on the
visible flag. |
deiconifyWindow, endBatch, getMouseHandler, getScreenBitmap, getWindowId, iconifyWindow, isIconified, offer, resizeWindow, screenHeight, screenWidth, setScreenBitmap, setWindowBounds, setWindowId, setWindowLocation
private final java.lang.Object lock
private GuiWebSocket websock
private GuiWebDriver webdriver
private boolean visible
private boolean enabled
private int x
private int y
private int height
private int width
private java.lang.String title
private final BufferedImageDrawHelper drawHelper
private boolean initLocation
public GuiWebEmulatedWindow(java.lang.Object lock, GuiWebSocket websock, GuiWebDriver webdriver)
lock
- Object to use for locking. By passing this in, the caller can share the
locking instance with this code. Use null
if an internal
lock object should be created.websock
- Web-Socket which provides a GUI-specific protocol for communication with the
browser.webdriver
- Web driver instance.public void quit()
quit
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public void repaint()
repaint
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public void drawOnScreenBitmap()
The API is made public to be used by the GuiWebDriver
's repaint thread.
drawOnScreenBitmap
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public void setWindowVisible(boolean visible)
visible
flag.setWindowVisible
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
visible
- The window visibility state.public void setWindowEnabled(boolean enable)
enable
flag.setWindowEnabled
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
enable
- The window sensitive state.public boolean isWindowVisible()
isWindowVisible
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public NativePoint getWindowLocation()
getWindowLocation
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public int getHeight()
getHeight
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public int getWidth()
getWidth
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public void setIconificationState(boolean iconify)
setIconificationState
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
iconify
- true
if this window is being iconified, false
for
de-iconified.public void enableEvents(boolean capture)
enableEvents
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
capture
- Flag indicating OS level events are captured (when true
).public FontMetricsHelper getFontMetrics(FontDetails<java.lang.Integer> f)
getFontMetrics
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
f
- The font for which the font metrics are to be obtained.public int getTextHeight(java.lang.String text, FontDetails<java.lang.Integer> f)
getTextHeight
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
text
- The text.f
- The font used to draw and measure the text.public int getParagraphHeight(java.lang.String text, FontDetails<java.lang.Integer> font, int maxWidth)
getParagraphHeight
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
text
- The text to measure.font
- The font to use during layout.maxWidth
- The maximum paragraph width.public void draw(PaintStructure<java.lang.Integer,java.awt.image.BufferedImage> ps)
draw
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
ps
- Paint operation parameters.private final java.lang.Object[] encodeImage(PaintStructure<java.lang.Integer,java.awt.image.BufferedImage> ps)
ps
- The paint structure filled with the target image parameters.public void flush()
flush
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public NativeRectangle getDisplayBounds()
getDisplayBounds
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public NativeRectangle getDisplayWorkArea()
getDisplayWorkArea
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
public BufferedImageDrawHelper getBufferedImageDrawHelper()
getBufferedImageDrawHelper
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>
protected java.lang.Object lock()
lock
in class EmulatedWindowState<java.lang.Integer,java.awt.image.BufferedImage>