.. | .. |
---|
25 | 25 | |
---|
26 | 26 | public class TimeflowApp extends JFrame |
---|
27 | 27 | { |
---|
28 | | - |
---|
29 | 28 | public TFModel model = new TFModel(); |
---|
30 | 29 | public JFileChooser fileChooser; |
---|
31 | 30 | AboutWindow splash; |
---|
.. | .. |
---|
39 | 38 | LinkTabPane leftPanel; |
---|
40 | 39 | TFListener filterMenuMaker = new TFListener() |
---|
41 | 40 | { |
---|
42 | | - |
---|
43 | 41 | @Override |
---|
44 | 42 | public void note(TFEvent e) |
---|
45 | 43 | { |
---|
.. | .. |
---|
70 | 68 | } |
---|
71 | 69 | }; |
---|
72 | 70 | |
---|
73 | | - void splash(boolean visible) |
---|
| 71 | + public JMenuBar TimeFlowWindow(Container container) throws HeadlessException |
---|
74 | 72 | { |
---|
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 | | - |
---|
102 | 73 | // read example directory |
---|
103 | 74 | String[] ex = getVisibleFiles("settings/examples"); |
---|
104 | 75 | int n = ex.length; |
---|
.. | .. |
---|
115 | 86 | templates = getVisibleFiles("settings/templates"); |
---|
116 | 87 | fileChooser = new JFileChooser(state.getCurrentFile()); |
---|
117 | 88 | |
---|
118 | | - getContentPane().setLayout(new BorderLayout()); |
---|
| 89 | + container.setLayout(new BorderLayout()); |
---|
119 | 90 | |
---|
120 | 91 | // left tab area, with vertical gray divider. |
---|
121 | 92 | JPanel leftHolder = new JPanel(); |
---|
122 | | - getContentPane().add(leftHolder, BorderLayout.WEST); |
---|
| 93 | + container.add(leftHolder, BorderLayout.WEST); |
---|
123 | 94 | |
---|
124 | 95 | leftHolder.setLayout(new BorderLayout()); |
---|
125 | 96 | JPanel pad = new Pad(3, 3); |
---|
.. | .. |
---|
148 | 119 | // center tab area |
---|
149 | 120 | |
---|
150 | 121 | final LinkTabPane center = new LinkTabPane(); |
---|
151 | | - getContentPane().add(center, BorderLayout.CENTER); |
---|
| 122 | + container.add(center, BorderLayout.CENTER); |
---|
152 | 123 | |
---|
153 | 124 | center.addPropertyChangeListener(new PropertyChangeListener() |
---|
154 | 125 | { |
---|
155 | | - |
---|
156 | 126 | @Override |
---|
157 | 127 | public void propertyChange(PropertyChangeEvent evt) |
---|
158 | 128 | { |
---|
.. | .. |
---|
187 | 157 | // but then, once data is loaded, switch directly to the timeline view. |
---|
188 | 158 | model.addListener(new TFListener() |
---|
189 | 159 | { |
---|
190 | | - |
---|
191 | 160 | @Override |
---|
192 | 161 | public void note(TFEvent e) |
---|
193 | 162 | { |
---|
.. | .. |
---|
203 | 172 | }); |
---|
204 | 173 | |
---|
205 | 174 | JMenuBar menubar = new JMenuBar(); |
---|
206 | | - setJMenuBar(menubar); |
---|
| 175 | + |
---|
| 176 | + // frame.setJMenuBar(menubar); |
---|
207 | 177 | |
---|
208 | 178 | JMenu fileMenu = new JMenu("File"); |
---|
209 | 179 | menubar.add(fileMenu); |
---|
.. | .. |
---|
236 | 206 | fileMenu.add(open); |
---|
237 | 207 | open.addActionListener(new ActionListener() |
---|
238 | 208 | { |
---|
239 | | - |
---|
240 | 209 | @Override |
---|
241 | 210 | public void actionPerformed(ActionEvent e) |
---|
242 | 211 | { |
---|
.. | .. |
---|
254 | 223 | fileMenu.add(impDel); |
---|
255 | 224 | impDel.addActionListener(new ActionListener() |
---|
256 | 225 | { |
---|
257 | | - |
---|
258 | 226 | @Override |
---|
259 | 227 | public void actionPerformed(ActionEvent e) |
---|
260 | 228 | { |
---|
.. | .. |
---|
273 | 241 | save.setEnabled(false); |
---|
274 | 242 | save.addActionListener(new ActionListener() |
---|
275 | 243 | { |
---|
276 | | - |
---|
277 | 244 | @Override |
---|
278 | 245 | public void actionPerformed(ActionEvent e) |
---|
279 | 246 | { |
---|
.. | .. |
---|
283 | 250 | }); |
---|
284 | 251 | model.addListener(new TFListener() |
---|
285 | 252 | { |
---|
286 | | - |
---|
287 | 253 | @Override |
---|
288 | 254 | public void note(TFEvent e) |
---|
289 | 255 | { |
---|
.. | .. |
---|
295 | 261 | fileMenu.add(saveAs); |
---|
296 | 262 | saveAs.addActionListener(new ActionListener() |
---|
297 | 263 | { |
---|
298 | | - |
---|
299 | 264 | @Override |
---|
300 | 265 | public void actionPerformed(ActionEvent e) |
---|
301 | 266 | { |
---|
.. | .. |
---|
309 | 274 | fileMenu.add(exportTSV); |
---|
310 | 275 | exportTSV.addActionListener(new ActionListener() |
---|
311 | 276 | { |
---|
312 | | - |
---|
313 | 277 | @Override |
---|
314 | 278 | public void actionPerformed(ActionEvent e) |
---|
315 | 279 | { |
---|
.. | .. |
---|
320 | 284 | fileMenu.add(exportCSV); |
---|
321 | 285 | exportCSV.addActionListener(new ActionListener() |
---|
322 | 286 | { |
---|
323 | | - |
---|
324 | 287 | @Override |
---|
325 | 288 | public void actionPerformed(ActionEvent e) |
---|
326 | 289 | { |
---|
.. | .. |
---|
331 | 294 | fileMenu.add(exportHTML); |
---|
332 | 295 | exportHTML.addActionListener(new ActionListener() |
---|
333 | 296 | { |
---|
334 | | - |
---|
335 | 297 | @Override |
---|
336 | 298 | public void actionPerformed(ActionEvent e) |
---|
337 | 299 | { |
---|
338 | 300 | exportHtml(); |
---|
339 | 301 | } |
---|
340 | 302 | }); |
---|
341 | | - fileMenu.addSeparator(); |
---|
342 | | - fileMenu.add(quitAction); |
---|
| 303 | +// fileMenu.addSeparator(); |
---|
| 304 | +// fileMenu.add(quitAction); |
---|
343 | 305 | |
---|
344 | 306 | JMenu editMenu = new JMenu("Edit"); |
---|
345 | 307 | menubar.add(editMenu); |
---|
.. | .. |
---|
370 | 332 | final String file = examples[i][1]; |
---|
371 | 333 | example.addActionListener(new ActionListener() |
---|
372 | 334 | { |
---|
373 | | - |
---|
374 | 335 | @Override |
---|
375 | 336 | public void actionPerformed(ActionEvent e) |
---|
376 | 337 | { |
---|
.. | .. |
---|
380 | 341 | } |
---|
381 | 342 | |
---|
382 | 343 | JMenu helpMenu = new JMenu("Help"); |
---|
383 | | - menubar.add(helpMenu); |
---|
| 344 | + //menubar.add(helpMenu); |
---|
384 | 345 | |
---|
385 | 346 | helpMenu.add(new WebDocAction(this)); |
---|
386 | 347 | |
---|
.. | .. |
---|
388 | 349 | helpMenu.add(about); |
---|
389 | 350 | about.addActionListener(new ActionListener() |
---|
390 | 351 | { |
---|
391 | | - |
---|
392 | 352 | @Override |
---|
393 | 353 | public void actionPerformed(ActionEvent e) |
---|
394 | 354 | { |
---|
.. | .. |
---|
398 | 358 | |
---|
399 | 359 | model.addListener(new TFListener() |
---|
400 | 360 | { |
---|
401 | | - |
---|
402 | 361 | @Override |
---|
403 | 362 | public void note(TFEvent e) |
---|
404 | 363 | { |
---|
.. | .. |
---|
414 | 373 | } |
---|
415 | 374 | } |
---|
416 | 375 | }); |
---|
| 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); |
---|
417 | 411 | } |
---|
418 | 412 | |
---|
419 | 413 | void makeRecentFileMenu() |
---|