diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-05-20 17:58:16 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-05-20 17:58:16 -0400 |
| commit | 40a9d99496e098562f090fb7ffce9e749011b131 (patch) | |
| tree | 437df24d65470582e943e494a52db8ed65a881ae /projects/net.wotonomy.test/src/main/java/net/wotonomy/test/Test.java | |
| parent | ff072dfe782f6f22123cd4ba050828d35c0d0fbd (diff) | |
Formatting pass
Diffstat (limited to 'projects/net.wotonomy.test/src/main/java/net/wotonomy/test/Test.java')
| -rw-r--r-- | projects/net.wotonomy.test/src/main/java/net/wotonomy/test/Test.java | 150 |
1 files changed, 69 insertions, 81 deletions
diff --git a/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/Test.java b/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/Test.java index ba6a1dc..5b4533d 100644 --- a/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/Test.java +++ b/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/Test.java @@ -18,103 +18,91 @@ import net.wotonomy.control.EOEditingContext; import net.wotonomy.control.EOObjectStore; /** -* A simple test-bed for wotonomy. -* Shows a JFrame containing the TestPanel -* which is controlled by the TestController. -*/ -public class Test -{ - static EOObjectStore objectStore; - static EOEditingContext editingContext; - static public void main( String[] argv ) - { + * A simple test-bed for wotonomy. Shows a JFrame containing the TestPanel which + * is controlled by the TestController. + */ +public class Test { + static EOObjectStore objectStore; + static EOEditingContext editingContext; + + static public void main(String[] argv) { // NSRunLoop.currentRunLoop(); - - // system l&f - try - { + + // system l&f + try { // UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); - UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - } - catch (Exception e) - { + } catch (Exception e) { // no system l&f - fail silently - } - - // launch notification monitor if desired - for ( int i = 0; i < argv.length; i++ ) - { - if ( argv[i].indexOf( "monitor" ) != -1 ) - { - new net.wotonomy.ui.swing.NotificationInspector(); - } - } - new net.wotonomy.ui.swing.NotificationInspector(); - - // set up editing context hierarchy - objectStore = new DataObjectStore( "data" ); - editingContext = new EOEditingContext( objectStore ); + } + + // launch notification monitor if desired + for (int i = 0; i < argv.length; i++) { + if (argv[i].indexOf("monitor") != -1) { + new net.wotonomy.ui.swing.NotificationInspector(); + } + } + new net.wotonomy.ui.swing.NotificationInspector(); + + // set up editing context hierarchy + objectStore = new DataObjectStore("data"); + editingContext = new EOEditingContext(objectStore); // connect panel to controller - TestPanel testPanel = new TestPanel(); - final TestController controller = new TestController( testPanel ); - + TestPanel testPanel = new TestPanel(); + final TestController controller = new TestController(testPanel); + // create frame and show - JFrame frame = new JFrame(); - frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); - + JFrame frame = new JFrame(); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + // setup menus JMenu menu; - JMenuItem menuItem; + JMenuItem menuItem; JMenuBar menuBar = new JMenuBar(); - menu = new JMenu( "File" ); - menu.add( "New" ); - menuItem = new JMenuItem( "Save" ); - menuItem.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_S, KeyEvent.CTRL_MASK ) ); - menuItem.addActionListener( new ActionListener() - { - public void actionPerformed( ActionEvent evt ) - { - controller.displayGroup.dataSource().editingContext().saveChanges(); - } - }); - - menu.add( menuItem ); - menu.add( "Close" ); - menuBar.add( menu ); - menu = new JMenu( "Edit" ); - menu.add( "Cut" ); - menu.add( "Copy" ); - menu.add( "Paste" ); - menuBar.add( menu ); - frame.setJMenuBar( menuBar ); - - frame.getContentPane().add( testPanel, BorderLayout.CENTER ); - frame.setTitle( "Test Frame" ); - frame.setBounds( 50, 50, 750, 500 ); + menu = new JMenu("File"); + menu.add("New"); + menuItem = new JMenuItem("Save"); + menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK)); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + controller.displayGroup.dataSource().editingContext().saveChanges(); + } + }); + + menu.add(menuItem); + menu.add("Close"); + menuBar.add(menu); + menu = new JMenu("Edit"); + menu.add("Cut"); + menu.add("Copy"); + menu.add("Paste"); + menuBar.add(menu); + frame.setJMenuBar(menuBar); + + frame.getContentPane().add(testPanel, BorderLayout.CENTER); + frame.setTitle("Test Frame"); + frame.setBounds(50, 50, 750, 500); frame.show(); // comment out this to avoid memory leak from jdk1.2.2 bug // add WindowListener for frame - frame.addWindowListener( new WindowAdapter() - { + frame.addWindowListener(new WindowAdapter() { // exit on close - public void windowClosing(WindowEvent e) - { - System.exit( 0 ); + public void windowClosing(WindowEvent e) { + System.exit(0); } }); - /* uncomment this to avoid memory leak from jdk1.2.2 bug - frame.getContentPane().removeAll(); - */ -/* - NSNotificationCenter.defaultCenter().addObserver( - frame, - new NSSelector( "hitMe", new Class[] { NSNotification.class } ), - null, null ); -*/ - } - + /* + * uncomment this to avoid memory leak from jdk1.2.2 bug + * frame.getContentPane().removeAll(); + */ + /* + * NSNotificationCenter.defaultCenter().addObserver( frame, new NSSelector( + * "hitMe", new Class[] { NSNotification.class } ), null, null ); + */ + } + } |
