Class DefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Type Parameters:
V- the vertex typeE- the edge type
- All Implemented Interfaces:
edu.uci.ics.jung.graph.DirectedGraph<V,,E> edu.uci.ics.jung.graph.Graph<V,,E> edu.uci.ics.jung.graph.Hypergraph<V,,E> GDirectedGraph<V,,E> GImplicitDirectedGraph<V,,E> VisualGraph<V,,E> Serializable
- Direct Known Subclasses:
FilteringVisualGraph,GroupingVisualGraph
VisualGraph that implements basic setup for things like event processing.
Notes:
- Selected Vertices and the Focused Vertex -
there can be multiple selected vertices, but only a single focused vertex.
getSelectedVertices()will return both the selected vertices or the focused vertex if there are no vertices selected. - Clicking a single vertex will focus it. Control-clicking multiple vertices will cause them all to be selected, with no focused vertex.
- Rendering Edges - edges are rendered with or without articulations if they have them. This is built-in to the default graphing edge renderer. Some layouts require custom edge rendering and will provide their own renderer as needed.
- See Also:
-
Field Summary
FieldsFields inherited from class edu.uci.ics.jung.graph.DirectedSparseGraph
edges, verticesFields inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph
edge_type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddEdge(E edge, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints, edu.uci.ics.jung.graph.util.EdgeType edgeType) voidAdds the given listener to this graphbooleanAdd a vertexvoidClears any selected vertices as well as the focused vertexabstract DefaultVisualGraph<V, E> copy()Copy this graph.voiddispose()protected voidfireEdgesAdded(Iterable<E> added) protected voidfireEdgesRemoved(Iterable<E> removed) protected voidfireVerticesAdded(Collection<V> added) protected voidfireVerticesRemoved(Collection<V> removed) getAllEdges(V v) A convenience method to combine retrieval of in and out edges for the given vertexReturns all edges shared between the two given verticesReturns the focused vertex; null if no vertex has focus.Returns the selected vertices.protected voidbooleanremoveEdge(E edge) Removes an edgevoidRemoves the given listener from this graphbooleanremoveVertex(V v) Remove a vertexvoidremoveVertices(Iterable<V> toRemove) Removes the given vertices from the graphvoidsetSelectedVertices(Set<V> selectedVertices) Selects the given verticesvoidsetVertexFocused(V vertex, boolean focused) Sets the given vertex to be focused or notvoidvertexLocationChanged(V v, Point point, LayoutListener.ChangeType type) A callback notifying this graph that the given vertex's location has changedprotected voidverticesAdded(Collection<V> added) Called after one or more vertices have been added.protected voidverticesRemoved(Collection<V> removed) Called after one or more vertices have been removed.Methods inherited from class ghidra.graph.jung.JungDirectedGraph
addEdge, containsEdge, emptyCopy, isEmpty, removeEdgesMethods inherited from class edu.uci.ics.jung.graph.DirectedSparseGraph
containsEdge, containsVertex, findEdge, findEdgeSet, getDest, getEdgeCount, getEdges, getEndpoints, getFactory, getIncidentEdges, getIncoming_internal, getInEdges, getNeighbors, getOutEdges, getOutgoing_internal, getPredecessors, getPreds_internal, getSource, getSuccessors, getSuccs_internal, getVertexCount, getVertices, isDest, isSourceMethods inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph
getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, hasEqualEdgeType, validateEdgeTypeMethods inherited from class edu.uci.ics.jung.graph.AbstractGraph
addEdge, addEdge, addEdge, addEdge, addEdge, degree, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegree, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.graph.GDirectedGraph
addEdge, containsEdge, containsEdge, containsVertex, emptyCopy, findEdge, getEdgeCount, getEdges, getIncidentEdges, getInEdges, getOutEdges, getPredecessors, getSuccessors, getVertexCount, getVertices, isEmpty, removeEdgesMethods inherited from interface edu.uci.ics.jung.graph.Graph
addEdge, addEdge, getOpposite, getPredecessorCount, getSuccessorCount, inDegree, isPredecessor, isSuccessor, outDegreeMethods inherited from interface edu.uci.ics.jung.graph.Hypergraph
addEdge, addEdge, degree, getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, getIncidentCount, getIncidentVertices, getNeighborCount, isIncident, isNeighborMethods inherited from interface ghidra.graph.VisualGraph
getLayout
-
Field Details
-
focusedVertex
-
-
Constructor Details
-
DefaultVisualGraph
public DefaultVisualGraph()
-
-
Method Details
-
copy
Description copied from interface:GDirectedGraphCopy 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:
copyin interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>> - Specified by:
copyin interfaceGImplicitDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>> - Specified by:
copyin interfaceVisualGraph<V extends VisualVertex,E extends VisualEdge<V>> - Specified by:
copyin classJungDirectedVisualGraph<V extends VisualVertex,E extends VisualEdge<V>> - Returns:
- the new copy
-
setSelectedVertices
Description copied from interface:VisualGraphSelects 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
GPickedStateor one of the APIs that uses that, such as theGraphComponent.- Parameters:
selectedVertices- the vertices
-
setVertexFocused
Description copied from interface:VisualGraphSets 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
GPickedStateor one of the APIs that uses that, such as theGraphComponent.- Parameters:
vertex- the focused vertexfocused- true for focused; false for not focused
-
getFocusedVertex
Description copied from interface:VisualGraphReturns 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
-
clearSelectedVertices
public void clearSelectedVertices()Description copied from interface:VisualGraphClears any selected vertices as well as the focused vertex -
getSelectedVertices
Description copied from interface:VisualGraphReturns the selected vertices.- Returns:
- the selected vertices
-
vertexLocationChanged
Description copied from interface:VisualGraphA callback notifying this graph that the given vertex's location has changed- Parameters:
v- the vertexpoint- the new locationtype- the type of change
-
dispose
public void dispose() -
initializeLocation
-
getAllEdges
A convenience method to combine retrieval of in and out edges for the given vertex- Parameters:
v- the vertex- Returns:
- the edges
-
getEdges
Returns all edges shared between the two given vertices- Parameters:
start- the start vertexend- the end vertex- Returns:
- the edges
-
addVertex
Description copied from interface:GDirectedGraphAdd a vertex- Specified by:
addVertexin interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>> - Specified by:
addVertexin interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>> - Overrides:
addVertexin classedu.uci.ics.jung.graph.DirectedSparseGraph<V extends VisualVertex,E extends VisualEdge<V>> - Parameters:
v- the vertex- Returns:
- true if the add was successful, false otherwise
-
addEdge
public boolean addEdge(E edge, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints, edu.uci.ics.jung.graph.util.EdgeType edgeType) - Overrides:
addEdgein classedu.uci.ics.jung.graph.DirectedSparseGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
removeVertex
Description copied from interface:GDirectedGraphRemove a vertex- Specified by:
removeVertexin interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>> - Specified by:
removeVertexin interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>> - Overrides:
removeVertexin classedu.uci.ics.jung.graph.DirectedSparseGraph<V extends VisualVertex,E extends VisualEdge<V>> - Parameters:
v- the vertex- Returns:
- true
-
removeVertices
Description copied from interface:GDirectedGraphRemoves the given vertices from the graph- Specified by:
removeVerticesin interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>> - Overrides:
removeVerticesin classJungDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>> - Parameters:
toRemove- the vertices to remove
-
removeEdge
Description copied from interface:GDirectedGraphRemoves an edge- Specified by:
removeEdgein interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>> - Specified by:
removeEdgein interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>> - Overrides:
removeEdgein classedu.uci.ics.jung.graph.DirectedSparseGraph<V extends VisualVertex,E extends VisualEdge<V>> - Parameters:
edge- the edge- Returns:
- true if the graph contained the given edge
-
verticesAdded
Called after one or more vertices have been added. The callback will happen after all additions have taken place. This is an extension point for subclasses.- Parameters:
added- the added vertices
-
verticesRemoved
Called after one or more vertices have been removed. The callback will happen after all removals have taken place. This is an extension point for subclasses.- Parameters:
removed- the removed vertices
-
fireVerticesRemoved
-
fireVerticesAdded
-
fireEdgesRemoved
-
fireEdgesAdded
-
addGraphChangeListener
Description copied from interface:VisualGraphAdds the given listener to this graph- Parameters:
l- the listener
-
removeGraphChangeListener
Description copied from interface:VisualGraphRemoves the given listener from this graph- Parameters:
l- the listener
-