Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.hubspot.chrome.devtools.client.core.overlay.Overlay Maven / Gradle / Ivy
package com.hubspot.chrome.devtools.client.core.overlay;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hubspot.chrome.devtools.base.ChromeRequest;
import com.hubspot.chrome.devtools.base.ChromeSessionCore;
import com.hubspot.chrome.devtools.client.core.dom.BackendNodeId;
import com.hubspot.chrome.devtools.client.core.dom.NodeId;
import com.hubspot.chrome.devtools.client.core.dom.Quad;
import com.hubspot.chrome.devtools.client.core.dom.RGBA;
import com.hubspot.chrome.devtools.client.core.page.FrameId;
import com.hubspot.chrome.devtools.client.core.runtime.RemoteObjectId;
import java.util.concurrent.CompletableFuture;
/**
* This domain provides various functionality related to drawing atop the inspected page.
*/
public final class Overlay {
ChromeSessionCore chromeSession;
ObjectMapper objectMapper;
public Overlay(ChromeSessionCore chromeSession, ObjectMapper objectMapper) {
this.chromeSession = chromeSession;
this.objectMapper = objectMapper;
}
/**
* Disables domain notifications.
*/
public void disable() {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.disable");
chromeSession.send(chromeRequest);
}
/**
* Disables domain notifications.
*/
public void disableAsync() {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.disable");
chromeSession.sendAsync(chromeRequest);
}
/**
* Enables domain notifications.
*/
public void enable() {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.enable");
chromeSession.send(chromeRequest);
}
/**
* Enables domain notifications.
*/
public void enableAsync() {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.enable");
chromeSession.sendAsync(chromeRequest);
}
/**
* For testing.
*
* @param nodeId Id of the node to get highlight object for.
*/
public Object getHighlightObjectForTest(NodeId nodeId) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.getHighlightObjectForTest");
chromeRequest
.putParams("nodeId", nodeId);
return chromeSession.send(chromeRequest, new TypeReference(){});
}
/**
* For testing.
*
* @param nodeId Id of the node to get highlight object for.
*/
public CompletableFuture getHighlightObjectForTestAsync(NodeId nodeId) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.getHighlightObjectForTest");
chromeRequest
.putParams("nodeId", nodeId);
return chromeSession.sendAsync(chromeRequest, new TypeReference(){});
}
/**
* Hides any highlight.
*/
public void hideHighlight() {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.hideHighlight");
chromeSession.send(chromeRequest);
}
/**
* Hides any highlight.
*/
public void hideHighlightAsync() {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.hideHighlight");
chromeSession.sendAsync(chromeRequest);
}
/**
* Highlights owner element of the frame with given id.
*
* @param frameId Identifier of the frame to highlight.
* @param contentColor [Optional] The content box highlight fill color (default: transparent).
* @param contentOutlineColor [Optional] The content box highlight outline color (default: transparent).
*/
public void highlightFrame(FrameId frameId, RGBA contentColor, RGBA contentOutlineColor) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.highlightFrame");
chromeRequest
.putParams("frameId", frameId)
.putParams("contentColor", contentColor)
.putParams("contentOutlineColor", contentOutlineColor);
chromeSession.send(chromeRequest);
}
/**
* Highlights owner element of the frame with given id.
*
* @param frameId Identifier of the frame to highlight.
* @param contentColor [Optional] The content box highlight fill color (default: transparent).
* @param contentOutlineColor [Optional] The content box highlight outline color (default: transparent).
*/
public void highlightFrameAsync(FrameId frameId, RGBA contentColor, RGBA contentOutlineColor) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.highlightFrame");
chromeRequest
.putParams("frameId", frameId)
.putParams("contentColor", contentColor)
.putParams("contentOutlineColor", contentOutlineColor);
chromeSession.sendAsync(chromeRequest);
}
/**
* Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or
* objectId must be specified.
*
* @param highlightConfig A descriptor for the highlight appearance.
* @param nodeId [Optional] Identifier of the node to highlight.
* @param backendNodeId [Optional] Identifier of the backend node to highlight.
* @param objectId [Optional] JavaScript object id of the node to be highlighted.
*/
public void highlightNode(HighlightConfig highlightConfig, NodeId nodeId,
BackendNodeId backendNodeId, RemoteObjectId objectId) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.highlightNode");
chromeRequest
.putParams("highlightConfig", highlightConfig)
.putParams("nodeId", nodeId)
.putParams("backendNodeId", backendNodeId)
.putParams("objectId", objectId);
chromeSession.send(chromeRequest);
}
/**
* Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or
* objectId must be specified.
*
* @param highlightConfig A descriptor for the highlight appearance.
* @param nodeId [Optional] Identifier of the node to highlight.
* @param backendNodeId [Optional] Identifier of the backend node to highlight.
* @param objectId [Optional] JavaScript object id of the node to be highlighted.
*/
public void highlightNodeAsync(HighlightConfig highlightConfig, NodeId nodeId,
BackendNodeId backendNodeId, RemoteObjectId objectId) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.highlightNode");
chromeRequest
.putParams("highlightConfig", highlightConfig)
.putParams("nodeId", nodeId)
.putParams("backendNodeId", backendNodeId)
.putParams("objectId", objectId);
chromeSession.sendAsync(chromeRequest);
}
/**
* Highlights given quad. Coordinates are absolute with respect to the main frame viewport.
*
* @param quad Quad to highlight
* @param color [Optional] The highlight fill color (default: transparent).
* @param outlineColor [Optional] The highlight outline color (default: transparent).
*/
public void highlightQuad(Quad quad, RGBA color, RGBA outlineColor) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.highlightQuad");
chromeRequest
.putParams("quad", quad)
.putParams("color", color)
.putParams("outlineColor", outlineColor);
chromeSession.send(chromeRequest);
}
/**
* Highlights given quad. Coordinates are absolute with respect to the main frame viewport.
*
* @param quad Quad to highlight
* @param color [Optional] The highlight fill color (default: transparent).
* @param outlineColor [Optional] The highlight outline color (default: transparent).
*/
public void highlightQuadAsync(Quad quad, RGBA color, RGBA outlineColor) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.highlightQuad");
chromeRequest
.putParams("quad", quad)
.putParams("color", color)
.putParams("outlineColor", outlineColor);
chromeSession.sendAsync(chromeRequest);
}
/**
* Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
*
* @param x X coordinate
* @param y Y coordinate
* @param width Rectangle width
* @param height Rectangle height
* @param color [Optional] The highlight fill color (default: transparent).
* @param outlineColor [Optional] The highlight outline color (default: transparent).
*/
public void highlightRect(Integer x, Integer y, Integer width, Integer height, RGBA color,
RGBA outlineColor) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.highlightRect");
chromeRequest
.putParams("x", x)
.putParams("y", y)
.putParams("width", width)
.putParams("height", height)
.putParams("color", color)
.putParams("outlineColor", outlineColor);
chromeSession.send(chromeRequest);
}
/**
* Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
*
* @param x X coordinate
* @param y Y coordinate
* @param width Rectangle width
* @param height Rectangle height
* @param color [Optional] The highlight fill color (default: transparent).
* @param outlineColor [Optional] The highlight outline color (default: transparent).
*/
public void highlightRectAsync(Integer x, Integer y, Integer width, Integer height, RGBA color,
RGBA outlineColor) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.highlightRect");
chromeRequest
.putParams("x", x)
.putParams("y", y)
.putParams("width", width)
.putParams("height", height)
.putParams("color", color)
.putParams("outlineColor", outlineColor);
chromeSession.sendAsync(chromeRequest);
}
/**
* Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted.
* Backend then generates 'inspectNodeRequested' event upon element selection.
*
* @param mode Set an inspection mode.
* @param highlightConfig [Optional] A descriptor for the highlight appearance of hovered-over nodes. May be omitted if `enabled
* == false`.
*/
public void setInspectMode(InspectMode mode, HighlightConfig highlightConfig) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setInspectMode");
chromeRequest
.putParams("mode", mode)
.putParams("highlightConfig", highlightConfig);
chromeSession.send(chromeRequest);
}
/**
* Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted.
* Backend then generates 'inspectNodeRequested' event upon element selection.
*
* @param mode Set an inspection mode.
* @param highlightConfig [Optional] A descriptor for the highlight appearance of hovered-over nodes. May be omitted if `enabled
* == false`.
*/
public void setInspectModeAsync(InspectMode mode, HighlightConfig highlightConfig) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setInspectMode");
chromeRequest
.putParams("mode", mode)
.putParams("highlightConfig", highlightConfig);
chromeSession.sendAsync(chromeRequest);
}
public void setPausedInDebuggerMessage(String message) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setPausedInDebuggerMessage");
chromeRequest
.putParams("message", message);
chromeSession.send(chromeRequest);
}
public void setPausedInDebuggerMessageAsync(String message) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setPausedInDebuggerMessage");
chromeRequest
.putParams("message", message);
chromeSession.sendAsync(chromeRequest);
}
/**
* Requests that backend shows debug borders on layers
*
* @param show True for showing debug borders
*/
public void setShowDebugBorders(Boolean show) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowDebugBorders");
chromeRequest
.putParams("show", show);
chromeSession.send(chromeRequest);
}
/**
* Requests that backend shows debug borders on layers
*
* @param show True for showing debug borders
*/
public void setShowDebugBordersAsync(Boolean show) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowDebugBorders");
chromeRequest
.putParams("show", show);
chromeSession.sendAsync(chromeRequest);
}
/**
* Requests that backend shows the FPS counter
*
* @param show True for showing the FPS counter
*/
public void setShowFPSCounter(Boolean show) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowFPSCounter");
chromeRequest
.putParams("show", show);
chromeSession.send(chromeRequest);
}
/**
* Requests that backend shows the FPS counter
*
* @param show True for showing the FPS counter
*/
public void setShowFPSCounterAsync(Boolean show) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowFPSCounter");
chromeRequest
.putParams("show", show);
chromeSession.sendAsync(chromeRequest);
}
/**
* Requests that backend shows paint rectangles
*
* @param result True for showing paint rectangles
*/
public void setShowPaintRects(Boolean result) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowPaintRects");
chromeRequest
.putParams("result", result);
chromeSession.send(chromeRequest);
}
/**
* Requests that backend shows paint rectangles
*
* @param result True for showing paint rectangles
*/
public void setShowPaintRectsAsync(Boolean result) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowPaintRects");
chromeRequest
.putParams("result", result);
chromeSession.sendAsync(chromeRequest);
}
/**
* Requests that backend shows scroll bottleneck rects
*
* @param show True for showing scroll bottleneck rects
*/
public void setShowScrollBottleneckRects(Boolean show) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowScrollBottleneckRects");
chromeRequest
.putParams("show", show);
chromeSession.send(chromeRequest);
}
/**
* Requests that backend shows scroll bottleneck rects
*
* @param show True for showing scroll bottleneck rects
*/
public void setShowScrollBottleneckRectsAsync(Boolean show) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowScrollBottleneckRects");
chromeRequest
.putParams("show", show);
chromeSession.sendAsync(chromeRequest);
}
/**
* Paints viewport size upon main frame resize.
*
* @param show Whether to paint size or not.
*/
public void setShowViewportSizeOnResize(Boolean show) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowViewportSizeOnResize");
chromeRequest
.putParams("show", show);
chromeSession.send(chromeRequest);
}
/**
* Paints viewport size upon main frame resize.
*
* @param show Whether to paint size or not.
*/
public void setShowViewportSizeOnResizeAsync(Boolean show) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setShowViewportSizeOnResize");
chromeRequest
.putParams("show", show);
chromeSession.sendAsync(chromeRequest);
}
public void setSuspended(Boolean suspended) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setSuspended");
chromeRequest
.putParams("suspended", suspended);
chromeSession.send(chromeRequest);
}
public void setSuspendedAsync(Boolean suspended) {
ChromeRequest chromeRequest = new ChromeRequest("Overlay.setSuspended");
chromeRequest
.putParams("suspended", suspended);
chromeSession.sendAsync(chromeRequest);
}
}