Package com.pnfsoftware.jeb.client.api
Class GraphDialogExtensions
java.lang.Object
com.pnfsoftware.jeb.client.api.GraphDialogExtensions
Optional extension used to customize and provide action handlers for
graph
dialogs
. Custom implementations should override the methods they need.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Edge styles for rendering.static enum
Graph rendering mode.static enum
Vertex shape for rendering. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSpecify how edge orientations should be rendered (as arrows), as well as their position on the edge.int
Provide a custom maximum node density (per pixels) used by the high-score-only rendering mode(s).getDescription
(int vertexId) This method is called when additional information for a node (not held in the graph definition) is requested by the client.int
getEdgeColor
(int vertexId0, int vertexId1) Determine the color of a directed edge for rendering.getEdgeStyle
(int vertexId0, int vertexId1) Determine the style of an edge for rendering.Provide the layout mode.boolean
getShowVertex
(int vertexId) When in a filtered mode, this method is called to determine whether a vertex should be shown.UnitAddress<?>
getUnitAddress
(int vertexId) This method is called when client code requests a navigation action on a node.int
getVertexColor
(int vertexId) Determine the base color of a vertex for rendering.boolean
getVertexMark
(int vertexId) Determine if the provided vertex is marked.getVertexShape
(int vertexId) Determine the shape of a vertex for rendering.boolean
processNewVertexName
(int vertexId, String newName) This method is called when a vertex is about to be renamed.boolean
processVertexMark
(int vertexId, boolean marking) This method is called when the graph controller requests to mark or unmark a node.
-
Constructor Details
-
GraphDialogExtensions
public GraphDialogExtensions()
-
-
Method Details
-
getLayoutMode
Provide the layout mode.The default implementation returns null.
- Returns:
- a mode; null to indicate a default mode
-
processNewVertexName
This method is called when a vertex is about to be renamed. The implementation can reject or accept the name, and act accordingly, e.g. by modifying underlying model data.The default implementation returns true.
- Parameters:
vertexId
- node idnewName
- new name- Returns:
- true to accept the new name; false to reject it
-
getUnitAddress
This method is called when client code requests a navigation action on a node. The implementation can return a unit+address couple that clients will then attempt to navigate to.The default implementation returns null.
- Parameters:
vertexId
- node id- Returns:
- a unit address
-
getDescription
This method is called when additional information for a node (not held in the graph definition) is requested by the client. E.g. the GUI client displays that information in tooltip widgets displayed when hovering over a node.)The default implementation returns null.
- Parameters:
vertexId
- node id- Returns:
- a description
-
getEdgeColor
public int getEdgeColor(int vertexId0, int vertexId1) Determine the color of a directed edge for rendering.The default implementation returns -1.
- Parameters:
vertexId0
- source nodevertexId1
- destination node- Returns:
- -1 to use defaults; else, an RGB value specifying the edge color, e.g. 0xFF0000 for red
-
getEdgeStyle
Determine the style of an edge for rendering.The default implementation returns null.
- Parameters:
vertexId0
- source nodevertexId1
- destination node- Returns:
- null to use defaults; else, an edge style
-
getVertexColor
public int getVertexColor(int vertexId) Determine the base color of a vertex for rendering.The default implementation returns -1.
- Parameters:
vertexId
- an optional vertex id; -1 means any vertex- Returns:
- -1 to use defaults; else, an RGB value specifying the node color, e.g. 0xFF0000 for red
-
getVertexShape
Determine the shape of a vertex for rendering.The default implementation returns null.
- Parameters:
vertexId
- an optional vertex id; -1 means any vertex- Returns:
- null to use defaults; else, a shape enum
-
getVertexMark
public boolean getVertexMark(int vertexId) Determine if the provided vertex is marked. A 'mark' is a boolean flag which value can be toggled via the context menu on a node. Note that the mark is not be stored on the graph itself. It should be stored on the model. SeeprocessVertexMark(int, boolean)
.The default implementation returns false.
- Parameters:
vertexId
- a vertex id- Returns:
- false if the mark is not set or if marks are not supported; true if the node is marked
-
processVertexMark
public boolean processVertexMark(int vertexId, boolean marking) This method is called when the graph controller requests to mark or unmark a node. The implementation can reject or accept the name, and should act accordingly, e.g. by modifying underlying model data.The default implementation returns false.
- Parameters:
vertexId
- node idmarking
- new mark value- Returns:
- true to accept the new mark value; false to reject it
-
getShowVertex
public boolean getShowVertex(int vertexId) When in a filtered mode, this method is called to determine whether a vertex should be shown. (This method is only called in a filtered mode.)The default implementation returns true.
- Parameters:
vertexId
- node id- Returns:
- determine whether the vertex should be shown (in any of the filtered modes)
-
getCanvasNodeDensity
public int getCanvasNodeDensity()Provide a custom maximum node density (per pixels) used by the high-score-only rendering mode(s).The default implementation returns -1.
- Returns:
- a density, strictly greater than 0; any other value will mean to ue the default density
-
displayEdgesOrientation
Specify how edge orientations should be rendered (as arrows), as well as their position on the edge.The default implementation returns null (i.e., use the defaults, currently set to 50: an arrow will be positioned right in the middle of its edge).
- Returns:
- null to use the defaults; -1 to disable orientation rendering; else, a value between 0 and 100 indicating how close to the destination vertex the arrow should be positioned (the 50-80 range generates pleasant rendering)
-