Interface VisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Superinterfaces:
GDirectedGraph<V,E>
- All Known Implementing Classes:
DefaultVisualGraph
,FilteringVisualGraph
,GroupingVisualGraph
,JungDirectedVisualGraph
public interface VisualGraph<V extends VisualVertex,E extends VisualEdge<V>> extends GDirectedGraph<V,E>
The primary interface for graphs that are to be rendered. This class defines methods commonly used in the GUI while extending the primary non-visual graph interface.The Visual Graph API will typically provide services for taking a Visual Graph and creating a UI that handles basic user interaction elements (similar to how complex Java widgets handle user interaction for the developer). The Visual Graph is the model of the UI components. A typical Visual Graph UI will render developer-defined components, handling mouse event translations for the developer.
Some features found in Visual Graphs:
- Mouse event translation - the JComponent being rendered in the graph will be handed mouse events that are relative to its coordinate space, not that of the graph.
- Hover and Selection - vertex hover and selection events are handled by the API
- Zooming - zoom level and related events (when zoomed too far, mouse events are not passed-through to the component) and handled by the API
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addGraphChangeListener(VisualGraphChangeListener<V,E> l)
Adds the given listener to this graphvoid
clearSelectedVertices()
Clears any selected vertices as well as the focused vertexVisualGraph<V,E>
copy()
Copy this graph.V
getFocusedVertex()
Returns the focused vertex; null if no vertex has focus.VisualGraphLayout<V,E>
getLayout()
Returns the layout that has been applied to the graph.java.util.Set<V>
getSelectedVertices()
Returns the selected vertices.void
removeGraphChangeListener(VisualGraphChangeListener<V,E> l)
Removes the given listener from this graphvoid
setSelectedVertices(java.util.Set<V> vertices)
Selects the given verticesvoid
setVertexFocused(V v, boolean b)
Sets the given vertex to be focused or notvoid
vertexLocationChanged(V v, java.awt.Point point, LayoutListener.ChangeType changeType)
A callback notifying this graph that the given vertex's location has changed-
Methods inherited from interface ghidra.graph.GDirectedGraph
addEdge, addVertex, containsEdge, containsEdge, containsVertex, emptyCopy, findEdge, getEdgeCount, getEdges, getIncidentEdges, getInEdges, getOutEdges, getPredecessors, getSuccessors, getVertexCount, getVertices, isEmpty, removeEdge, removeEdges, removeVertex, removeVertices
-
-
-
-
Method Detail
-
vertexLocationChanged
void vertexLocationChanged(V v, java.awt.Point point, LayoutListener.ChangeType changeType)
A callback notifying this graph that the given vertex's location has changed- Parameters:
v
- the vertexpoint
- the new locationchangeType
- the type of change
-
getFocusedVertex
V getFocusedVertex()
Returns the focused vertex; null if no vertex has focus. Focus is equivalent to being selected, but further distinguishes the vertex as being the only selected vertex. This is useful for key event processing.- Returns:
- the focused vertex
-
setVertexFocused
void setVertexFocused(V v, boolean b)
Sets the given vertex to be focused or notNote: this method is called by other APIs to ensure that the graph's notion of the focused vertex matches what is happening externally (e.g., from the user clicking the screen). If you wish to programmatically focus a vertex, then you should not be calling this API directly, but you should instead be using the
GPickedState
or one of the APIs that uses that, such as theGraphComponent
.- Parameters:
v
- the focused vertexb
- true for focused; false for not focused
-
clearSelectedVertices
void clearSelectedVertices()
Clears any selected vertices as well as the focused vertex
-
setSelectedVertices
void setSelectedVertices(java.util.Set<V> vertices)
Selects the given verticesNote: this method is called by other APIs to ensure that the graph's notion of the focused vertex matches what is happening externally (e.g., from the user clicking the screen). If you wish to programmatically select a vertex, then you should not be calling this API directly, but you should instead be using the
GPickedState
or one of the APIs that uses that, such as theGraphComponent
.- Parameters:
vertices
- the vertices
-
getSelectedVertices
java.util.Set<V> getSelectedVertices()
Returns the selected vertices.- Returns:
- the selected vertices
-
addGraphChangeListener
void addGraphChangeListener(VisualGraphChangeListener<V,E> l)
Adds the given listener to this graph- Parameters:
l
- the listener
-
removeGraphChangeListener
void removeGraphChangeListener(VisualGraphChangeListener<V,E> l)
Removes the given listener from this graph- Parameters:
l
- the listener
-
getLayout
VisualGraphLayout<V,E> getLayout()
Returns the layout that has been applied to the graph. The graph does not need its layout to function, but rather it is convenient for the visual graph system to be able to get the layout from the graph, rather than passing the layout everywhere it is needed.- Returns:
- the layout applied to the graph
-
copy
VisualGraph<V,E> copy()
Description copied from interface:GDirectedGraph
Copy this graph.Note: the vertices and edges in the copy may be the same instances in the new graph and not themselves copies.
- Specified by:
copy
in interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Returns:
- the new copy
-
-