Package jline.io

Class ModelVisualizer

java.lang.Object
jline.io.ModelVisualizer

public class ModelVisualizer extends Object
Unified visualizer for both Network and LayeredNetwork models using the JUNG library.

This visualizer accepts either a Network or LayeredNetwork object and provides appropriate visual styling for each model type:

Network models (queueing networks):

  • White shapes (except Sink which is black)
  • 9 node types: Source, Sink, Queue, Delay, Fork, Join, ClassSwitch, Cache, Router
  • Sugiyama-style left-to-right hierarchical layout
  • Solid black edges

LayeredNetwork models (LQN):

  • Red shapes (yellow when selected)
  • 4 node types: Host (triangle), Task (parallelogram), Entry (rectangle), Activity (circle)
  • 4-level hierarchical layout (Host→Task→Entry→Activity)
  • 6 edge styles: solid (hierarchy), dashed (sync), dot-dashed (async), dotted (forwarding)
  • Constructor Details

    • ModelVisualizer

      public ModelVisualizer(Network model)
      Creates a visualizer for a Network model.
      Parameters:
      model - the Network to visualize
    • ModelVisualizer

      public ModelVisualizer(LayeredNetwork model)
      Creates a visualizer for a LayeredNetwork model.
      Parameters:
      model - the LayeredNetwork to visualize
  • Method Details

    • buildGraph

      public edu.uci.ics.jung.graph.Graph<ModelVisualizer.ModelVertex,ModelVisualizer.ModelEdge> buildGraph()
      Builds a JUNG graph from the underlying model.
      Returns:
      the constructed JUNG graph
    • show

      public void show()
      Displays the graph in a JFrame window with default settings.
    • show

      public void show(String title)
      Displays the graph with a custom title.
      Parameters:
      title - the window title
    • show

      public void show(String title, int width, int height)
      Displays the graph with custom title and dimensions.
      Parameters:
      title - the window title
      width - the window width
      height - the window height
    • show

      public void show(String title, int width, int height, boolean showToolbars)
      Displays the graph with custom title, dimensions, and toolbar visibility.
      Parameters:
      title - the window title
      width - the window width
      height - the window height
      showToolbars - if true, show toolbars; if false, show only the graph image
    • showWithLayout

      public void showWithLayout(edu.uci.ics.jung.algorithms.layout.Layout<ModelVisualizer.ModelVertex,ModelVisualizer.ModelEdge> layout, String title, int width, int height, boolean showToolbars)
      Displays the graph using the specified layout with optional toolbars.
    • createHierarchicalLayout

      public edu.uci.ics.jung.algorithms.layout.Layout<ModelVisualizer.ModelVertex,ModelVisualizer.ModelEdge> createHierarchicalLayout(int width, int height)
      Creates a hierarchical layout appropriate for the model type.
    • createHierarchicalLayout

      public edu.uci.ics.jung.algorithms.layout.Layout<ModelVisualizer.ModelVertex,ModelVisualizer.ModelEdge> createHierarchicalLayout(int width, int height, double vSpaceFactor)
      Creates a hierarchical layout with vertical spacing factor.
    • getVertexPaintTransformer

      public com.google.common.base.Function<ModelVisualizer.ModelVertex,Paint> getVertexPaintTransformer(ModelVisualizer.ModelVertex[] selectedVertex, int[] colorTheme)
      Returns a transformer for vertex fill colors based on color theme. Theme 0=Color, 1=Multicolor, 2=Greyscale, 3=Black/White
    • getVertexOutlineTransformer

      public com.google.common.base.Function<ModelVisualizer.ModelVertex,Paint> getVertexOutlineTransformer()
      Returns a transformer for vertex outline colors.
    • getVertexShapeTransformer

      public com.google.common.base.Function<ModelVisualizer.ModelVertex,Shape> getVertexShapeTransformer()
      Returns a transformer for vertex shapes based on node type.
    • getEdgePaintTransformer

      public com.google.common.base.Function<ModelVisualizer.ModelEdge,Paint> getEdgePaintTransformer()
      Returns a transformer for edge colors.
    • getEdgeStrokeTransformer

      public com.google.common.base.Function<ModelVisualizer.ModelEdge,Stroke> getEdgeStrokeTransformer()
      Returns a transformer for edge strokes based on edge type.
    • getGraph

      public edu.uci.ics.jung.graph.Graph<ModelVisualizer.ModelVertex,ModelVisualizer.ModelEdge> getGraph()
      Returns the underlying JUNG graph.
    • setBackgroundImage

      public static void setBackgroundImage(edu.uci.ics.jung.visualization.VisualizationViewer<?,?> vv, BufferedImage img)
      Sets a background image for the visualization viewer.
    • clearBackgroundImage

      public static void clearBackgroundImage(edu.uci.ics.jung.visualization.VisualizationViewer<?,?> vv)
      Clears the background image from the visualization viewer.