/** * Creates a new layout instance from a Class Object. * * @param layout The Class object to create the instance of. * @return A new instance of the Layout. */ protected static Layout getLayoutInstance(Class<? extends AbstractLayout> layout) { return GraphVisualizer.getLayoutInstance(layout, new UndirectedSparseGraph()); }
/** * Sets a new Layout for the graph. * * @param layout A Class object containing the Layout to be used. */ public void setGraphLayout(Class<? extends AbstractLayout> layout) { this.setGraphLayout((Layout<V, E>) GraphVisualizer.getLayoutInstance(layout, this.graph)); }
/** * Constructs a GraphVisualizer Object. * * @param layout A Class object of the type of class to use for the graph layout. * @param size The initial size of the GraphVisualizer Object. */ public GraphVisualizer(Class<? extends AbstractLayout> layout, Dimension size) { super(GraphVisualizer.getLayoutInstance(layout), size); this.setup(); }