Package ghidra.service.graph
Interface GraphDisplay
public interface GraphDisplay
Interface for objects that display (or consume) graphs. Normally, a graph display represents
a visual component for displaying and interacting with a graph. Some implementation may not
be a visual component, but instead consumes/processes the graph (i.e. graph exporter). In this
case, there is no interactive element and once the graph has been set on the display, it is
closed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final String
true or false may have no meaning for a different graph visualization librarystatic final String
a comma-separated list of edge type names in priority orderstatic final String
true or false, whether edge selection via a mouse click is enabled.static final String
a comma-separated list of edge type names.static final String
values are defined as String symbols in LayoutFunction class KAMADA_KAWAI,FRUCTERMAN_REINGOLD,CIRCLE_MINCROSS,TIDIER_TREE,TIDIER_RADIAL_TREE, MIN_CROSS_TOP_DOWN,MIN_CROSS_LONGEST_PATH,MIN_CROSS_NETWORK_SIMPLEX,MIN_CROSS_COFFMAN_GRAHAM, EXP_MIN_CROSS_TOP_DOWN,EXP_MIN_CROSS_LONGEST_PATH,EXP_MIN_CROSS_NETWORK_SIMPLEX, EXP_MIN_CROSS_COFFMAN_GRAHAM,TREE,RADIAL,BALLOON,GEM may have no meaning for a different graph visualization librarystatic final String
values are color names or rgb in hex '0xFF0000' is redstatic final String
values are color names or rgb in hex '0xFF0000' is redstatic final String
values are the strings N,NE,E,SE,S,SW,W,NW,AUTO,CNTR may have no meaning for a different graph visualization library -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAction
(DockingActionIf action) Adds the action to the graph display.void
clear()
Clears all graph vertices and edges from this graph displayvoid
close()
Closes this graph display window.Returns the currently focused vertex or null if no vertex is focusedgetGraph()
Returns the graph for this displayReturns the title of the current graphReturns a set of vertex ids for all the currently selected verticesvoid
selectVertices
(Set<AttributedVertex> vertexSet, EventTrigger eventTrigger) Tells the graph display window to select the vertices with the given idsvoid
setFocusedVertex
(AttributedVertex vertex, EventTrigger eventTrigger) Tells the graph display window to focus the vertex with the given idvoid
setGraph
(AttributedGraph graph, GraphDisplayOptions options, String title, boolean append, TaskMonitor monitor) Sets the graph to be displayed or consumed by this graph displaydefault void
setGraph
(AttributedGraph graph, String title, boolean append, TaskMonitor monitor) Deprecated.void
setGraphDisplayListener
(GraphDisplayListener listener) Sets aGraphDisplayListener
to be notified when the user changes the vertex focus or selects one or more nodes in a graph windowvoid
updateVertexName
(AttributedVertex vertex, String newName) Updates a vertex to a new name
-
Field Details
-
ALIGN_LEFT
static final int ALIGN_LEFT- See Also:
-
ALIGN_CENTER
static final int ALIGN_CENTER- See Also:
-
ALIGN_RIGHT
static final int ALIGN_RIGHT- See Also:
-
SELECTED_VERTEX_COLOR
values are color names or rgb in hex '0xFF0000' is red- See Also:
-
SELECTED_EDGE_COLOR
values are color names or rgb in hex '0xFF0000' is red- See Also:
-
INITIAL_LAYOUT_ALGORITHM
values are defined as String symbols in LayoutFunction class KAMADA_KAWAI,FRUCTERMAN_REINGOLD,CIRCLE_MINCROSS,TIDIER_TREE,TIDIER_RADIAL_TREE, MIN_CROSS_TOP_DOWN,MIN_CROSS_LONGEST_PATH,MIN_CROSS_NETWORK_SIMPLEX,MIN_CROSS_COFFMAN_GRAHAM, EXP_MIN_CROSS_TOP_DOWN,EXP_MIN_CROSS_LONGEST_PATH,EXP_MIN_CROSS_NETWORK_SIMPLEX, EXP_MIN_CROSS_COFFMAN_GRAHAM,TREE,RADIAL,BALLOON,GEM may have no meaning for a different graph visualization library- See Also:
-
DISPLAY_VERTICES_AS_ICONS
true or false may have no meaning for a different graph visualization library- See Also:
-
VERTEX_LABEL_POSITION
values are the strings N,NE,E,SE,S,SW,W,NW,AUTO,CNTR may have no meaning for a different graph visualization library- See Also:
-
ENABLE_EDGE_SELECTION
true or false, whether edge selection via a mouse click is enabled. May not be supported by another graph visualization library- See Also:
-
EDGE_TYPE_PRIORITY_LIST
a comma-separated list of edge type names in priority order- See Also:
-
FAVORED_EDGES
a comma-separated list of edge type names. any will be considered a favored edge for the min-cross layout algorithms. May have no meaning with a different graph visualization library- See Also:
-
-
Method Details
-
setGraphDisplayListener
Sets aGraphDisplayListener
to be notified when the user changes the vertex focus or selects one or more nodes in a graph window- Parameters:
listener
- the listener to be notified
-
setFocusedVertex
Tells the graph display window to focus the vertex with the given id- Parameters:
vertex
- the vertex to focuseventTrigger
- Provides a hint to the GraphDisplay as to why we are updating the graph location so that the GraphDisplay can decide if it should send out a notification via theGraphDisplayListener.locationFocusChanged(AttributedVertex)
. For example, if we are updating the the location due to an event from the main application, we don't want to notify the application the graph changed to avoid event cycles. SeeEventTrigger
for more information.
-
getGraph
AttributedGraph getGraph()Returns the graph for this display- Returns:
- the graph for this display
-
getFocusedVertex
AttributedVertex getFocusedVertex()Returns the currently focused vertex or null if no vertex is focused- Returns:
- the currently focused vertex or null if no vertex is focused
-
selectVertices
Tells the graph display window to select the vertices with the given ids- Parameters:
vertexSet
- the set of vertices to selecteventTrigger
- Provides a hint to the GraphDisplay as to why we are updating the graph location so that the GraphDisplay can decide if it should send out a notification via theGraphDisplayListener.selectionChanged(Set)
. For example, if we are updating the the location due to an event from the main application, we don't want to notify the application the graph changed to avoid event cycles. SeeEventTrigger
for more information.
-
getSelectedVertices
Set<AttributedVertex> getSelectedVertices()Returns a set of vertex ids for all the currently selected vertices- Returns:
- a set of vertex ids for all the currently selected vertices
-
close
void close()Closes this graph display window. -
setGraph
default void setGraph(AttributedGraph graph, String title, boolean append, TaskMonitor monitor) throws CancelledException Deprecated.You should now use the form that takes in aGraphDisplayOptions
Sets the graph to be displayed or consumed by this graph display- Parameters:
graph
- the graph to display or consumetitle
- a title for the graphmonitor
- aTaskMonitor
which can be used to cancel the graphing operationappend
- if true, append the new graph to any existing graph- Throws:
CancelledException
- thrown if the graphing operation was cancelled
-
setGraph
void setGraph(AttributedGraph graph, GraphDisplayOptions options, String title, boolean append, TaskMonitor monitor) throws CancelledException Sets the graph to be displayed or consumed by this graph display- Parameters:
graph
- the graph to display or consumeoptions
-GraphDisplayOptions
for configuring how the display will render vertices and edges based on there vertex type and edge type respectively.title
- a title for the graphmonitor
- aTaskMonitor
which can be used to cancel the graphing operationappend
- if true, append the new graph to any existing graph- Throws:
CancelledException
- thrown if the graphing operation was cancelled
-
clear
void clear()Clears all graph vertices and edges from this graph display -
updateVertexName
Updates a vertex to a new name- Parameters:
vertex
- the vertex to renamenewName
- the new name for the vertex
-
getGraphTitle
String getGraphTitle()Returns the title of the current graph- Returns:
- the title of the current graph
-
addAction
Adds the action to the graph display. Not all GraphDisplays support adding custom actions, so this may have no effect.- Parameters:
action
- the action to add
-
GraphDisplayOptions