|
@@ -75,11 +75,13 @@ public class MainView {
|
|
private JButton load;
|
|
private JButton load;
|
|
private JButton save;
|
|
private JButton save;
|
|
private JButton debug;
|
|
private JButton debug;
|
|
|
|
+ private JButton options;
|
|
private JButton randomGraph;
|
|
private JButton randomGraph;
|
|
private JLabel delayText;
|
|
private JLabel delayText;
|
|
private JTextField delay;
|
|
private JTextField delay;
|
|
private JTree pseudoTree;
|
|
private JTree pseudoTree;
|
|
private LayeredGraphNode graph;
|
|
private LayeredGraphNode graph;
|
|
|
|
+ private OptionsDialog optionsDialog;
|
|
|
|
|
|
private String debugInfo()
|
|
private String debugInfo()
|
|
{
|
|
{
|
|
@@ -234,6 +236,18 @@ public class MainView {
|
|
controller.setNextAction( Action.BACKWARD );
|
|
controller.setNextAction( Action.BACKWARD );
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ });
|
|
|
|
+ options = new NiceButton( "options" );
|
|
|
|
+ options.setLocation( 210, 60 );
|
|
|
|
+ options.setMnemonic( KeyEvent.VK_O );
|
|
|
|
+ options.setToolTipText( "Show Options Dialog (alt + o)" );
|
|
|
|
+ options.addActionListener( new ActionListener() {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
|
+ optionsDialog.setVisible( true );
|
|
|
|
+ }
|
|
|
|
+
|
|
});
|
|
});
|
|
stepBackward = new NiceButton( "stepBackward" );
|
|
stepBackward = new NiceButton( "stepBackward" );
|
|
stepBackward.setLocation( 10, 60 );
|
|
stepBackward.setLocation( 10, 60 );
|
|
@@ -353,7 +367,7 @@ public class MainView {
|
|
|
|
|
|
});
|
|
});
|
|
load = new NiceButton( "load" );
|
|
load = new NiceButton( "load" );
|
|
- load.setLocation( 230, 60 );
|
|
|
|
|
|
+ load.setLocation( 260, 60 );
|
|
load.setMnemonic( KeyEvent.VK_L );
|
|
load.setMnemonic( KeyEvent.VK_L );
|
|
load.setToolTipText( "Load a graph (alt + l)" );
|
|
load.setToolTipText( "Load a graph (alt + l)" );
|
|
load.addActionListener( new ActionListener() {
|
|
load.addActionListener( new ActionListener() {
|
|
@@ -375,7 +389,7 @@ public class MainView {
|
|
|
|
|
|
});
|
|
});
|
|
save = new NiceButton( "save" );
|
|
save = new NiceButton( "save" );
|
|
- save.setLocation( 295, 60 );
|
|
|
|
|
|
+ save.setLocation( 310, 60 );
|
|
save.setMnemonic( KeyEvent.VK_S );
|
|
save.setMnemonic( KeyEvent.VK_S );
|
|
save.setToolTipText( "Save graph (alt + s)" );
|
|
save.setToolTipText( "Save graph (alt + s)" );
|
|
save.addActionListener( new ActionListener() {
|
|
save.addActionListener( new ActionListener() {
|
|
@@ -457,6 +471,8 @@ public class MainView {
|
|
combined.setSize( 500, 500 );
|
|
combined.setSize( 500, 500 );
|
|
layne.add( combined, 0 );
|
|
layne.add( combined, 0 );
|
|
frame.add( layne );
|
|
frame.add( layne );
|
|
|
|
+ //JPanel onlyCurrentLayout = new JPanel();
|
|
|
|
+ //onlyCurrentLayout.setLayout( new BorderLayout() );
|
|
JPanel menue = new JPanel();
|
|
JPanel menue = new JPanel();
|
|
menue.setLayout( null );
|
|
menue.setLayout( null );
|
|
menue.setPreferredSize( new Dimension( 410, 500 ) );
|
|
menue.setPreferredSize( new Dimension( 410, 500 ) );
|
|
@@ -476,6 +492,7 @@ public class MainView {
|
|
menue.add( randomGraph );
|
|
menue.add( randomGraph );
|
|
menue.add( save );
|
|
menue.add( save );
|
|
menue.add( load );
|
|
menue.add( load );
|
|
|
|
+ menue.add( options );
|
|
menue.add( debugView );
|
|
menue.add( debugView );
|
|
frame.add( menue, BorderLayout.EAST );
|
|
frame.add( menue, BorderLayout.EAST );
|
|
frame.setSize( frame.getWidth() + 1, frame.getHeight() );
|
|
frame.setSize( frame.getWidth() + 1, frame.getHeight() );
|
|
@@ -506,9 +523,95 @@ public class MainView {
|
|
debugText.setText( algorithm.getDebugString().trim() );
|
|
debugText.setText( algorithm.getDebugString().trim() );
|
|
layne.remove( pl );
|
|
layne.remove( pl );
|
|
layne.add( pl, 1 );
|
|
layne.add( pl, 1 );
|
|
|
|
+ if( optionsDialog != null && optionsDialog.getLayerDisplayOption() == 1 )
|
|
|
|
+ {
|
|
|
|
+ pl.remove( topLeft );
|
|
|
|
+ pl.remove( topRight );
|
|
|
|
+ pl.remove( bottomLeft );
|
|
|
|
+ pl.remove( bottomRight );
|
|
|
|
+ pl.remove( combined );
|
|
|
|
+ switch( algorithm.getAlgorithmState() )
|
|
|
|
+ {
|
|
|
|
+ case CONFLICTS:
|
|
|
|
+ pl.add( topLeft );
|
|
|
|
+ break;
|
|
|
|
+ case LAYOUT1:
|
|
|
|
+ pl.add( topLeft );
|
|
|
|
+ break;
|
|
|
|
+ case LAYOUT2:
|
|
|
|
+ pl.add( topRight );
|
|
|
|
+ break;
|
|
|
|
+ case LAYOUT3:
|
|
|
|
+ pl.add( bottomLeft );
|
|
|
|
+ break;
|
|
|
|
+ case LAYOUT4:
|
|
|
|
+ pl.add( bottomRight );
|
|
|
|
+ break;
|
|
|
|
+ case COMBINE:
|
|
|
|
+ pl.add( combined );
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ pl.revalidate();
|
|
|
|
+ }
|
|
frame.repaint();
|
|
frame.repaint();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ optionsDialog = new OptionsDialog();
|
|
|
|
+ optionsDialog.addActionListener( new ActionListener() {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
|
+ if( optionsDialog.getLayerDisplayOption() == 0 )
|
|
|
|
+ {
|
|
|
|
+ pl.remove( topLeft );
|
|
|
|
+ pl.remove( topRight );
|
|
|
|
+ pl.remove( bottomLeft );
|
|
|
|
+ pl.remove( bottomRight );
|
|
|
|
+ pl.remove( combined );
|
|
|
|
+ pl.setLayout( grout );
|
|
|
|
+ pl.add( topLeft );
|
|
|
|
+ pl.add( topRight );
|
|
|
|
+ pl.add( bottomLeft );
|
|
|
|
+ pl.add( bottomRight );
|
|
|
|
+ layne.add( combined, 0 );
|
|
|
|
+ pl.revalidate();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ pl.remove( topLeft );
|
|
|
|
+ pl.remove( topRight );
|
|
|
|
+ pl.remove( bottomLeft );
|
|
|
|
+ pl.remove( bottomRight );
|
|
|
|
+ layne.remove( combined );
|
|
|
|
+ pl.setLayout( new BorderLayout() );
|
|
|
|
+ switch( algorithm.getAlgorithmState() )
|
|
|
|
+ {
|
|
|
|
+ case CONFLICTS:
|
|
|
|
+ pl.add( topLeft );
|
|
|
|
+ break;
|
|
|
|
+ case LAYOUT1:
|
|
|
|
+ pl.add( topLeft );
|
|
|
|
+ break;
|
|
|
|
+ case LAYOUT2:
|
|
|
|
+ pl.add( topRight );
|
|
|
|
+ break;
|
|
|
|
+ case LAYOUT3:
|
|
|
|
+ pl.add( bottomLeft );
|
|
|
|
+ break;
|
|
|
|
+ case LAYOUT4:
|
|
|
|
+ pl.add( bottomRight );
|
|
|
|
+ break;
|
|
|
|
+ case COMBINE:
|
|
|
|
+ pl.add( combined );
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ pl.revalidate();
|
|
|
|
+ }
|
|
|
|
+ frame.repaint();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
|
|
algorithm.start();
|
|
algorithm.start();
|
|
}
|
|
}
|