public class SGMXBeanImpl extends java.lang.Object implements SGMXBean, MXNodeAlgorithm
SGMXBean
interface.Modifier and Type | Field and Description |
---|---|
private JSONDocument[] |
jsceneGraphs |
private JSONDocument |
jwindows |
private java.util.Map<java.lang.Integer,Node> |
nodeMap |
private boolean |
paused |
private java.util.List<MediaPlayer> |
playersToResume |
private java.util.Map<Scene,java.awt.image.BufferedImage> |
scene2Image |
private static java.lang.String |
SGMX_CALL_GETSGTREE_FIRST |
private static java.lang.String |
SGMX_NOT_PAUSED_TEXT |
private java.util.Map<java.lang.Integer,Window> |
windowMap |
Constructor and Description |
---|
SGMXBeanImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addHighlightedNode(int nodeId)
Adds the node with the nodeId to the list of nodes that are to be
highlighted in the scene.
|
void |
addHighlightedRegion(int windowId,
double x,
double y,
double w,
double h)
Adds the specified region to the list of regions to be highlighted
in the scene.
|
private void |
clearNodeMap() |
private void |
clearScene2Image() |
private void |
clearWindowMap() |
private HighlightRegion |
createHighlightRegion(int nodeId) |
private JSONDocument |
createJSONDocument(Node n,
MXNodeAlgorithmContext ctx) |
java.lang.String |
getBounds(int nodeId)
Retrieves the bounds information about the particular node.
|
java.lang.String |
getCSSInfo(int nodeId)
Retrieves the CSS information about the particular node.
|
private Node |
getNode(int nodeId) |
private Scene |
getScene(int windowId) |
private java.lang.String |
getScreenShotPath(Scene scene,
double x,
double y,
double w,
double h) |
java.lang.String |
getSGTree(int windowId)
Returns the Scene-graph hierarchy in a simple tree-like model for
given window.
|
java.lang.String |
getWindows()
Returns the list of JavaFX windows.
|
private void |
importSGTree(Node sgRoot,
int windowId) |
private void |
importWindows() |
private void |
importWindowsIfNeeded() |
java.lang.String |
makeScreenShot(int nodeId)
Makes a screen-shot of the selected node in the scene's coordinates
and stores it into a temporary file in the PNG format.
|
java.lang.String |
makeScreenShot(int windowId,
double x,
double y,
double w,
double h)
Makes a screen-shot of the specified region in the scene's coordinates
and stores it into a temporary file in the PNG format.
|
void |
pause()
Pauses the Scene-graph which means it pause all animations, media players, etc.
|
private void |
pauseMedia() |
java.lang.Object |
processContainerNode(Parent parent,
MXNodeAlgorithmContext ctx)
|
private static void |
processCssMetaData(CssMetaData sp,
Node node,
JSONDocument d) |
java.lang.Object |
processLeafNode(Node node,
MXNodeAlgorithmContext ctx)
Method for processing leaf nodes.
|
private void |
releaseAllStateObject() |
void |
removeHighlightedNode(int nodeId)
Removes the nodeId node from the list of nodes that are to be
highlighted in the scene.
|
void |
removeHighlightedRegion(int windowId,
double x,
double y,
double w,
double h)
Removes the specified region from the list of regions to be highlighted
in the scene.
|
void |
resume()
Resumes the previously paused Scene-graph into the normal operation.
|
private void |
resumeMedia() |
void |
step()
Produces single JavaFX pulse and pauses the Scene-graph again.
|
private static java.lang.String |
upcaseFirstLetter(java.lang.String s) |
private static final java.lang.String SGMX_NOT_PAUSED_TEXT
private static final java.lang.String SGMX_CALL_GETSGTREE_FIRST
private boolean paused
private java.util.Map<java.lang.Integer,Window> windowMap
private JSONDocument jwindows
private java.util.Map<java.lang.Integer,Node> nodeMap
private JSONDocument[] jsceneGraphs
private java.util.Map<Scene,java.awt.image.BufferedImage> scene2Image
private java.util.List<MediaPlayer> playersToResume
public void pause()
SGMXBean.resume()
.
If the Scene-graph is already "PAUSED" then this method has no effect.public void resume()
public void step() throws java.lang.IllegalStateException
SGMXBean.pause()
method)
prior to calling this function otherwise the IllegalStateException
is thrown.public java.lang.String getWindows() throws java.lang.IllegalStateException
SGMXBean.getSGTree(int)
method.
The SGMXBean.pause()
method should be called prior to calling this method.
Otherwise the IllegalStateException
is thrown.
The result is in the format of JSON string.getWindows
in interface SGMXBean
java.lang.IllegalStateException
- when Scene-graph is not "PAUSED"public java.lang.String getSGTree(int windowId) throws java.lang.IllegalStateException
SGMXBean.getCSSInfo(int)
.
The SGMXBean.pause()
method should be called prior to calling this method.
Otherwise the IllegalStateException
is thrown.
The result is in the format of JSON string.getSGTree
in interface SGMXBean
windowId
- unique window identifier obtained by SGMXBean.getWindows()
java.lang.IllegalStateException
- when Scene-graph is not "PAUSED"public void addHighlightedNode(int nodeId) throws java.lang.IllegalStateException
SGMXBean.getSGTree(int)
method.addHighlightedNode
in interface SGMXBean
nodeId
- the id of the node to be highlightedjava.lang.IllegalStateException
- when Scene-graph is not "PAUSED"public void removeHighlightedNode(int nodeId) throws java.lang.IllegalStateException
SGMXBean.getSGTree(int)
method.removeHighlightedNode
in interface SGMXBean
nodeId
- the id of the node to be removedjava.lang.IllegalStateException
- when Scene-graph is not "PAUSED"public void addHighlightedRegion(int windowId, double x, double y, double w, double h) throws java.lang.IllegalStateException
SGMXBean.getWindows()
method.addHighlightedRegion
in interface SGMXBean
windowId
- unique window identifier obtained by SGMXBean.getWindows()
x
- x coordinate of the regiony
- y coordinate of the regionw
- width of the regionh
- height of the regionjava.lang.IllegalStateException
- when Scene-graph is not "PAUSED"public void removeHighlightedRegion(int windowId, double x, double y, double w, double h) throws java.lang.IllegalStateException
SGMXBean.getWindows()
method.removeHighlightedRegion
in interface SGMXBean
windowId
- unique window identifier obtained by SGMXBean.getWindows()
x
- x coordinate of the regiony
- y coordinate of the regionw
- width of the regionh
- height of the regionjava.lang.IllegalStateException
- when Scene-graph is not "PAUSED"private Node getNode(int nodeId)
private Scene getScene(int windowId)
private HighlightRegion createHighlightRegion(int nodeId)
public java.lang.String makeScreenShot(int nodeId) throws java.lang.IllegalStateException
SGMXBean.pause()
method should be called prior to calling this method.
Otherwise the IllegalStateException
is thrown.makeScreenShot
in interface SGMXBean
nodeId
- node identifier obtained by SGMXBean.getSGTree(int)
java.lang.IllegalStateException
- when Scene-graph is not "PAUSED"public java.lang.String makeScreenShot(int windowId, double x, double y, double w, double h) throws java.lang.IllegalStateException
SGMXBean.pause()
method should be called prior to calling this method.
Otherwise the IllegalStateException
is thrown.makeScreenShot
in interface SGMXBean
windowId
- unique window identifier obtained by SGMXBean.getWindows()
x
- x coordinate of the regiony
- y coordinate of the regionw
- width of the regionh
- height of the regionjava.lang.IllegalStateException
- when Scene-graph is not "PAUSED"private java.lang.String getScreenShotPath(Scene scene, double x, double y, double w, double h)
private void releaseAllStateObject()
private void clearWindowMap()
private void clearNodeMap()
private void clearScene2Image()
private void importWindowsIfNeeded()
private void importWindows()
private void importSGTree(Node sgRoot, int windowId)
public java.lang.String getCSSInfo(int nodeId) throws java.lang.IllegalStateException
SGMXBean.pause()
method should be called prior to calling this method.
Otherwise the IllegalStateException
is thrown.getCSSInfo
in interface SGMXBean
nodeId
- node identifier obtained by SGMXBean.getSGTree(int)
java.lang.IllegalStateException
- when Scene-graph is not "PAUSED"private static void processCssMetaData(CssMetaData sp, Node node, JSONDocument d)
private static java.lang.String upcaseFirstLetter(java.lang.String s)
public java.lang.String getBounds(int nodeId) throws java.lang.IllegalStateException
getBounds
in interface SGMXBean
nodeId
- node identifier obtained by SGMXBean.getSGTree(int)
java.lang.IllegalStateException
- when Scene-graph is not "PAUSED"public java.lang.Object processLeafNode(Node node, MXNodeAlgorithmContext ctx)
processLeafNode
in interface MXNodeAlgorithm
node
- node to be processedctx
- current contextpublic java.lang.Object processContainerNode(Parent parent, MXNodeAlgorithmContext ctx)
processContainerNode
in interface MXNodeAlgorithm
parent
- container node to be processedctx
- current contextprivate JSONDocument createJSONDocument(Node n, MXNodeAlgorithmContext ctx)
private void pauseMedia()
private void resumeMedia()