Package jline.io
Class ModelVisualizer
java.lang.Object
jline.io.ModelVisualizer
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)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumUnified edge type enumeration covering both Network and LayeredNetwork relationships.static classUnified wrapper class for graph edges representing relationships.static classUnified wrapper class for graph vertices representing model elements.static enumUnified node type enumeration covering both Network and LayeredNetwork elements. -
Constructor Summary
ConstructorsConstructorDescriptionModelVisualizer(LayeredNetwork model) Creates a visualizer for a LayeredNetwork model.ModelVisualizer(Network model) Creates a visualizer for a Network model. -
Method Summary
Modifier and TypeMethodDescriptionedu.uci.ics.jung.graph.Graph<ModelVisualizer.ModelVertex, ModelVisualizer.ModelEdge> Builds a JUNG graph from the underlying model.static voidclearBackgroundImage(edu.uci.ics.jung.visualization.VisualizationViewer<?, ?> vv) Clears the background image from the visualization viewer.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.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.com.google.common.base.Function<ModelVisualizer.ModelEdge, Paint> Returns a transformer for edge colors.com.google.common.base.Function<ModelVisualizer.ModelEdge, Stroke> Returns a transformer for edge strokes based on edge type.edu.uci.ics.jung.graph.Graph<ModelVisualizer.ModelVertex, ModelVisualizer.ModelEdge> getGraph()Returns the underlying JUNG graph.com.google.common.base.Function<ModelVisualizer.ModelVertex, Paint> Returns a transformer for vertex outline colors.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.com.google.common.base.Function<ModelVisualizer.ModelVertex, Shape> Returns a transformer for vertex shapes based on node type.static voidsetBackgroundImage(edu.uci.ics.jung.visualization.VisualizationViewer<?, ?> vv, BufferedImage img) Sets a background image for the visualization viewer.voidshow()Displays the graph in a JFrame window with default settings.voidDisplays the graph with a custom title.voidDisplays the graph with custom title and dimensions.voidDisplays the graph with custom title, dimensions, and toolbar visibility.voidshowWithLayout(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.
-
Constructor Details
-
ModelVisualizer
Creates a visualizer for a Network model.- Parameters:
model- the Network to visualize
-
ModelVisualizer
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
Displays the graph with a custom title.- Parameters:
title- the window title
-
show
Displays the graph with custom title and dimensions.- Parameters:
title- the window titlewidth- the window widthheight- the window height
-
show
Displays the graph with custom title, dimensions, and toolbar visibility.- Parameters:
title- the window titlewidth- the window widthheight- the window heightshowToolbars- 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
Returns a transformer for edge colors. -
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.
-