Skip to content

Commit 85b8ad7

Browse files
committed
Additional constructors to set the automatic layout strategy.
1 parent b3ef832 commit 85b8ad7

1 file changed

Lines changed: 37 additions & 17 deletions

File tree

src/main/java/com/brunomnsilva/smartgraph/graphview/SmartGraphPanel.java

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ public class SmartGraphPanel<V, E> extends Pane {
111111

112112
/**
113113
* Constructs a visualization of the graph referenced by
114-
* <code>theGraph</code>, using default properties, default random
115-
* placement of vertices and default automatic layout strategy.
114+
* <code>theGraph</code>, using default properties, default circular
115+
* placement of vertices, default automatic spring gravity layout strategy
116+
* and styling from smartgraph.css.
116117
*
117118
* @param theGraph underlying graph
118119
*
@@ -129,8 +130,8 @@ public SmartGraphPanel(Graph<V, E> theGraph) {
129130

130131
/**
131132
* Constructs a visualization of the graph referenced by
132-
* <code>theGraph</code>, using default properties, default random
133-
* placement of vertices.
133+
* <code>theGraph</code>, using default properties, default circular
134+
* placement of vertices and styling from smartgraph.css.
134135
*
135136
* @param theGraph underlying graph
136137
* @param layoutStrategy the automatic layout strategy
@@ -147,8 +148,8 @@ public SmartGraphPanel(Graph<V, E> theGraph, ForceDirectedLayoutStrategy<V> layo
147148

148149
/**
149150
* Constructs a visualization of the graph referenced by
150-
* <code>theGraph</code>, using custom properties and default random
151-
* placement of vertices.
151+
* <code>theGraph</code>, using custom properties, default automatic spring gravity layout strategy
152+
* and styling from smartgraph.css.
152153
*
153154
* @param theGraph underlying graph
154155
* @param properties custom properties
@@ -164,25 +165,45 @@ public SmartGraphPanel(Graph<V, E> theGraph, SmartGraphProperties properties) {
164165

165166
/**
166167
* Constructs a visualization of the graph referenced by
167-
* <code>theGraph</code>, using default properties and custom placement of
168-
* vertices.
168+
* <code>theGraph</code>, using default properties and styling from smartgraph.css.
169169
*
170170
* @param theGraph underlying graph
171-
* @param placementStrategy placement strategy, null for default
171+
* @param placementStrategy placement strategy
172+
* @param layoutStrategy the automatic layout strategy
172173
*/
173-
public SmartGraphPanel(Graph<V, E> theGraph, SmartPlacementStrategy placementStrategy) {
174+
public SmartGraphPanel(Graph<V, E> theGraph, SmartPlacementStrategy placementStrategy,
175+
ForceDirectedLayoutStrategy<V> layoutStrategy) {
174176
this(theGraph,
175177
new SmartGraphProperties(),
176178
placementStrategy,
177179
null,
178-
new ForceDirectedSpringGravityLayoutStrategy<>()
180+
layoutStrategy
181+
);
182+
}
183+
184+
/**
185+
* Constructs a visualization of the graph referenced by
186+
* <code>theGraph</code>, using custom placement of
187+
* vertices, default properties, default automatic spring gravity layout strategy
188+
* and styling from smartgraph.css.
189+
*
190+
* @param theGraph underlying graph
191+
* @param placementStrategy placement strategy, null for default
192+
*/
193+
public SmartGraphPanel(Graph<V, E> theGraph, SmartPlacementStrategy placementStrategy) {
194+
this(theGraph,
195+
new SmartGraphProperties(),
196+
placementStrategy,
197+
null,
198+
new ForceDirectedSpringGravityLayoutStrategy<>()
179199
);
180200
}
181201

182202
/**
183203
* Constructs a visualization of the graph referenced by
184204
* <code>theGraph</code>, using custom properties and custom placement of
185-
* vertices.
205+
* vertices, default automatic spring gravity layout strategy
206+
* and styling from smartgraph.css.
186207
*
187208
* @param theGraph underlying graph
188209
* @param properties custom properties, null for default
@@ -201,8 +222,8 @@ public SmartGraphPanel(Graph<V, E> theGraph, SmartGraphProperties properties,
201222

202223
/**
203224
* Constructs a visualization of the graph referenced by
204-
* <code>theGraph</code>, using custom properties and custom placement of
205-
* vertices.
225+
* <code>theGraph</code>, using custom properties, custom placement of
226+
* vertices and default automatic spring gravity layout strategy.
206227
*
207228
* @param theGraph underlying graph
208229
* @param properties custom properties, null for default
@@ -222,8 +243,7 @@ public SmartGraphPanel(Graph<V, E> theGraph, SmartGraphProperties properties,
222243

223244
/**
224245
* Constructs a visualization of the graph referenced by
225-
* <code>theGraph</code>, using custom properties and custom placement of
226-
* vertices.
246+
* <code>theGraph</code>, using custom parameters.
227247
*
228248
* @param theGraph underlying graph
229249
* @param properties custom properties, null for default
@@ -942,7 +962,7 @@ private Collection<Edge<E, V>> unplottedEdges() {
942962

943963
/**
944964
* Sets a vertex position (its center) manually.
945-
*
965+
* <br/>
946966
* The positioning should be inside the boundaries of the panel, but
947967
* no restrictions are enforced by this method, so be aware.
948968
*

0 commit comments

Comments
 (0)