Package ghidra.service.graph
Interface GraphDisplay
-
public interface GraphDisplayInterface 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
Fields Modifier and Type Field Description static intALIGN_CENTERstatic intALIGN_LEFTstatic intALIGN_RIGHT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddAction(DockingAction action)Adds the action to the graph display.voidclear()Clears all graph vertices and edges from this graph displayvoidclose()Closes this graph display window.voiddefineEdgeAttribute(java.lang.String name)Defines an edge attribute type for this graph windowvoiddefineVertexAttribute(java.lang.String name)Defines a vertex attribute type for this graph windowAttributedVertexgetFocusedVertex()Returns the currently focused vertex or null if no vertex is focusedAttributedGraphgetGraph()Returns the graph for this displayjava.lang.StringgetGraphTitle()Returns the title of the current graphjava.util.Set<AttributedVertex>getSelectedVertices()Returns a set of vertex ids for all the currently selected verticesvoidselectVertices(java.util.Set<AttributedVertex> vertexSet, EventTrigger eventTrigger)Tells the graph display window to select the vertices with the given idsvoidsetFocusedVertex(AttributedVertex vertex, EventTrigger eventTrigger)Tells the graph display window to focus the vertex with the given id.voidsetGraph(AttributedGraph graph, java.lang.String title, boolean append, TaskMonitor monitor)Sets the graph to be displayed or consumed by this graph displayvoidsetGraphDisplayListener(GraphDisplayListener listener)Sets aGraphDisplayListenerto be notified when the user changes the vertex focus or selects one or more nodes in a graph windowvoidsetVertexLabel(java.lang.String attributeName, int alignment, int size, boolean monospace, int maxLines)Sets the name of the attribute which should be used as the primary vertex label in the display.voidupdateVertexName(AttributedVertex vertex, java.lang.String newName)Updates a vertex to a new name
-
-
-
Field Detail
-
ALIGN_LEFT
static final int ALIGN_LEFT
- See Also:
- Constant Field Values
-
ALIGN_CENTER
static final int ALIGN_CENTER
- See Also:
- Constant Field Values
-
ALIGN_RIGHT
static final int ALIGN_RIGHT
- See Also:
- Constant Field Values
-
-
Method Detail
-
setGraphDisplayListener
void setGraphDisplayListener(GraphDisplayListener listener)
Sets aGraphDisplayListenerto 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
void setFocusedVertex(AttributedVertex vertex, EventTrigger eventTrigger)
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. SeeEventTriggerfor 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
void selectVertices(java.util.Set<AttributedVertex> vertexSet, EventTrigger eventTrigger)
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. SeeEventTriggerfor more information.
-
getSelectedVertices
java.util.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.
-
defineVertexAttribute
void defineVertexAttribute(java.lang.String name)
Defines a vertex attribute type for this graph window- Parameters:
name- the name of the attribute which may be attached to vertices.
-
defineEdgeAttribute
void defineEdgeAttribute(java.lang.String name)
Defines an edge attribute type for this graph window- Parameters:
name- the name of the attribute which may be attached to edges.
-
setVertexLabel
void setVertexLabel(java.lang.String attributeName, int alignment, int size, boolean monospace, int maxLines)Sets the name of the attribute which should be used as the primary vertex label in the display.- Parameters:
attributeName- the name of the attribute to use as the display label for vertices.alignment- (ALIGN_LEFT, ALIGN_RIGHT, or ALIGN_CENTER)size- the font size to use for the display labelmonospace- true if the font should be monospacedmaxLines- the maximum number lines to display in the vertex labels
-
setGraph
void setGraph(AttributedGraph graph, java.lang.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 consumetitle- a title for the graphmonitor- aTaskMonitorwhich 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
void updateVertexName(AttributedVertex vertex, java.lang.String newName)
Updates a vertex to a new name- Parameters:
vertex- the vertex to renamenewName- the new name for the vertex
-
getGraphTitle
java.lang.String getGraphTitle()
Returns the title of the current graph- Returns:
- the title of the current graph
-
addAction
void addAction(DockingAction action)
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.
-
-