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 aVisualizationServerwith user defined properties
-
-
Field Summary
Fields Modifier and Type Field Description protected org.jgrapht.Graph<V,E>graphtheGraphto be visualizedprotected Function<org.jgrapht.Graph<V,?>,Pair<Integer>>initialDimensionFunctionprotected LayoutAlgorithm<V>layoutAlgorithmthe algorithm to apply to position the verticesprotected DimensionlayoutSizethe bounds of the graph layout areaprotected DimensionviewSizethe size of the viewer windowprotected VisualizationModel<V,E>visualizationModelthe model to hold state for the visualization
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder()create an instance with no argsprotectedBuilder(org.jgrapht.Graph<V,E> graph)create an instance of the builder with the passedGraphprotectedBuilder(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 Tbuild()BinitialDimensionFunction(Function<org.jgrapht.Graph<V,?>,Pair<Integer>> initialDimensionFunction)BlayoutAlgorithm(LayoutAlgorithm<V> layoutAlgorithm)BlayoutSize(Dimension layoutSize)protected Bself()BviewSize(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
-
-