Package ghidra.graph.viewer
Class VisualGraphView<V extends VisualVertex,E extends VisualEdge<V>,G extends VisualGraph<V,E>>
java.lang.Object
ghidra.graph.viewer.VisualGraphView<V,E,G>
- Type Parameters:
V
- the vertex typeE
- the edge typeG
- the graph type
public class VisualGraphView<V extends VisualVertex,E extends VisualEdge<V>,G extends VisualGraph<V,E>>
extends Object
A view object, where 'view' is used in the sense of the Model-View-Controller (MVC) pattern.
This class will contain all UI widgets need to display and interact with a graph.
Implementation Note:
- The graph of this component can be null, changing to non-null values over the lifetime of this view. This allows this view to be installed in a UI component, with the contents changing as needed.
-
When the graph is
set
, the view portion of the class is recreated. -
At any given point in time there may not be a
graphComponent
. This means that this class must maintain settings state that it will apply when the component is created. This state is atypical and makes this class a bit harder to understand.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
cleanup()
Effectively clears this display.protected void
Returns the primary viewer of the graph (as opposed to the satellite viewer).protected <T> T
getWithBusyCursor
(Supplier<T> s) protected void
boolean
boolean
Returns whether the satellite intended to be docked.boolean
Returns whether the satellite intended to be visible.boolean
protected void
maybeTwinkleVertex
(V twinkleVertex, boolean doTwinkle) void
Called when the options used by this graph view have changedprotected void
void
repaint()
void
protected void
void
protected void
setGraphComponent
(GraphComponent<V, E, G> newComponent) void
setGraphPerspective
(GraphPerspectiveInfo<V, E> newPerspective) Sets the perspective for this viewvoid
setLayoutProvider
(LayoutProvider<V, E, G> newLayoutProvider) Sets the given layout provider, but does not actually perform a layout.void
setPopupsVisible
(boolean visible) void
setSatelliteDocked
(boolean docked) void
void
setSatelliteVisible
(boolean visible) protected void
setSouthComponent
(JComponent component) void
setStatusMessage
(String message) Sets a message to be painted on the viewer.void
setTooltipProvider
(VertexTooltipProvider<V, E> provider) void
Sets a listener that allows clients to be notified of vertex double-clicks.void
void
void
void
showErrorView
(String errorMessage) void
void
void
zoomToVertex
(V v) void
-
Field Details
-
graphComponent
protected GraphComponent<V extends VisualVertex,E extends VisualEdge<V>, graphComponentG extends VisualGraph<V, E>> -
layoutProvider
protected LayoutProvider<V extends VisualVertex,E extends VisualEdge<V>, layoutProviderG extends VisualGraph<V, E>>
-
-
Constructor Details
-
VisualGraphView
public VisualGraphView()
-
-
Method Details
-
getViewComponent
-
setSouthComponent
-
removeSatellite
protected void removeSatellite() -
optionsChanged
public void optionsChanged()Called when the options used by this graph view have changed -
setLayoutProvider
Sets the given layout provider, but does not actually perform a layout.- Parameters:
newLayoutProvider
- the new provider
-
setGraph
-
setSatelliteListener
-
setVertexFocusListener
-
setVertexClickListener
Sets a listener that allows clients to be notified of vertex double-clicks. Normal mouse processing is handled by theVisualGraphMousePlugin
class. This is a convenience method so that clients do not have to deal with the mouse plugin.- Parameters:
l
- the listener
-
installGraphViewer
protected void installGraphViewer() -
setGraphComponent
-
setContent
-
getWithBusyCursor
-
getVisualGraph
-
getPrimaryGraphViewer
Returns the primary viewer of the graph (as opposed to the satellite viewer). The viewer returned is responsible for maintaining view information for a given graph.- Returns:
- the primary viewer
-
getSatelliteViewer
-
setGraphPerspective
Sets the perspective for this view- Parameters:
newPerspective
- the new perspective
-
generateGraphPerspective
-
showErrorView
-
setStatusMessage
Sets a message to be painted on the viewer. This is useful to show a text message to the user. Passing null will clear the message.- Parameters:
message
- the status message
-
getGraphComponent
-
isSatelliteVisible
public boolean isSatelliteVisible()Returns whether the satellite intended to be visible. If this component is built, then a result of true means that the satellite is showing. If the component is not yet built, then a result of true means that the satellite will be made visible when the component is built.- Returns:
- true if visible
-
setSatelliteVisible
public void setSatelliteVisible(boolean visible) -
setSatelliteDocked
public void setSatelliteDocked(boolean docked) -
isSatelliteDocked
public boolean isSatelliteDocked()Returns whether the satellite intended to be docked. If this component is built, then a result of true means that the satellite is docked. If the component is not yet built, then a result of true means that the satellite will be made docked when the component is built.- Returns:
- true if visible
-
setPopupsVisible
public void setPopupsVisible(boolean visible) -
arePopupsEnabled
public boolean arePopupsEnabled() -
getUndockedSatelliteComponent
-
isSatelliteComponent
-
setVertexHoverPathHighlightMode
-
setVertexFocusPathHighlightMode
-
getVertexFocusPathHighlightMode
-
getVertexHoverPathHighlightMode
-
setTooltipProvider
-
zoomOutGraph
public void zoomOutGraph() -
zoomInGraph
public void zoomInGraph() -
zoomToVertex
-
zoomToWindow
public void zoomToWindow() -
getViewUpdater
-
getVertexPointInViewSpace
-
translatePointFromVertexToViewSpace
-
translateRectangleFromVertexToViewSpace
-
translateMouseEventFromVertexToViewSpace
-
isScaledPastInteractionThreshold
public boolean isScaledPastInteractionThreshold() -
maybeTwinkleVertex
-
requestFocus
public void requestFocus() -
repaint
public void repaint() -
getFocusedVertex
-
getSelectedVertices
-
getLayoutProvider
-
cleanup
public void cleanup()Effectively clears this display. This method is not called dispose, as that implies the end of an object's lifecycle. This object can be re-used after this method is called. -
disposeViewer
protected void disposeViewer()
-