public class BasicVisualizationServer<V,E> extends javax.swing.JPanel implements javax.swing.event.ChangeListener, ChangeEventSupport, VisualizationServer<V,E>
Modifier and Type | Class and Description |
---|---|
protected class |
BasicVisualizationServer.VisualizationListener
VisualizationListener reacts to changes in the size of the
VisualizationViewer.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
java.awt.Container.AccessibleAWTContainer
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
VisualizationServer.Paintable
Modifier and Type | Field and Description |
---|---|
protected ChangeEventSupport |
changeSupport |
protected boolean |
doubleBuffered
user-settable choice to use the offscreen image
or not.
|
protected VisualizationModel<V,E> |
model
holds the state of this View
|
protected java.awt.image.BufferedImage |
offscreen
an offscreen image to render the graph
Used if doubleBuffered is set to true
|
protected java.awt.Graphics2D |
offscreenG2d
graphics context for the offscreen image
Used if doubleBuffered is set to true
|
protected PickedState<E> |
pickedEdgeState
holds the state of which edges of the graph are
currently 'picked'
|
protected PickedState<V> |
pickedVertexState
holds the state of which vertices of the graph are
currently 'picked'
|
protected java.awt.event.ItemListener |
pickEventListener
a listener used to cause pick events to result in
repaints, even if they come from another view
|
protected java.util.List<VisualizationServer.Paintable> |
postRenderers
a collection of user-implementable functions to render over the
topology (after the graph is rendered)
|
protected java.util.List<VisualizationServer.Paintable> |
preRenderers
a collection of user-implementable functions to render under
the topology (before the graph is rendered)
|
protected RenderContext<V,E> |
renderContext |
protected Renderer<V,E> |
renderer
handles the actual drawing of graph elements
|
protected java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> |
renderingHints
rendering hints used in drawing.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
BasicVisualizationServer(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout)
Create an instance with passed parameters.
|
BasicVisualizationServer(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout,
java.awt.Dimension preferredSize)
Create an instance with passed parameters.
|
BasicVisualizationServer(VisualizationModel<V,E> model)
Create an instance with passed parameters.
|
BasicVisualizationServer(VisualizationModel<V,E> model,
java.awt.Dimension preferredSize)
Create an instance with passed parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l)
Adds a
ChangeListener . |
void |
addPostRenderPaintable(VisualizationServer.Paintable paintable) |
void |
addPreRenderPaintable(VisualizationServer.Paintable paintable) |
protected void |
checkOffscreenImage(java.awt.Dimension d)
Ensure that, if doubleBuffering is enabled, the offscreen
image buffer exists and is the correct size.
|
void |
fireStateChanged()
Notifies all listeners that have registered interest for
notification on this event type.
|
java.awt.geom.Point2D |
getCenter() |
javax.swing.event.ChangeListener[] |
getChangeListeners()
Returns an array of all the
ChangeListener s added
with addChangeListener(). |
edu.uci.ics.jung.algorithms.layout.Layout<V,E> |
getGraphLayout()
Returns the current graph layout.
|
VisualizationModel<V,E> |
getModel() |
PickedState<E> |
getPickedEdgeState() |
PickedState<V> |
getPickedVertexState() |
edu.uci.ics.jung.algorithms.layout.GraphElementAccessor<V,E> |
getPickSupport() |
RenderContext<V,E> |
getRenderContext() |
Renderer<V,E> |
getRenderer()
Returns the renderer used by this instance.
|
java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> |
getRenderingHints() |
java.awt.Dimension |
getSize()
Always sanity-check getSize so that we don't use a
value that is improbable
|
boolean |
isDoubleBuffered()
whether this class uses double buffering.
|
protected void |
paintComponent(java.awt.Graphics g) |
void |
prependPostRenderPaintable(VisualizationServer.Paintable paintable) |
void |
prependPreRenderPaintable(VisualizationServer.Paintable paintable) |
void |
removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener.
|
void |
removePostRenderPaintable(VisualizationServer.Paintable paintable) |
void |
removePreRenderPaintable(VisualizationServer.Paintable paintable) |
protected void |
renderGraph(java.awt.Graphics2D g2d) |
void |
scaleToLayout(ScalingControl scaler) |
void |
setDoubleBuffered(boolean doubleBuffered)
set whether this class uses its offscreen image or not.
|
void |
setGraphLayout(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout)
Removes the current graph layout, and adds a new one.
|
void |
setModel(VisualizationModel<V,E> model) |
void |
setPickedEdgeState(PickedState<E> pickedEdgeState) |
void |
setPickedVertexState(PickedState<V> pickedVertexState) |
void |
setPickSupport(edu.uci.ics.jung.algorithms.layout.GraphElementAccessor<V,E> pickSupport) |
void |
setRenderContext(RenderContext<V,E> renderContext) |
void |
setRenderer(Renderer<V,E> r)
Sets the showing Renderer to be the input Renderer.
|
void |
setRenderingHints(java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> renderingHints) |
void |
setVisible(boolean aFlag) |
void |
stateChanged(javax.swing.event.ChangeEvent e)
In response to changes from the model, repaint the
view, then fire an event to any listeners.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, 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, unregisterKeyboardAction, update
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
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
repaint
protected ChangeEventSupport changeSupport
protected VisualizationModel<V,E> model
protected java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> renderingHints
protected PickedState<V> pickedVertexState
protected PickedState<E> pickedEdgeState
protected java.awt.event.ItemListener pickEventListener
protected java.awt.image.BufferedImage offscreen
protected java.awt.Graphics2D offscreenG2d
protected boolean doubleBuffered
protected java.util.List<VisualizationServer.Paintable> preRenderers
protected java.util.List<VisualizationServer.Paintable> postRenderers
protected RenderContext<V,E> renderContext
public BasicVisualizationServer(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout)
layout
- The Layout to apply, with its associated Graphrenderer
- The Renderer to draw it withpublic BasicVisualizationServer(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout, java.awt.Dimension preferredSize)
layout
- The Layout to apply, with its associated Graphrenderer
- The Renderer to draw it withpreferredSize
- the preferred size of this Viewpublic BasicVisualizationServer(VisualizationModel<V,E> model)
model
- renderer
- public BasicVisualizationServer(VisualizationModel<V,E> model, java.awt.Dimension preferredSize)
model
- renderer
- preferredSize
- initial preferred size of the viewpublic void setDoubleBuffered(boolean doubleBuffered)
VisualizationServer
setDoubleBuffered
in interface VisualizationServer<V,E>
setDoubleBuffered
in class javax.swing.JComponent
public boolean isDoubleBuffered()
VisualizationServer
isDoubleBuffered
in interface VisualizationServer<V,E>
isDoubleBuffered
in class javax.swing.JComponent
public java.awt.Dimension getSize()
getSize
in class java.awt.Component
Component.getSize()
protected void checkOffscreenImage(java.awt.Dimension d)
d
- public VisualizationModel<V,E> getModel()
getModel
in interface VisualizationServer<V,E>
public void setModel(VisualizationModel<V,E> model)
setModel
in interface VisualizationServer<V,E>
model
- The model to set.public void stateChanged(javax.swing.event.ChangeEvent e)
VisualizationServer
stateChanged
in interface VisualizationServer<V,E>
stateChanged
in interface javax.swing.event.ChangeListener
public void setRenderer(Renderer<V,E> r)
VisualizationServer
setRenderer
in interface VisualizationServer<V,E>
public Renderer<V,E> getRenderer()
VisualizationServer
getRenderer
in interface VisualizationServer<V,E>
public void setGraphLayout(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout)
VisualizationServer
setGraphLayout
in interface VisualizationServer<V,E>
layout
- the new layout to setpublic void scaleToLayout(ScalingControl scaler)
public edu.uci.ics.jung.algorithms.layout.Layout<V,E> getGraphLayout()
VisualizationServer
getGraphLayout
in interface VisualizationServer<V,E>
public void setVisible(boolean aFlag)
setVisible
in interface VisualizationServer<V,E>
setVisible
in class javax.swing.JComponent
JComponent.setVisible(boolean)
public java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> getRenderingHints()
getRenderingHints
in interface VisualizationServer<V,E>
public void setRenderingHints(java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> renderingHints)
setRenderingHints
in interface VisualizationServer<V,E>
renderingHints
- The renderingHints to set.protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
protected void renderGraph(java.awt.Graphics2D g2d)
public void addPreRenderPaintable(VisualizationServer.Paintable paintable)
addPreRenderPaintable
in interface VisualizationServer<V,E>
paintable
- The paintable to add.public void prependPreRenderPaintable(VisualizationServer.Paintable paintable)
public void removePreRenderPaintable(VisualizationServer.Paintable paintable)
removePreRenderPaintable
in interface VisualizationServer<V,E>
paintable
- The paintable to remove.public void addPostRenderPaintable(VisualizationServer.Paintable paintable)
addPostRenderPaintable
in interface VisualizationServer<V,E>
paintable
- The paintable to add.public void prependPostRenderPaintable(VisualizationServer.Paintable paintable)
public void removePostRenderPaintable(VisualizationServer.Paintable paintable)
removePostRenderPaintable
in interface VisualizationServer<V,E>
paintable
- The paintable to remove.public void addChangeListener(javax.swing.event.ChangeListener l)
VisualizationServer
ChangeListener
.addChangeListener
in interface ChangeEventSupport
addChangeListener
in interface VisualizationServer<V,E>
l
- the listener to be addedpublic void removeChangeListener(javax.swing.event.ChangeListener l)
ChangeEventSupport
removeChangeListener
in interface ChangeEventSupport
removeChangeListener
in interface VisualizationServer<V,E>
l
- the listener to be removedpublic javax.swing.event.ChangeListener[] getChangeListeners()
ChangeEventSupport
ChangeListener
s added
with addChangeListener().getChangeListeners
in interface ChangeEventSupport
getChangeListeners
in interface VisualizationServer<V,E>
ChangeListener
s added or an empty
array if no listeners have been addedpublic void fireStateChanged()
VisualizationServer
fireStateChanged
in interface ChangeEventSupport
fireStateChanged
in interface VisualizationServer<V,E>
EventListenerList
public PickedState<V> getPickedVertexState()
getPickedVertexState
in interface VisualizationServer<V,E>
public PickedState<E> getPickedEdgeState()
getPickedEdgeState
in interface VisualizationServer<V,E>
public void setPickedVertexState(PickedState<V> pickedVertexState)
setPickedVertexState
in interface VisualizationServer<V,E>
public void setPickedEdgeState(PickedState<E> pickedEdgeState)
setPickedEdgeState
in interface VisualizationServer<V,E>
public edu.uci.ics.jung.algorithms.layout.GraphElementAccessor<V,E> getPickSupport()
getPickSupport
in interface VisualizationServer<V,E>
public void setPickSupport(edu.uci.ics.jung.algorithms.layout.GraphElementAccessor<V,E> pickSupport)
setPickSupport
in interface VisualizationServer<V,E>
pickSupport
- The pickSupport to set.public java.awt.geom.Point2D getCenter()
getCenter
in interface VisualizationServer<V,E>
public RenderContext<V,E> getRenderContext()
getRenderContext
in interface VisualizationServer<V,E>
public void setRenderContext(RenderContext<V,E> renderContext)
setRenderContext
in interface VisualizationServer<V,E>