Package org.jungrapht.visualization
Class AbstractVisualizationViewer<V,E>
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.jungrapht.visualization.AbstractVisualizationViewer<V,E>
-
- Type Parameters:
V- vertex typeE- edge type
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,LayoutSizeChange.Listener,LayoutStateChange.Listener,ModelChange.Listener,ViewChange.Listener,RenderContextStateChange.Listener,VisualizationComponent,VisualizationServer<V,E>,VisualizationViewer<V,E>
public abstract class AbstractVisualizationViewer<V,E> extends JPanel
Provided as a public base class for extending the DefaultVisualizationViewer- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.VisualizationServer
VisualizationServer.Builder<V,E,T extends org.jungrapht.visualization.DefaultVisualizationServer<V,E>,B extends VisualizationServer.Builder<V,E,T,B>>, VisualizationServer.Paintable
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.VisualizationViewer
VisualizationViewer.Builder<V,E,T extends org.jungrapht.visualization.DefaultVisualizationViewer<V,E>,B extends VisualizationViewer.Builder<V,E,T,B>>, VisualizationViewer.GraphMouse
-
-
Field Summary
Fields Modifier and Type Field Description protected ChangeEventSupportchangeSupportprotected booleandoubleBuffereduser-settable choice to use the offscreen image or not.protected Spatial<E,V>edgeSpatialprotected Function<E,String>edgeToolTipFunctionprotected VisualizationViewer.GraphMousegraphMouseprovides MouseListener, MouseMotionListener, and MouseWheelListener events to the graphprotected doublelightweightRenderingScaleThresholdprotected intlightweightRenderingVertexCountThresholdprotected Function<MouseEvent,String>mouseEventToolTipFunctionprotected Supplier<MultiSelectionStrategy>multiSelectionStrategySupplierprotected BufferedImageoffscreenan offscreen image to render the graph Used if doubleBuffered is set to trueprotected Graphics2DoffscreenG2dgraphics context for the offscreen image Used if doubleBuffered is set to trueprotected ItemListenerpickEventListenera listener used to cause pick events to result in repaints, even if they come from another viewprotected List<VisualizationServer.Paintable>postRenderersa collection of user-implementable functions to render over the topology (after the graph is rendered)protected List<VisualizationServer.Paintable>preRenderersa collection of user-implementable functions to render under the topology (before the graph is rendered)protected RenderContext<V,E>renderContextprotected DefaultModalRenderer<V,E>rendererhandles the actual drawing of graph elementsprotected Map<RenderingHints.Key,Object>renderingHintsrendering hints used in drawing.protected MouseListenerrequestFocusListenerprotected BiFunction<org.jgrapht.Graph<V,E>,E,Shape>savedEdgeShapeFunctionprotected doublescaleToLayoutPaddingFactorprotected MutableSelectedState<E>selectedEdgeStateholds the state of which edges of the graph are currently 'selected'protected MutableSelectedState<V>selectedVertexStateholds the state of which vertices of the graph are currently 'selected'protected Predicate<Double>smallScaleOverridePredicateprotected booleanspatialSupportOnSwingThreadprotected TransformSupport<V,E>transformSupportprotected Spatial<V,V>vertexSpatialprotected Function<V,String>vertexToolTipFunctionprotected VisualizationModel<V,E>visualizationModelholds the state of this View-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractVisualizationViewer(VisualizationViewer.Builder<V,E,?,?> builder)Constructor for extending classes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(ChangeListener l)Adds aChangeListener.voidaddGraphMouseListener(GraphMouseListener<V> graphMouseListener)Adds a listenervoidaddKeyListener(KeyListener l)Override to request focus on mouse enter, if a key listener is addedvoidaddPostRenderPaintable(VisualizationServer.Paintable paintable)voidaddPreRenderPaintable(VisualizationServer.Paintable paintable)protected voidapplyLayoutAlgorithmConnections()The LayoutAlgorithms that use Articulated edges (with bends) need to set the edgeShapeFunction to a class that will provide the bend points for each edge.protected voidcheckOffscreenImage(Dimension d)Ensure that, if doubleBuffering is enabled, the offscreen image buffer exists and is the correct layoutSize.voidfireStateChanged()Notifies all listeners that have registered interest for notification on this event type.Point2DgetCenter()ChangeListener[]getChangeListeners()Returns an array of all theChangeListeners added with addChangeListener().JComponentgetComponent()Spatial<E,V>getEdgeSpatial()VisualizationViewer.GraphMousegetGraphMouse()Supplier<MultiSelectionStrategy>getMultiSelectionStrategySupplier()GraphElementAccessor<V,E>getPickSupport()RenderContext<V,E>getRenderContext()ModalRenderer<V,E>getRenderer()Map<RenderingHints.Key,Object>getRenderingHints()Set<E>getSelectedEdges()MutableSelectedState<E>getSelectedEdgeState()MutableSelectedState<V>getSelectedVertexState()Set<V>getSelectedVertices()DimensiongetSize()Always sanity-check getLayoutSize so that we don't use a value that is improbableStringgetToolTipText(MouseEvent event)called by the superclass to display tooltipsTransformSupport<V,E>getTransformSupport()Spatial<V,V>getVertexSpatial()VisualizationModel<V,E>getVisualizationModel()booleanisDoubleBuffered()Returns whether this class uses double buffering.voidlayoutSizeChanged(LayoutSizeChange.Event evt)voidlayoutStateChanged(LayoutStateChange.Event evt)voidmodelChanged()a ModelChange.Event from the LayoutModel will trigger a repaint of the visualizationprotected voidpaintComponent(Graphics g)voidprependPostRenderPaintable(VisualizationServer.Paintable paintable)voidprependPreRenderPaintable(VisualizationServer.Paintable paintable)voidremoveChangeListener(ChangeListener l)Removes a ChangeListener.voidremovePostRenderPaintable(VisualizationServer.Paintable paintable)voidremovePreRenderPaintable(VisualizationServer.Paintable paintable)voidrenderContextStateChanged(RenderContextStateChange.Event evt)protected voidrenderGraph(Graphics2D g2d)voidreset()resets all transforms in the visualizationvoidresizeToLayout()voidscaleToLayout()scale the graph visualization to fit within the view windowvoidscaleToLayout(boolean resizeToPoints)scale the graph visualization to fit within the view windowvoidscaleToLayout(ScalingControl scaler)scale the graph layout to fit withon the view windowvoidscaleToLayout(ScalingControl scaler, boolean resizeToPoints)scale the graph layout to fit withon the view windowvoidsetDoubleBuffered(boolean doubleBuffered)Specify whether this class uses its offscreen image or not.voidsetEdgeSpatial(Spatial<E,V> spatial)voidsetEdgeToolTipFunction(Function<E,String> edgeToolTipFunction)voidsetGraphMouse(VisualizationViewer.GraphMouse graphMouse)sets and configures the GraphMouse.voidsetInitialDimensionFunction(Function<org.jgrapht.Graph<V,?>,Pair<Integer>> initialDimensionFunction)voidsetMouseEventToolTipFunction(Function<MouseEvent,String> mouseEventToolTipFunction)voidsetMultiSelectionStrategySupplier(Supplier<MultiSelectionStrategy> multiSelectionStrategySupplier)voidsetPickSupport(GraphElementAccessor<V,E> pickSupport)voidsetRenderContext(RenderContext<V,E> renderContext)voidsetRenderingHints(Map<RenderingHints.Key,Object> renderingHints)voidsetSelectedEdgeState(MutableSelectedState<E> selectedEdgeState)voidsetSelectedVertexState(MutableSelectedState<V> selectedVertexState)voidsetTransformSupport(TransformSupport<V,E> transformSupport)voidsetVertexSpatial(Spatial<V,V> spatial)voidsetVertexToolTipFunction(Function<V,String> vertexToolTipFunction)voidsetVisualizationModel(VisualizationModel<V,E> visualizationModel)voidstateChanged(ChangeEvent e)In response to changes from the model, repaint the view, then fire an event to any listeners.protected voidupdateSelectionStates()when the graph model changed (added/removed vertices/edges) update the selected state so that nothing is 'selected' that is not still in the graph.voidviewChanged()ShapeviewOnLayout()-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutSizeChange.Listener
layoutSizeChanged
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutStateChange.Listener
layoutStateChanged
-
Methods inherited from interface org.jungrapht.visualization.layout.event.ModelChange.Listener
modelChanged
-
Methods inherited from interface org.jungrapht.visualization.RenderContextStateChange.Listener
renderContextStateChanged
-
Methods inherited from interface org.jungrapht.visualization.layout.event.ViewChange.Listener
viewChanged
-
Methods inherited from interface org.jungrapht.visualization.VisualizationComponent
add, add, getBackground, getBounds, getComponent, getFont, getHeight, getPreferredSize, getSize, getToolTipText, getWidth, setBackground, setCursor, setFont, setForeground, setLayout, setPreferredSize
-
Methods inherited from interface org.jungrapht.visualization.VisualizationServer
addChangeListener, addPostRenderPaintable, addPreRenderPaintable, fireStateChanged, getCenter, getChangeListeners, getEdgeSpatial, getPickSupport, getRenderContext, getRenderer, getRenderingHints, getSelectedEdges, getSelectedEdgeState, getSelectedVertexState, getSelectedVertices, getTransformSupport, getVertexSpatial, getVisualizationModel, isDoubleBuffered, prependPreRenderPaintable, removeChangeListener, removePostRenderPaintable, removePreRenderPaintable, repaint, reset, resizeToLayout, scaleToLayout, scaleToLayout, scaleToLayout, scaleToLayout, setDoubleBuffered, setEdgeSpatial, setInitialDimensionFunction, setPickSupport, setRenderContext, setRenderingHints, setSelectedEdgeState, setSelectedVertexState, setTransformSupport, setVertexSpatial, setVisible, setVisualizationModel, stateChanged, viewOnLayout
-
Methods inherited from interface org.jungrapht.visualization.VisualizationViewer
setToolTipText
-
-
-
-
Field Detail
-
mouseEventToolTipFunction
protected Function<MouseEvent,String> mouseEventToolTipFunction
-
graphMouse
protected VisualizationViewer.GraphMouse graphMouse
provides MouseListener, MouseMotionListener, and MouseWheelListener events to the graph
-
multiSelectionStrategySupplier
protected Supplier<MultiSelectionStrategy> multiSelectionStrategySupplier
-
requestFocusListener
protected MouseListener requestFocusListener
-
changeSupport
protected ChangeEventSupport changeSupport
-
visualizationModel
protected VisualizationModel<V,E> visualizationModel
holds the state of this View
-
renderer
protected DefaultModalRenderer<V,E> renderer
handles the actual drawing of graph elements
-
renderingHints
protected Map<RenderingHints.Key,Object> renderingHints
rendering hints used in drawing. Anti-aliasing is on by default
-
selectedVertexState
protected MutableSelectedState<V> selectedVertexState
holds the state of which vertices of the graph are currently 'selected'
-
selectedEdgeState
protected MutableSelectedState<E> selectedEdgeState
holds the state of which edges of the graph are currently 'selected'
-
pickEventListener
protected ItemListener pickEventListener
a listener used to cause pick events to result in repaints, even if they come from another view
-
offscreen
protected BufferedImage offscreen
an offscreen image to render the graph Used if doubleBuffered is set to true
-
offscreenG2d
protected Graphics2D offscreenG2d
graphics context for the offscreen image Used if doubleBuffered is set to true
-
doubleBuffered
protected boolean doubleBuffered
user-settable choice to use the offscreen image or not. 'false' by default
-
preRenderers
protected List<VisualizationServer.Paintable> preRenderers
a collection of user-implementable functions to render under the topology (before the graph is rendered)
-
postRenderers
protected List<VisualizationServer.Paintable> postRenderers
a collection of user-implementable functions to render over the topology (after the graph is rendered)
-
renderContext
protected RenderContext<V,E> renderContext
-
transformSupport
protected TransformSupport<V,E> transformSupport
-
vertexSpatial
protected Spatial<V,V> vertexSpatial
-
edgeSpatial
protected Spatial<E,V> edgeSpatial
-
spatialSupportOnSwingThread
protected boolean spatialSupportOnSwingThread
-
savedEdgeShapeFunction
protected BiFunction<org.jgrapht.Graph<V,E>,E,Shape> savedEdgeShapeFunction
-
lightweightRenderingVertexCountThreshold
protected int lightweightRenderingVertexCountThreshold
-
lightweightRenderingScaleThreshold
protected double lightweightRenderingScaleThreshold
-
scaleToLayoutPaddingFactor
protected double scaleToLayoutPaddingFactor
-
-
Constructor Detail
-
AbstractVisualizationViewer
protected AbstractVisualizationViewer(VisualizationViewer.Builder<V,E,?,?> builder)
Constructor for extending classes- Parameters:
builder- to set properties
-
-
Method Detail
-
setMultiSelectionStrategySupplier
public void setMultiSelectionStrategySupplier(Supplier<MultiSelectionStrategy> multiSelectionStrategySupplier)
- Specified by:
setMultiSelectionStrategySupplierin interfaceVisualizationViewer<V,E>
-
getMultiSelectionStrategySupplier
public Supplier<MultiSelectionStrategy> getMultiSelectionStrategySupplier()
- Specified by:
getMultiSelectionStrategySupplierin interfaceVisualizationViewer<V,E>
-
setGraphMouse
public void setGraphMouse(VisualizationViewer.GraphMouse graphMouse)
sets and configures the GraphMouse. This will remove any previous GraphMouse.- Specified by:
setGraphMousein interfaceVisualizationViewer<V,E>- Parameters:
graphMouse- new value
-
getGraphMouse
public VisualizationViewer.GraphMouse getGraphMouse()
- Specified by:
getGraphMousein interfaceVisualizationViewer<V,E>- Returns:
- the current
GraphMouse
-
addGraphMouseListener
public void addGraphMouseListener(GraphMouseListener<V> graphMouseListener)
Adds a listener- Specified by:
addGraphMouseListenerin interfaceVisualizationViewer<V,E>- Parameters:
graphMouseListener- the mouse listener to add
-
addKeyListener
public void addKeyListener(KeyListener l)
Override to request focus on mouse enter, if a key listener is added- Specified by:
addKeyListenerin interfaceVisualizationViewer<V,E>- Overrides:
addKeyListenerin classComponent- See Also:
Component.addKeyListener(KeyListener)
-
setEdgeToolTipFunction
public void setEdgeToolTipFunction(Function<E,String> edgeToolTipFunction)
- Specified by:
setEdgeToolTipFunctionin interfaceVisualizationViewer<V,E>- Parameters:
edgeToolTipFunction- the edgeToolTipFunction to set
-
setMouseEventToolTipFunction
public void setMouseEventToolTipFunction(Function<MouseEvent,String> mouseEventToolTipFunction)
- Specified by:
setMouseEventToolTipFunctionin interfaceVisualizationViewer<V,E>- Parameters:
mouseEventToolTipFunction- the mouseEventToolTipFunction to set
-
setVertexToolTipFunction
public void setVertexToolTipFunction(Function<V,String> vertexToolTipFunction)
- Specified by:
setVertexToolTipFunctionin interfaceVisualizationViewer<V,E>- Parameters:
vertexToolTipFunction- the vertexToolTipFunction to set
-
getToolTipText
public String getToolTipText(MouseEvent event)
called by the superclass to display tooltips- Specified by:
getToolTipTextin interfaceVisualizationViewer<V,E>- Overrides:
getToolTipTextin classJComponent
-
reset
public void reset()
Description copied from interface:VisualizationServerresets all transforms in the visualization- Specified by:
resetin interfaceVisualizationServer<V,E>
-
getComponent
public JComponent getComponent()
- Specified by:
getComponentin interfaceVisualizationComponent
-
layoutSizeChanged
public void layoutSizeChanged(LayoutSizeChange.Event evt)
- Specified by:
layoutSizeChangedin interfaceLayoutSizeChange.Listener<V>
-
setInitialDimensionFunction
public void setInitialDimensionFunction(Function<org.jgrapht.Graph<V,?>,Pair<Integer>> initialDimensionFunction)
- Specified by:
setInitialDimensionFunctionin interfaceVisualizationServer<V,E>
-
getVertexSpatial
public Spatial<V,V> getVertexSpatial()
- Specified by:
getVertexSpatialin interfaceVisualizationServer<V,E>
-
setVertexSpatial
public void setVertexSpatial(Spatial<V,V> spatial)
- Specified by:
setVertexSpatialin interfaceVisualizationServer<V,E>
-
getEdgeSpatial
public Spatial<E,V> getEdgeSpatial()
- Specified by:
getEdgeSpatialin interfaceVisualizationServer<V,E>
-
setEdgeSpatial
public void setEdgeSpatial(Spatial<E,V> spatial)
- Specified by:
setEdgeSpatialin interfaceVisualizationServer<V,E>
-
setDoubleBuffered
public void setDoubleBuffered(boolean doubleBuffered)
Description copied from interface:VisualizationServerSpecify whether this class uses its offscreen image or not.- Specified by:
setDoubleBufferedin interfaceVisualizationServer<V,E>- Overrides:
setDoubleBufferedin classJComponent- Parameters:
doubleBuffered- if true, then doubleBuffering in the superclass is set to 'false'
-
isDoubleBuffered
public boolean isDoubleBuffered()
Description copied from interface:VisualizationServerReturns whether this class uses double buffering. The superclass will be the opposite state.- Specified by:
isDoubleBufferedin interfaceVisualizationServer<V,E>- Overrides:
isDoubleBufferedin classJComponent- Returns:
- the double buffered state
-
getSize
public Dimension getSize()
Always sanity-check getLayoutSize so that we don't use a value that is improbable- Specified by:
getSizein interfaceVisualizationComponent- Overrides:
getSizein classComponent- See Also:
Component.getSize()
-
checkOffscreenImage
protected void checkOffscreenImage(Dimension d)
Ensure that, if doubleBuffering is enabled, the offscreen image buffer exists and is the correct layoutSize.- Parameters:
d- the expected Dimension of the offscreen buffer
-
getVisualizationModel
public VisualizationModel<V,E> getVisualizationModel()
- Specified by:
getVisualizationModelin interfaceVisualizationServer<V,E>- Returns:
- the model.
-
setVisualizationModel
public void setVisualizationModel(VisualizationModel<V,E> visualizationModel)
- Specified by:
setVisualizationModelin interfaceVisualizationServer<V,E>- Parameters:
visualizationModel- the model for this class to use
-
stateChanged
public void stateChanged(ChangeEvent e)
Description copied from interface:VisualizationServerIn response to changes from the model, repaint the view, then fire an event to any listeners. Examples of listeners are the VisualizationScrollPane and the BirdsEyeVisualizationViewer- Specified by:
stateChangedin interfaceChangeListener- Specified by:
stateChangedin interfaceVisualizationServer<V,E>- Parameters:
e- the change event
-
getRenderer
public ModalRenderer<V,E> getRenderer()
- Specified by:
getRendererin interfaceVisualizationServer<V,E>- Returns:
- the renderer used by this instance.
-
resizeToLayout
public void resizeToLayout()
- Specified by:
resizeToLayoutin interfaceVisualizationServer<V,E>
-
scaleToLayout
public void scaleToLayout()
Description copied from interface:VisualizationServerscale the graph visualization to fit within the view window- Specified by:
scaleToLayoutin interfaceVisualizationServer<V,E>
-
scaleToLayout
public void scaleToLayout(boolean resizeToPoints)
Description copied from interface:VisualizationServerscale the graph visualization to fit within the view window- Specified by:
scaleToLayoutin interfaceVisualizationServer<V,E>
-
scaleToLayout
public void scaleToLayout(ScalingControl scaler)
Description copied from interface:VisualizationServerscale the graph layout to fit withon the view window- Specified by:
scaleToLayoutin interfaceVisualizationServer<V,E>- Parameters:
scaler- theScalingControlto change the view scale
-
scaleToLayout
public void scaleToLayout(ScalingControl scaler, boolean resizeToPoints)
Description copied from interface:VisualizationServerscale the graph layout to fit withon the view window- Specified by:
scaleToLayoutin interfaceVisualizationServer<V,E>- Parameters:
scaler- theScalingControlto change the view scale
-
getRenderingHints
public Map<RenderingHints.Key,Object> getRenderingHints()
- Specified by:
getRenderingHintsin interfaceVisualizationServer<V,E>- Returns:
- the renderingHints
-
setRenderingHints
public void setRenderingHints(Map<RenderingHints.Key,Object> renderingHints)
- Specified by:
setRenderingHintsin interfaceVisualizationServer<V,E>- Parameters:
renderingHints- The renderingHints to set.
-
paintComponent
protected void paintComponent(Graphics g)
- Overrides:
paintComponentin classJComponent
-
viewOnLayout
public Shape viewOnLayout()
- Specified by:
viewOnLayoutin interfaceVisualizationServer<V,E>
-
renderGraph
protected void renderGraph(Graphics2D g2d)
-
modelChanged
public void modelChanged()
a ModelChange.Event from the LayoutModel will trigger a repaint of the visualization- Specified by:
modelChangedin interfaceModelChange.Listener
-
updateSelectionStates
protected void updateSelectionStates()
when the graph model changed (added/removed vertices/edges) update the selected state so that nothing is 'selected' that is not still in the graph.
-
applyLayoutAlgorithmConnections
protected void applyLayoutAlgorithmConnections()
The LayoutAlgorithms that use Articulated edges (with bends) need to set the edgeShapeFunction to a class that will provide the bend points for each edge. The LayoutAlgorithms that comsider vertex Shape during layout need to access the vertexShapeFunction
-
viewChanged
public void viewChanged()
- Specified by:
viewChangedin interfaceViewChange.Listener
-
layoutStateChanged
public void layoutStateChanged(LayoutStateChange.Event evt)
- Specified by:
layoutStateChangedin interfaceLayoutStateChange.Listener
-
renderContextStateChanged
public void renderContextStateChanged(RenderContextStateChange.Event evt)
- Specified by:
renderContextStateChangedin interfaceRenderContextStateChange.Listener<V,E>
-
addPreRenderPaintable
public void addPreRenderPaintable(VisualizationServer.Paintable paintable)
- Specified by:
addPreRenderPaintablein interfaceVisualizationServer<V,E>- Parameters:
paintable- The paintable to add.
-
prependPreRenderPaintable
public void prependPreRenderPaintable(VisualizationServer.Paintable paintable)
- Specified by:
prependPreRenderPaintablein interfaceVisualizationServer<V,E>- Parameters:
paintable- The paintable to add.
-
removePreRenderPaintable
public void removePreRenderPaintable(VisualizationServer.Paintable paintable)
- Specified by:
removePreRenderPaintablein interfaceVisualizationServer<V,E>- Parameters:
paintable- The paintable to remove.
-
addPostRenderPaintable
public void addPostRenderPaintable(VisualizationServer.Paintable paintable)
- Specified by:
addPostRenderPaintablein interfaceVisualizationServer<V,E>- Parameters:
paintable- The paintable to add.
-
prependPostRenderPaintable
public void prependPostRenderPaintable(VisualizationServer.Paintable paintable)
-
removePostRenderPaintable
public void removePostRenderPaintable(VisualizationServer.Paintable paintable)
- Specified by:
removePostRenderPaintablein interfaceVisualizationServer<V,E>- Parameters:
paintable- The paintable to remove.
-
addChangeListener
public void addChangeListener(ChangeListener l)
Description copied from interface:VisualizationServerAdds aChangeListener.- Specified by:
addChangeListenerin interfaceVisualizationServer<V,E>- Parameters:
l- the listener to be added
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Description copied from interface:VisualizationServerRemoves a ChangeListener.- Specified by:
removeChangeListenerin interfaceVisualizationServer<V,E>- Parameters:
l- the listener to be removed
-
getChangeListeners
public ChangeListener[] getChangeListeners()
Description copied from interface:VisualizationServerReturns an array of all theChangeListeners added with addChangeListener().- Specified by:
getChangeListenersin interfaceVisualizationServer<V,E>- Returns:
- all of the
ChangeListeners added or an empty array if no listeners have been added
-
fireStateChanged
public void fireStateChanged()
Description copied from interface:VisualizationServerNotifies all listeners that have registered interest for notification on this event type. The event instance is lazily created.- Specified by:
fireStateChangedin interfaceVisualizationServer<V,E>- See Also:
EventListenerList
-
getSelectedVertexState
public MutableSelectedState<V> getSelectedVertexState()
- Specified by:
getSelectedVertexStatein interfaceVisualizationServer<V,E>- Returns:
- the vertex MutableSelectedState instance
-
getSelectedVertices
public Set<V> getSelectedVertices()
- Specified by:
getSelectedVerticesin interfaceVisualizationServer<V,E>
-
getSelectedEdgeState
public MutableSelectedState<E> getSelectedEdgeState()
- Specified by:
getSelectedEdgeStatein interfaceVisualizationServer<V,E>- Returns:
- the edge MutableSelectedState instance
-
getSelectedEdges
public Set<E> getSelectedEdges()
- Specified by:
getSelectedEdgesin interfaceVisualizationServer<V,E>
-
setSelectedVertexState
public void setSelectedVertexState(MutableSelectedState<V> selectedVertexState)
- Specified by:
setSelectedVertexStatein interfaceVisualizationServer<V,E>
-
setSelectedEdgeState
public void setSelectedEdgeState(MutableSelectedState<E> selectedEdgeState)
- Specified by:
setSelectedEdgeStatein interfaceVisualizationServer<V,E>
-
getPickSupport
public GraphElementAccessor<V,E> getPickSupport()
- Specified by:
getPickSupportin interfaceVisualizationServer<V,E>- Returns:
- the GraphElementAccessor
-
setPickSupport
public void setPickSupport(GraphElementAccessor<V,E> pickSupport)
- Specified by:
setPickSupportin interfaceVisualizationServer<V,E>- Parameters:
pickSupport- The pickSupport to set.
-
getCenter
public Point2D getCenter()
- Specified by:
getCenterin interfaceVisualizationServer<V,E>- Returns:
- the x,y coordinates of the view center
-
getRenderContext
public RenderContext<V,E> getRenderContext()
- Specified by:
getRenderContextin interfaceVisualizationServer<V,E>- Returns:
- the
RenderContextused to draw the graph
-
setRenderContext
public void setRenderContext(RenderContext<V,E> renderContext)
- Specified by:
setRenderContextin interfaceVisualizationServer<V,E>- Parameters:
renderContext- theRenderContextused to draw the graph
-
getTransformSupport
public TransformSupport<V,E> getTransformSupport()
- Specified by:
getTransformSupportin interfaceVisualizationServer<V,E>
-
setTransformSupport
public void setTransformSupport(TransformSupport<V,E> transformSupport)
- Specified by:
setTransformSupportin interfaceVisualizationServer<V,E>
-
-