|
@@ -50,7 +50,7 @@ public class MainView {
|
|
|
public MainView( LayeredGraphNode graph )
|
|
|
{
|
|
|
controller = new AnimationController();
|
|
|
- controller.setTimeBetween( 10 );
|
|
|
+ controller.setTimeBetween( 1 );
|
|
|
frame = new JFrame();
|
|
|
frame.setSize( Math.min( (int)graph.getWidth( LayoutType.TOP_BOTTOM_LEFT ) * 2 + 200, 1700 ), Math.min( (int)graph.getHeight( LayoutType.TOP_BOTTOM_LEFT ) * 2 + 200, 900 ) );
|
|
|
frame.setLocation( 100, 100 );
|
|
@@ -131,13 +131,18 @@ public class MainView {
|
|
|
|
|
|
JLayeredPane layne = new JLayeredPane();
|
|
|
JPanel pl = new JPanel();
|
|
|
- pl.setLayout(new GridLayout( 2, 2, 500, 500 ) );
|
|
|
+ GridLayout grout = new GridLayout( 2, 2, 10, 10 );
|
|
|
+ pl.setLayout( grout );
|
|
|
pl.setLocation( 0, 0 );
|
|
|
pl.setSize( frame.getSize() );
|
|
|
- pl.add(createNodeView( graph, LayoutType.TOP_BOTTOM_LEFT ));
|
|
|
- pl.add(createNodeView( graph, LayoutType.TOP_BOTTOM_RIGHT ));
|
|
|
- pl.add(createNodeView( graph, LayoutType.BOTTOM_TOP_LEFT ));
|
|
|
- pl.add(createNodeView( graph, LayoutType.BOTTOM_TOP_RIGHT ));
|
|
|
+ NodeView topLeft = createNodeView( graph, LayoutType.TOP_BOTTOM_LEFT );
|
|
|
+ NodeView topRight = createNodeView( graph, LayoutType.TOP_BOTTOM_RIGHT );
|
|
|
+ NodeView bottomLeft = createNodeView( graph, LayoutType.BOTTOM_TOP_LEFT );
|
|
|
+ NodeView bottomRight = createNodeView( graph, LayoutType.BOTTOM_TOP_RIGHT );
|
|
|
+ pl.add( topLeft );
|
|
|
+ pl.add( topRight );
|
|
|
+ pl.add( bottomLeft );
|
|
|
+ pl.add( bottomRight );
|
|
|
layne.add( pl, 1 );
|
|
|
NodeView combined = createNodeView( graph, LayoutType.COMBINED );
|
|
|
combined.setSize( 500, 500 );
|
|
@@ -150,7 +155,20 @@ public class MainView {
|
|
|
{
|
|
|
public void componentResized(ComponentEvent evt) {
|
|
|
pl.setSize( layne.getSize() );
|
|
|
- combined.setLocation( layne.getWidth() / 2 - combined.getWidth() / 2, layne.getHeight() / 2 - combined.getHeight() / 2 );
|
|
|
+ if( graph.getColor( LayoutType.COMBINED ) == null )
|
|
|
+ {
|
|
|
+ grout.setHgap( 10 );
|
|
|
+ grout.setVgap( 10 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ grout.setHgap( layne.getWidth() / 3 );
|
|
|
+ grout.setVgap( layne.getHeight() / 3 );
|
|
|
+ }
|
|
|
+ combined.setSize( layne.getWidth() / 3, layne.getHeight() / 3 );
|
|
|
+ combined.setLocation( layne.getWidth() / 3, layne.getHeight() / 3 );
|
|
|
+ frame.validate();
|
|
|
+ frame.repaint();
|
|
|
}
|
|
|
});
|
|
|
new BKNodePlacement( controller, graph );
|