Package ghidra.graph.viewer.edge
Class VisualGraphPathHighlighter<V extends VisualVertex,E extends VisualEdge<V>>
- java.lang.Object
-
- ghidra.graph.viewer.edge.VisualGraphPathHighlighter<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
public class VisualGraphPathHighlighter<V extends VisualVertex,E extends VisualEdge<V>> extends java.lang.Object
A class that calculates flow between vertices and then triggers that flow to be painted in the UI.Threading Policy: Some operations use algorithms that slow down, depending upon the graph size. Further, some of these algorithms may not even complete. To keep the graph responsive, this class will perform its work in the future. The work we wish to do is further complicated by these requirements:
- Some data should be calculated only as needed, to avoid excessive work
- Many tasks depend on data to be calculated before they can perform their algorithm
- Results must be cached for speed, but may cleared as the graph is mutated
- Algorithms must not block the UI thread
- Related actions (i.e., hover vs. selection) should cancel any pending action, but not unrelated actions (e.g., a new hover request should cancel a pending hover update)
CompletableFuture
- to lazy-load and cache required algorithm dataRunManager
s - to queue requests so that new requests cancel old ones. A different Run Manager is used for each type of request.
Naming Conventions: There are many methods in this class, called from different threads. For simplicity, we use the following conventions:
fooAsync
- methods ending in Async indicate that they are to be called from a background thread.fooSwing
- methods ending in Swing indicate that they are to be called from the Swing thread.- *All public methods are assumed to be called on the Swing thread
-
-
Constructor Summary
Constructors Constructor Description VisualGraphPathHighlighter(VisualGraph<V,E> graph, PathHighlightListener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearEdgeCache()
void
dispose()
protected GDirectedGraph<V,E>
getDominanceGraph(VisualGraph<V,E> visualGraph, boolean forward)
PathHighlightMode
getVertexFocusPathHighlightMode()
PathHighlightMode
getVertexHoverPathHighlightMode()
boolean
isBusy()
void
setFocusedVertex(V focusedVertex)
void
setHoveredVertex(V hoveredVertex)
void
setVertexFocusMode(PathHighlightMode mode)
void
setVertexHoverMode(PathHighlightMode mode)
void
setWorkPauser(PathHighlighterWorkPauser pauser)
Sets the callback that signals when this path highlighter should not be performing any workvoid
stop()
Signals to this path highlighter that it should stop all background jobs
-
-
-
Constructor Detail
-
VisualGraphPathHighlighter
public VisualGraphPathHighlighter(VisualGraph<V,E> graph, PathHighlightListener listener)
-
-
Method Detail
-
setWorkPauser
public void setWorkPauser(PathHighlighterWorkPauser pauser)
Sets the callback that signals when this path highlighter should not be performing any work- Parameters:
pauser
- the callback that returns a boolean of true when this class should pause its work.
-
getDominanceGraph
protected GDirectedGraph<V,E> getDominanceGraph(VisualGraph<V,E> visualGraph, boolean forward)
-
stop
public void stop()
Signals to this path highlighter that it should stop all background jobs
-
dispose
public void dispose()
-
isBusy
public boolean isBusy()
-
getVertexHoverPathHighlightMode
public PathHighlightMode getVertexHoverPathHighlightMode()
-
getVertexFocusPathHighlightMode
public PathHighlightMode getVertexFocusPathHighlightMode()
-
setVertexFocusMode
public void setVertexFocusMode(PathHighlightMode mode)
-
setVertexHoverMode
public void setVertexHoverMode(PathHighlightMode mode)
-
setHoveredVertex
public void setHoveredVertex(V hoveredVertex)
-
setFocusedVertex
public void setFocusedVertex(V focusedVertex)
-
clearEdgeCache
public void clearEdgeCache()
-
-