Package org.jungrapht.visualization
Class VisualizationServer.Builder<V,E,T extends org.jungrapht.visualization.DefaultVisualizationServer<V,E>,B extends VisualizationServer.Builder<V,E,T,B>>
- java.lang.Object
-
- org.jungrapht.visualization.VisualizationServer.Builder<V,E,T,B>
-
- Type Parameters:
V
- the vertex typeE
- the edge typeT
- the type that is builtB
- the builder type
- Direct Known Subclasses:
VisualizationImageServer.Builder
,VisualizationViewer.Builder
- Enclosing interface:
- VisualizationServer<V,E>
public static class VisualizationServer.Builder<V,E,T extends org.jungrapht.visualization.DefaultVisualizationServer<V,E>,B extends VisualizationServer.Builder<V,E,T,B>> extends Object
A builder for creating instances of aVisualizationServer
with user defined properties
-
-
Field Summary
Fields Modifier and Type Field Description protected org.jgrapht.Graph<V,E>
graph
theGraph
to be visualizedprotected Function<org.jgrapht.Graph<V,?>,Pair<Integer>>
initialDimensionFunction
protected LayoutAlgorithm<V>
layoutAlgorithm
the algorithm to apply to position the verticesprotected Dimension
layoutSize
the bounds of the graph layout areaprotected Dimension
viewSize
the size of the viewer windowprotected VisualizationModel<V,E>
visualizationModel
the model to hold state for the visualization
-
Constructor Summary
Constructors Modifier Constructor Description protected
Builder()
create an instance with no argsprotected
Builder(org.jgrapht.Graph<V,E> graph)
create an instance of the builder with the passedGraph
protected
Builder(VisualizationModel<V,E> visualizationModel)
create an instance of the builder if the visualizationModel is null, a new one will be created from the graph and layout size, both of which must not be null
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
build()
B
initialDimensionFunction(Function<org.jgrapht.Graph<V,?>,Pair<Integer>> initialDimensionFunction)
B
layoutAlgorithm(LayoutAlgorithm<V> layoutAlgorithm)
B
layoutSize(Dimension layoutSize)
protected B
self()
B
viewSize(Dimension viewSize)
-
-
-
Field Detail
-
layoutSize
protected Dimension layoutSize
the bounds of the graph layout area
-
viewSize
protected Dimension viewSize
the size of the viewer window
-
layoutAlgorithm
protected LayoutAlgorithm<V> layoutAlgorithm
the algorithm to apply to position the vertices
-
visualizationModel
protected VisualizationModel<V,E> visualizationModel
the model to hold state for the visualization
-
-
Constructor Detail
-
Builder
protected Builder()
create an instance with no args
-
Builder
protected Builder(org.jgrapht.Graph<V,E> graph)
create an instance of the builder with the passedGraph
- Parameters:
graph
- the graph to visualize
-
Builder
protected Builder(VisualizationModel<V,E> visualizationModel)
create an instance of the builder if the visualizationModel is null, a new one will be created from the graph and layout size, both of which must not be null- Parameters:
visualizationModel
- the model to hold visualization state
-
-
Method Detail
-
self
protected B self()
- Returns:
- this builder cast to type B
-
layoutSize
public B layoutSize(Dimension layoutSize)
- Parameters:
layoutSize
- the width height bounds of the graph layout area- Returns:
- this builder for method chaining
-
viewSize
public B viewSize(Dimension viewSize)
- Parameters:
viewSize
- the preferred size of the view- Returns:
- this builder for method chaining
-
layoutAlgorithm
public B layoutAlgorithm(LayoutAlgorithm<V> layoutAlgorithm)
- Parameters:
layoutAlgorithm
- the algorithm to apply to place the graph vertices- Returns:
- this builder for chaining
-
initialDimensionFunction
public B initialDimensionFunction(Function<org.jgrapht.Graph<V,?>,Pair<Integer>> initialDimensionFunction)
-
build
public T build()
- Returns:
- a new instance of a
DefaultVisualizationServer
-
-