Class 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.
See Also: