edu.uci.ics.jung.samples
Class PluggableRendererDemo
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
javax.swing.JApplet
edu.uci.ics.jung.samples.PluggableRendererDemo
- All Implemented Interfaces:
- ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer
public class PluggableRendererDemo
- extends JApplet
- implements ActionListener
Shows off some of the capabilities of PluggableRenderer
.
This code provides examples of different ways to provide and
change the various functions that provide property information
to the renderer.
This demo creates a random mixed-mode graph with random edge
weights using TestGraph.generateMixedRandomGraph
.
It then runs VoltageRanker
on this graph, using half
of the "seed" vertices from the random graph generation as
voltage sources, and half of them as voltage sinks.
What the controls do:
Mouse controls:
If your mouse has a scroll wheel, scrolling forward zooms out and
scrolling backward zooms in.
Left-clicking on a vertex or edge selects it, and unselects all others.
Middle-clicking on a vertex or edge toggles its selection state.
Right-clicking on a vertex brings up a pop-up menu that allows you to
increase or decrease that vertex's transparency.
Left-clicking on the background allows you to drag the image around.
Hovering over a vertex tells you what its voltage is; hovering over an
edge shows its identity; hovering over the background shows an informational
message.
Vertex stuff:
"vertex seed coloring": if checked, the seed vertices are colored blue,
and all other vertices are colored red. Otherwise, all vertices are colored
a slightly transparent red (except the currently "picked" vertex, which is
colored transparent purple).
"vertex selection stroke highlighting": if checked, the picked vertex
and its neighbors are all drawn with heavy borders. Otherwise, all vertices
are drawn with light borders.
"show vertex ranks (voltages)": if checked, each vertex is labeled with its
calculated 'voltage'. Otherwise, vertices are unlabeled.
"vertex degree shapes": if checked, vertices are drawn with a polygon with
number of sides proportional to its degree. Otherwise, vertices are drawn
as ellipses.
"vertex voltage size": if checked, vertices are drawn with a size
proportional to their voltage ranking. Otherwise, all vertices are drawn
at the same size.
"vertex degree ratio stretch": if checked, vertices are drawn with an
aspect ratio (height/width ratio) proportional to the ratio of their indegree to
their outdegree. Otherwise, vertices are drawn with an aspect ratio of 1.
"filter vertices of degree < 4": if checked, does not display any vertices
(or their incident edges) whose degree in the original graph is less than 4;
otherwise, all vertices are drawn.
Edge stuff:
"edge shape": selects between lines, wedges, quadratic curves, and cubic curves
for drawing edges.
"fill edge shapes": if checked, fills the edge shapes. This will have no effect
if "line" is selected.
"edge paint": selects between solid colored edges, and gradient-painted edges.
Gradient painted edges are darkest in the middle for undirected edges, and darkest
at the destination for directed edges.
"show edges": only edges of the checked types are drawn.
"show arrows": only arrows whose edges are of the checked types are drawn.
"edge weight highlighting": if checked, edges with weight greater than
a threshold value are drawn using thick solid lines, and other edges are drawn
using thin gray dotted lines. (This combines edge stroke and paint.) Otherwise,
all edges are drawn with thin solid lines.
"show edge weights": if checked, edges are labeled with their weights.
Otherwise, edges are not labeled.
Miscellaneous (center panel)
"bold text": if checked, all vertex and edge labels are drawn using a
boldface font. Otherwise, a normal-weight font is used. (Has no effect if
no labels are currently visible.)
zoom controls:
"+" zooms in, "-" zooms out
"zoom at mouse (wheel only)": if checked, zooming (using the mouse
scroll wheel) is centered on the location of the mouse pointer; otherwise,
it is centered on the center of the visualization pane.
- Author:
- Danyel Fisher, Joshua O'Madadhain, Tom Nelson
- See Also:
- Serialized Form
Field Summary |
protected JRadioButton |
e_bent
|
protected JCheckBox |
e_color
|
protected JRadioButton |
e_cubic
|
protected JCheckBox |
e_darrow_pred
|
protected JCheckBox |
e_labels
|
protected JRadioButton |
e_line
|
protected JRadioButton |
e_ortho
|
protected JRadioButton |
e_quad
|
protected JCheckBox |
e_show_d
|
protected JCheckBox |
e_show_u
|
protected JCheckBox |
e_uarrow_pred
|
protected JRadioButton |
e_wedge
|
protected Map<Number,Number> |
edge_weight
|
protected PluggableRendererDemo.GradientPickedEdgePaintFunction<Integer,Number> |
edgeDrawPaint
|
protected PluggableRendererDemo.GradientPickedEdgePaintFunction<Integer,Number> |
edgeFillPaint
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.EdgeFontTransformer<Number> |
eff
|
protected org.apache.commons.collections15.Transformer<Number,String> |
es
|
protected org.apache.commons.collections15.Transformer<Number,String> |
es_none
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.EdgeWeightStrokeFunction<Number> |
ewcs
|
protected JCheckBox |
fill_edges
|
protected JCheckBox |
font
|
protected DefaultModalGraphMouse<Integer,Number> |
gm
|
protected static int |
gradient_level
|
protected static int |
GRADIENT_NONE
|
protected JRadioButton |
gradient_relative
|
protected static int |
GRADIENT_RELATIVE
|
protected JRadioButton |
no_gradient
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.SeedDrawColor<Integer> |
seedDrawColor
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.SeedFillColor<Integer> |
seedFillColor
|
protected Set<Integer> |
seedVertices
|
protected org.apache.commons.collections15.Predicate<Context<Graph<Integer,Number>,Number>> |
self_loop
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.DirectionDisplayPredicate<Integer,Number> |
show_arrow
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.DirectionDisplayPredicate<Integer,Number> |
show_edge
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.VertexDisplayPredicate<Integer,Number> |
show_vertex
|
protected Map<Integer,Number> |
transparency
|
protected static Object |
TRANSPARENCY
|
protected JCheckBox |
v_aspect
|
protected JCheckBox |
v_color
|
protected JCheckBox |
v_labels
|
protected JCheckBox |
v_shape
|
protected JCheckBox |
v_size
|
protected JCheckBox |
v_small
|
protected JCheckBox |
v_stroke
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.VertexFontTransformer<Integer> |
vff
|
protected static Object |
VOLTAGE_KEY
|
protected org.apache.commons.collections15.Transformer<Integer,Double> |
voltages
|
protected org.apache.commons.collections15.Transformer<Integer,String> |
vs
|
protected org.apache.commons.collections15.Transformer<Integer,String> |
vs_none
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.VertexStrokeHighlight<Integer,Number> |
vsh
|
protected edu.uci.ics.jung.samples.PluggableRendererDemo.VertexShapeSizeAspect<Integer,Number> |
vssa
|
protected VisualizationViewer<Integer,Number> |
vv
|
protected JCheckBox |
zoom_at_mouse
|
Methods inherited from class javax.swing.JApplet |
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.applet.Applet |
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
v_color
protected JCheckBox v_color
e_color
protected JCheckBox e_color
v_stroke
protected JCheckBox v_stroke
e_uarrow_pred
protected JCheckBox e_uarrow_pred
e_darrow_pred
protected JCheckBox e_darrow_pred
v_shape
protected JCheckBox v_shape
v_size
protected JCheckBox v_size
v_aspect
protected JCheckBox v_aspect
v_labels
protected JCheckBox v_labels
e_line
protected JRadioButton e_line
e_bent
protected JRadioButton e_bent
e_wedge
protected JRadioButton e_wedge
e_quad
protected JRadioButton e_quad
e_ortho
protected JRadioButton e_ortho
e_cubic
protected JRadioButton e_cubic
e_labels
protected JCheckBox e_labels
font
protected JCheckBox font
e_show_d
protected JCheckBox e_show_d
e_show_u
protected JCheckBox e_show_u
v_small
protected JCheckBox v_small
zoom_at_mouse
protected JCheckBox zoom_at_mouse
fill_edges
protected JCheckBox fill_edges
no_gradient
protected JRadioButton no_gradient
gradient_relative
protected JRadioButton gradient_relative
GRADIENT_NONE
protected static final int GRADIENT_NONE
- See Also:
- Constant Field Values
GRADIENT_RELATIVE
protected static final int GRADIENT_RELATIVE
- See Also:
- Constant Field Values
gradient_level
protected static int gradient_level
seedFillColor
protected edu.uci.ics.jung.samples.PluggableRendererDemo.SeedFillColor<Integer> seedFillColor
seedDrawColor
protected edu.uci.ics.jung.samples.PluggableRendererDemo.SeedDrawColor<Integer> seedDrawColor
ewcs
protected edu.uci.ics.jung.samples.PluggableRendererDemo.EdgeWeightStrokeFunction<Number> ewcs
vsh
protected edu.uci.ics.jung.samples.PluggableRendererDemo.VertexStrokeHighlight<Integer,Number> vsh
vs
protected org.apache.commons.collections15.Transformer<Integer,String> vs
vs_none
protected org.apache.commons.collections15.Transformer<Integer,String> vs_none
es
protected org.apache.commons.collections15.Transformer<Number,String> es
es_none
protected org.apache.commons.collections15.Transformer<Number,String> es_none
vff
protected edu.uci.ics.jung.samples.PluggableRendererDemo.VertexFontTransformer<Integer> vff
eff
protected edu.uci.ics.jung.samples.PluggableRendererDemo.EdgeFontTransformer<Number> eff
vssa
protected edu.uci.ics.jung.samples.PluggableRendererDemo.VertexShapeSizeAspect<Integer,Number> vssa
show_edge
protected edu.uci.ics.jung.samples.PluggableRendererDemo.DirectionDisplayPredicate<Integer,Number> show_edge
show_arrow
protected edu.uci.ics.jung.samples.PluggableRendererDemo.DirectionDisplayPredicate<Integer,Number> show_arrow
show_vertex
protected edu.uci.ics.jung.samples.PluggableRendererDemo.VertexDisplayPredicate<Integer,Number> show_vertex
self_loop
protected org.apache.commons.collections15.Predicate<Context<Graph<Integer,Number>,Number>> self_loop
edgeDrawPaint
protected PluggableRendererDemo.GradientPickedEdgePaintFunction<Integer,Number> edgeDrawPaint
edgeFillPaint
protected PluggableRendererDemo.GradientPickedEdgePaintFunction<Integer,Number> edgeFillPaint
VOLTAGE_KEY
protected static final Object VOLTAGE_KEY
TRANSPARENCY
protected static final Object TRANSPARENCY
edge_weight
protected Map<Number,Number> edge_weight
voltages
protected org.apache.commons.collections15.Transformer<Integer,Double> voltages
transparency
protected Map<Integer,Number> transparency
vv
protected VisualizationViewer<Integer,Number> vv
gm
protected DefaultModalGraphMouse<Integer,Number> gm
seedVertices
protected Set<Integer> seedVertices
PluggableRendererDemo
public PluggableRendererDemo()
start
public void start()
- Overrides:
start
in class Applet
main
public static void main(String[] s)
startFunction
public JPanel startFunction()
getGraph
public Graph<Integer,Number> getGraph()
- Generates a mixed-mode random graph, runs VoltageRanker on it, and
returns the resultant graph.
addBottomControls
protected void addBottomControls(JPanel jp)
- Parameters:
jp
- panel to which controls will be added
actionPerformed
public void actionPerformed(ActionEvent e)
- Specified by:
actionPerformed
in interface ActionListener
Copyright © 2009. All Rights Reserved.