|
@@ -1,7 +1,6 @@
|
|
package view;
|
|
package view;
|
|
|
|
|
|
import java.awt.BorderLayout;
|
|
import java.awt.BorderLayout;
|
|
-import java.awt.Color;
|
|
|
|
import java.awt.Dimension;
|
|
import java.awt.Dimension;
|
|
import java.awt.Font;
|
|
import java.awt.Font;
|
|
import java.awt.GridLayout;
|
|
import java.awt.GridLayout;
|
|
@@ -9,6 +8,7 @@ import java.awt.event.ActionEvent;
|
|
import java.awt.event.ActionListener;
|
|
import java.awt.event.ActionListener;
|
|
import java.awt.event.ComponentAdapter;
|
|
import java.awt.event.ComponentAdapter;
|
|
import java.awt.event.ComponentEvent;
|
|
import java.awt.event.ComponentEvent;
|
|
|
|
+import java.awt.event.ComponentListener;
|
|
import java.awt.event.KeyEvent;
|
|
import java.awt.event.KeyEvent;
|
|
import java.awt.event.MouseAdapter;
|
|
import java.awt.event.MouseAdapter;
|
|
import java.awt.event.MouseEvent;
|
|
import java.awt.event.MouseEvent;
|
|
@@ -29,8 +29,6 @@ import javax.swing.JSplitPane;
|
|
import javax.swing.JTextArea;
|
|
import javax.swing.JTextArea;
|
|
import javax.swing.JTextField;
|
|
import javax.swing.JTextField;
|
|
import javax.swing.JTree;
|
|
import javax.swing.JTree;
|
|
-import javax.swing.event.DocumentEvent;
|
|
|
|
-import javax.swing.event.DocumentListener;
|
|
|
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
|
import javax.swing.tree.DefaultTreeModel;
|
|
import javax.swing.tree.DefaultTreeModel;
|
|
import javax.swing.tree.TreePath;
|
|
import javax.swing.tree.TreePath;
|
|
@@ -163,6 +161,7 @@ public class MainView {
|
|
*/
|
|
*/
|
|
public MainView( LayeredGraphNode graph )
|
|
public MainView( LayeredGraphNode graph )
|
|
{
|
|
{
|
|
|
|
+ RenderHelper.font = new Font("Monospaced", Font.PLAIN, 12);
|
|
graph.setColor( null, null );
|
|
graph.setColor( null, null );
|
|
frameCounter++;
|
|
frameCounter++;
|
|
this.graph = graph;
|
|
this.graph = graph;
|
|
@@ -335,45 +334,12 @@ public class MainView {
|
|
delayText.setBounds( 260, 10, 80, 20 );
|
|
delayText.setBounds( 260, 10, 80, 20 );
|
|
delay = new JTextField( String.valueOf(AnimationController.DEFAULT_DELAY) );
|
|
delay = new JTextField( String.valueOf(AnimationController.DEFAULT_DELAY) );
|
|
delay.setBounds( 260, 30, 90, 20 );
|
|
delay.setBounds( 260, 30, 90, 20 );
|
|
- delay.getDocument().addDocumentListener( new DocumentListener() {
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void insertUpdate(DocumentEvent e) {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- controller.setDelay( Integer.parseInt( delay.getText() ) );
|
|
|
|
- delay.setBackground( Color.WHITE );
|
|
|
|
- } catch( Exception e1 )
|
|
|
|
- {
|
|
|
|
- delay.setBackground( Color.RED );
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void removeUpdate(DocumentEvent e) {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- controller.setDelay( Integer.parseInt( delay.getText() ) );
|
|
|
|
- delay.setBackground( Color.WHITE );
|
|
|
|
- } catch( Exception e1 )
|
|
|
|
- {
|
|
|
|
- delay.setBackground( Color.RED );
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ delay.getDocument().addDocumentListener( new NumberDocumentListener( new NumberDocumentListener.Action() {
|
|
@Override
|
|
@Override
|
|
- public void changedUpdate(DocumentEvent e) {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- controller.setDelay( Integer.parseInt( delay.getText() ) );
|
|
|
|
- delay.setBackground( Color.WHITE );
|
|
|
|
- } catch( Exception e1 )
|
|
|
|
- {
|
|
|
|
- delay.setBackground( Color.RED );
|
|
|
|
- }
|
|
|
|
|
|
+ public void action(int val) {
|
|
|
|
+ controller.setDelay( Integer.parseInt( delay.getText() ) );
|
|
}
|
|
}
|
|
-
|
|
|
|
- });
|
|
|
|
|
|
+ }, delay ) );
|
|
load = new NiceButton( "load" );
|
|
load = new NiceButton( "load" );
|
|
load.setLocation( 260, 60 );
|
|
load.setLocation( 260, 60 );
|
|
load.setMnemonic( KeyEvent.VK_L );
|
|
load.setMnemonic( KeyEvent.VK_L );
|
|
@@ -552,7 +518,7 @@ public class MainView {
|
|
treeView.setBounds( 10, 110, 390, 380 );
|
|
treeView.setBounds( 10, 110, 390, 380 );
|
|
|
|
|
|
JTextArea debugText = new JTextArea();
|
|
JTextArea debugText = new JTextArea();
|
|
- debugText.setFont( new Font( "Monospaced", Font.PLAIN, 12 ) );
|
|
|
|
|
|
+ debugText.setFont( RenderHelper.font );
|
|
debugText.setEditable( false );
|
|
debugText.setEditable( false );
|
|
debugText.setBackground( RenderHelper.BACKGROUND_COLOR );
|
|
debugText.setBackground( RenderHelper.BACKGROUND_COLOR );
|
|
debugText.setForeground( RenderHelper.FOREGROUND_COLOR );
|
|
debugText.setForeground( RenderHelper.FOREGROUND_COLOR );
|
|
@@ -705,50 +671,13 @@ public class MainView {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
- pl.remove( topLeft );
|
|
|
|
- pl.remove( topRight );
|
|
|
|
- pl.remove( bottomLeft );
|
|
|
|
- pl.remove( bottomRight );
|
|
|
|
- pl.remove( combined );
|
|
|
|
- layne.remove( combined );
|
|
|
|
controller.setStepOption( optionsDialog.getRunStepsOption() );
|
|
controller.setStepOption( optionsDialog.getRunStepsOption() );
|
|
- if( optionsDialog.getLayerDisplayOption() == 0 )
|
|
|
|
- {
|
|
|
|
- pl.setLayout( grout );
|
|
|
|
- pl.add( topLeft );
|
|
|
|
- pl.add( topRight );
|
|
|
|
- pl.add( bottomLeft );
|
|
|
|
- pl.add( bottomRight );
|
|
|
|
- layne.add( combined, 0 );
|
|
|
|
- pl.revalidate();
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- 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();
|
|
|
|
|
|
+ RenderHelper.font = new Font( "Monospaced", Font.PLAIN, optionsDialog.getFontSize() );
|
|
|
|
+ debugText.setFont( RenderHelper.font );
|
|
|
|
+ pseudoTree.setFont( RenderHelper.font );
|
|
|
|
+ pseudoTree.setRowHeight( (int)(15.0/12 * optionsDialog.getFontSize() ) );
|
|
|
|
+ for( ComponentListener l : frame.getComponentListeners() )
|
|
|
|
+ l.componentResized( new ComponentEvent( frame, 0 ) );
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
});
|