public abstract class

GraphDialogExtensions

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.client.api.GraphDialogExtensions

Class Overview

Optional extension used to customize and provide action handlers for graph dialogs. Custom implementations should override the methods they need.

Summary

Nested Classes
enum GraphDialogExtensions.EdgeStyle Edge styles for rendering. 
enum GraphDialogExtensions.LayoutMode Graph rendering mode. 
enum GraphDialogExtensions.VertexShape Vertex shape for rendering. 
Public Constructors
GraphDialogExtensions()
Public Methods
Integer displayEdgesOrientation()
Specify how edge orientations should be rendered (as arrows), as well as their position on the edge.
int getCanvasNodeDensity()
Provide a custom maximum node density (per pixels) used by the high-score-only rendering mode(s).
String 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.
GraphDialogExtensions.EdgeStyle getEdgeStyle(int vertexId0, int vertexId1)
Determine the style of an edge for rendering.
GraphDialogExtensions.LayoutMode getLayoutMode()
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.
GraphDialogExtensions.VertexShape 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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public GraphDialogExtensions ()

Public Methods

public Integer 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)

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

public String getDescription (int vertexId)

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

public int getEdgeColor (int vertexId0, int vertexId1)

Determine the color of a directed edge for rendering.

The default implementation returns -1.

Parameters
vertexId0 source node
vertexId1 destination node
Returns
  • -1 to use defaults; else, an RGB value specifying the edge color, e.g. 0xFF0000 for red

public GraphDialogExtensions.EdgeStyle getEdgeStyle (int vertexId0, int vertexId1)

Determine the style of an edge for rendering.

The default implementation returns null.

Parameters
vertexId0 source node
vertexId1 destination node
Returns
  • null to use defaults; else, an edge style

public GraphDialogExtensions.LayoutMode getLayoutMode ()

Provide the layout mode.

The default implementation returns null.

Returns
  • a mode; null to indicate a default mode

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)

public UnitAddress<?> getUnitAddress (int vertexId)

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

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

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. See processVertexMark(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

public GraphDialogExtensions.VertexShape getVertexShape (int vertexId)

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

public boolean processNewVertexName (int vertexId, String newName)

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 id
newName new name
Returns
  • true to accept the new name; false to reject it

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 id
marking new mark value
Returns
  • true to accept the new mark value; false to reject it