Normand Briere
2018-07-08 f4160780a4d8278920b99ada1050f320d6e30a73
timeflow/app/TimeflowApp.java
....@@ -25,7 +25,6 @@
2525
2626 public class TimeflowApp extends JFrame
2727 {
28
-
2928 public TFModel model = new TFModel();
3029 public JFileChooser fileChooser;
3130 AboutWindow splash;
....@@ -39,7 +38,6 @@
3938 LinkTabPane leftPanel;
4039 TFListener filterMenuMaker = new TFListener()
4140 {
42
-
4341 @Override
4442 public void note(TFEvent e)
4543 {
....@@ -70,35 +68,8 @@
7068 }
7169 };
7270
73
- void splash(boolean visible)
71
+ public JMenuBar TimeFlowWindow(Container container) throws HeadlessException
7472 {
75
- splash.setVisible(visible);
76
- }
77
-
78
- public void init() throws Exception
79
- {
80
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
81
- setBounds(0, 0, Math.min(d.width, 1200), Math.min(d.height, 900));
82
- setTitle(Display.version());
83
- setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
84
- final QuitAction quitAction = new QuitAction(this, model);
85
- addWindowListener(new WindowAdapter()
86
- {
87
-
88
- @Override
89
- public void windowClosing(WindowEvent e)
90
- {
91
- quitAction.quit();
92
- }
93
-
94
- public void windowStateChanged(WindowEvent e)
95
- {
96
- repaint();
97
- }
98
- });
99
- Image icon = Toolkit.getDefaultToolkit().getImage("images/icon.gif");
100
- setIconImage(icon);
101
-
10273 // read example directory
10374 String[] ex = getVisibleFiles("settings/examples");
10475 int n = ex.length;
....@@ -115,11 +86,11 @@
11586 templates = getVisibleFiles("settings/templates");
11687 fileChooser = new JFileChooser(state.getCurrentFile());
11788
118
- getContentPane().setLayout(new BorderLayout());
89
+ container.setLayout(new BorderLayout());
11990
12091 // left tab area, with vertical gray divider.
12192 JPanel leftHolder = new JPanel();
122
- getContentPane().add(leftHolder, BorderLayout.WEST);
93
+ container.add(leftHolder, BorderLayout.WEST);
12394
12495 leftHolder.setLayout(new BorderLayout());
12596 JPanel pad = new Pad(3, 3);
....@@ -148,11 +119,10 @@
148119 // center tab area
149120
150121 final LinkTabPane center = new LinkTabPane();
151
- getContentPane().add(center, BorderLayout.CENTER);
122
+ container.add(center, BorderLayout.CENTER);
152123
153124 center.addPropertyChangeListener(new PropertyChangeListener()
154125 {
155
-
156126 @Override
157127 public void propertyChange(PropertyChangeEvent evt)
158128 {
....@@ -187,7 +157,6 @@
187157 // but then, once data is loaded, switch directly to the timeline view.
188158 model.addListener(new TFListener()
189159 {
190
-
191160 @Override
192161 public void note(TFEvent e)
193162 {
....@@ -203,7 +172,8 @@
203172 });
204173
205174 JMenuBar menubar = new JMenuBar();
206
- setJMenuBar(menubar);
175
+
176
+ // frame.setJMenuBar(menubar);
207177
208178 JMenu fileMenu = new JMenu("File");
209179 menubar.add(fileMenu);
....@@ -236,7 +206,6 @@
236206 fileMenu.add(open);
237207 open.addActionListener(new ActionListener()
238208 {
239
-
240209 @Override
241210 public void actionPerformed(ActionEvent e)
242211 {
....@@ -254,7 +223,6 @@
254223 fileMenu.add(impDel);
255224 impDel.addActionListener(new ActionListener()
256225 {
257
-
258226 @Override
259227 public void actionPerformed(ActionEvent e)
260228 {
....@@ -273,7 +241,6 @@
273241 save.setEnabled(false);
274242 save.addActionListener(new ActionListener()
275243 {
276
-
277244 @Override
278245 public void actionPerformed(ActionEvent e)
279246 {
....@@ -283,7 +250,6 @@
283250 });
284251 model.addListener(new TFListener()
285252 {
286
-
287253 @Override
288254 public void note(TFEvent e)
289255 {
....@@ -295,7 +261,6 @@
295261 fileMenu.add(saveAs);
296262 saveAs.addActionListener(new ActionListener()
297263 {
298
-
299264 @Override
300265 public void actionPerformed(ActionEvent e)
301266 {
....@@ -309,7 +274,6 @@
309274 fileMenu.add(exportTSV);
310275 exportTSV.addActionListener(new ActionListener()
311276 {
312
-
313277 @Override
314278 public void actionPerformed(ActionEvent e)
315279 {
....@@ -320,7 +284,6 @@
320284 fileMenu.add(exportCSV);
321285 exportCSV.addActionListener(new ActionListener()
322286 {
323
-
324287 @Override
325288 public void actionPerformed(ActionEvent e)
326289 {
....@@ -331,15 +294,14 @@
331294 fileMenu.add(exportHTML);
332295 exportHTML.addActionListener(new ActionListener()
333296 {
334
-
335297 @Override
336298 public void actionPerformed(ActionEvent e)
337299 {
338300 exportHtml();
339301 }
340302 });
341
- fileMenu.addSeparator();
342
- fileMenu.add(quitAction);
303
+// fileMenu.addSeparator();
304
+// fileMenu.add(quitAction);
343305
344306 JMenu editMenu = new JMenu("Edit");
345307 menubar.add(editMenu);
....@@ -370,7 +332,6 @@
370332 final String file = examples[i][1];
371333 example.addActionListener(new ActionListener()
372334 {
373
-
374335 @Override
375336 public void actionPerformed(ActionEvent e)
376337 {
....@@ -380,7 +341,7 @@
380341 }
381342
382343 JMenu helpMenu = new JMenu("Help");
383
- menubar.add(helpMenu);
344
+ //menubar.add(helpMenu);
384345
385346 helpMenu.add(new WebDocAction(this));
386347
....@@ -388,7 +349,6 @@
388349 helpMenu.add(about);
389350 about.addActionListener(new ActionListener()
390351 {
391
-
392352 @Override
393353 public void actionPerformed(ActionEvent e)
394354 {
....@@ -398,7 +358,6 @@
398358
399359 model.addListener(new TFListener()
400360 {
401
-
402361 @Override
403362 public void note(TFEvent e)
404363 {
....@@ -414,6 +373,41 @@
414373 }
415374 }
416375 });
376
+
377
+ return menubar;
378
+ }
379
+
380
+ void splash(boolean visible)
381
+ {
382
+ splash.setVisible(visible);
383
+ }
384
+
385
+ public void init() throws Exception
386
+ {
387
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
388
+ setBounds(0, 0, Math.min(d.width, 1200), Math.min(d.height, 900));
389
+ setTitle(Display.version());
390
+ setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
391
+// final QuitAction quitAction = new QuitAction(this, model);
392
+// addWindowListener(new WindowAdapter()
393
+// {
394
+// @Override
395
+// public void windowClosing(WindowEvent e)
396
+// {
397
+// quitAction.quit();
398
+// }
399
+//
400
+// public void windowStateChanged(WindowEvent e)
401
+// {
402
+// repaint();
403
+// }
404
+// });
405
+ Image icon = Toolkit.getDefaultToolkit().getImage("images/icon.gif");
406
+ setIconImage(icon);
407
+
408
+ Container container = getContentPane();
409
+
410
+ TimeFlowWindow(container);
417411 }
418412
419413 void makeRecentFileMenu()