source: AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java@ 639

Last change on this file since 639 was 639, checked in by alloc, 12 years ago

AEI2 0.96:

  • Added submitter to contents pane
  • Added jump-to-mod by keypress in table
File size: 21.2 KB
Line 
1package net.oni2.aeinstaller.gui;
2
3import java.awt.BorderLayout;
4import java.awt.Desktop;
5import java.awt.GridLayout;
6import java.awt.event.ActionEvent;
7import java.awt.event.ItemEvent;
8import java.awt.event.ItemListener;
9import java.io.File;
10import java.net.URL;
11import java.util.Date;
12import java.util.HashMap;
13import java.util.HashSet;
14import java.util.ResourceBundle;
15import java.util.TreeMap;
16import java.util.TreeSet;
17import java.util.Vector;
18
19import javax.swing.AbstractAction;
20import javax.swing.Icon;
21import javax.swing.ImageIcon;
22import javax.swing.JButton;
23import javax.swing.JCheckBox;
24import javax.swing.JComboBox;
25import javax.swing.JFileChooser;
26import javax.swing.JFrame;
27import javax.swing.JLabel;
28import javax.swing.JMenu;
29import javax.swing.JMenuItem;
30import javax.swing.JOptionPane;
31import javax.swing.JPanel;
32import javax.swing.JRadioButton;
33import javax.swing.JSplitPane;
34import javax.swing.SwingUtilities;
35import javax.swing.ToolTipManager;
36import javax.swing.filechooser.FileFilter;
37
38import net.oni2.aeinstaller.AEInstaller2;
39import net.oni2.aeinstaller.backend.AppExecution;
40import net.oni2.aeinstaller.backend.Paths;
41import net.oni2.aeinstaller.backend.Settings;
42import net.oni2.aeinstaller.backend.Settings.Platform;
43import net.oni2.aeinstaller.backend.SizeFormatter;
44import net.oni2.aeinstaller.backend.depot.DepotManager;
45import net.oni2.aeinstaller.backend.mods.Mod;
46import net.oni2.aeinstaller.backend.mods.ModManager;
47import net.oni2.aeinstaller.backend.mods.Type;
48import net.oni2.aeinstaller.backend.mods.download.ModDownloader;
49import net.oni2.aeinstaller.backend.mods.download.ModDownloader.State;
50import net.oni2.aeinstaller.backend.mods.download.ModDownloaderListener;
51import net.oni2.aeinstaller.backend.oni.InstallProgressListener;
52import net.oni2.aeinstaller.backend.oni.Installer;
53import net.oni2.aeinstaller.backend.oni.OniSplit;
54import net.oni2.aeinstaller.gui.about.AboutDialog;
55import net.oni2.aeinstaller.gui.downloadwindow.Downloader;
56import net.oni2.aeinstaller.gui.modtable.DownloadSizeListener;
57import net.oni2.aeinstaller.gui.modtable.ModSelectionListener;
58import net.oni2.aeinstaller.gui.modtable.ModTable;
59import net.oni2.aeinstaller.gui.settings.SettingsDialog;
60import net.oni2.aeinstaller.gui.toolmanager.ToolManager;
61
62import org.javabuilders.BuildResult;
63import org.javabuilders.annotations.DoInBackground;
64import org.javabuilders.event.BackgroundEvent;
65import org.javabuilders.swing.SwingJavaBuilder;
66import org.simplericity.macify.eawt.ApplicationEvent;
67import org.simplericity.macify.eawt.ApplicationListener;
68
69/**
70 * @author Christian Illy
71 */
72public class MainWin extends JFrame implements ApplicationListener,
73 DownloadSizeListener, ModSelectionListener {
74 private static final long serialVersionUID = -4027395051382659650L;
75
76 private ResourceBundle bundle = ResourceBundle
77 .getBundle("net.oni2.aeinstaller.localization."
78 + getClass().getSimpleName());
79 @SuppressWarnings("unused")
80 private BuildResult result = SwingJavaBuilder.build(this, bundle);
81
82 private JMenu mainMenu;
83 private JMenu toolsMenu;
84 private TreeSet<JMenuItem> toolsMenuItems = new TreeSet<JMenuItem>();
85
86 private JSplitPane contents;
87
88 private JComboBox cmbModTypes;
89 private JRadioButton radAll;
90 private JRadioButton radOnline;
91 private JRadioButton radLocal;
92 private ModTable tblMods;
93 private JLabel lblDownloadSizeVal;
94
95 private JLabel lblTitleVal;
96 private JLabel lblSubmitterVal;
97 private JLabel lblCreatorVal;
98 private JLabel lblTypesVal;
99 private JLabel lblPlatformVal;
100 private JLabel lblPackageNumberVal;
101 private JLabel lblVersionNumberVal;
102 private HTMLLinkLabel lblDescriptionVal;
103
104 private JButton btnInstall;
105
106 private TreeSet<Mod> execUpdates = null;
107
108 private enum EInstallResult {
109 DONE,
110 OFFLINE,
111 INCOMPATIBLE
112 };
113
114 private EInstallResult installDone = EInstallResult.DONE;
115
116 /**
117 * Constructor of main window.
118 */
119 public MainWin() {
120 this.setTitle(SwingJavaBuilder.getConfig().getResource("appname")
121 + " - v"
122 + SwingJavaBuilder.getConfig().getResource("appversion"));
123
124 setSize(getWidth()+150, getHeight());
125 contents.setDividerLocation(500);
126 contents.setResizeWeight(0.4);
127
128 if (Settings.getPlatform() == Platform.MACOS) {
129 mainMenu.setVisible(false);
130 }
131
132 ToolTipManager.sharedInstance().setInitialDelay(250);
133
134 getRootPane().setDefaultButton(btnInstall);
135 lblDownloadSizeVal.setText(SizeFormatter.format(0, 2));
136 radAll.setSelected(true);
137
138 tblMods.addModSelectionListener(this);
139 tblMods.addDownloadSizeListener(this);
140 }
141
142 private void initModTypeBox() {
143 cmbModTypes.removeAllItems();
144
145 TreeMap<String, Type> types = new TreeMap<String, Type>();
146 for (Type t : ModManager.getInstance().getTypesWithContent()) {
147 types.put(t.getName(), t);
148 }
149 cmbModTypes.addItem("-All-");
150 for (Type t : types.values()) {
151 cmbModTypes.addItem(t);
152 }
153 cmbModTypes.setSelectedIndex(0);
154 }
155
156 private void exit() {
157 dispose();
158 System.exit(0);
159 }
160
161 private void saveLocalData() {
162 Settings.getInstance().serializeToFile();
163 }
164
165 @DoInBackground(progressMessage = "updateDepot.title", cancelable = false, indeterminateProgress = false)
166 private void execDepotUpdate(final BackgroundEvent evt) {
167 if (!Settings.getInstance().isOfflineMode()) {
168 long start = new Date().getTime();
169
170 try {
171 DepotManager.getInstance().updateInformation(false);
172 } catch (Exception e) {
173 e.printStackTrace();
174 }
175
176 System.out.println("Took: " + (new Date().getTime() - start)
177 + " msec");
178 }
179
180 ModManager.getInstance().init();
181 tblMods.reloadData();
182 initModTypeBox();
183
184 tblMods.setVisible(true);
185 }
186
187 @SuppressWarnings("unused")
188 private void checkUpdates(Object evtSource) {
189 if ((evtSource != this)
190 || Settings.getInstance().get("notifyupdates", true)) {
191 if (Settings.getInstance().isOfflineMode()) {
192 if (evtSource != this) {
193 JOptionPane.showMessageDialog(this,
194 bundle.getString("offlineMode.text"),
195 bundle.getString("offlineMode.title"),
196 JOptionPane.WARNING_MESSAGE);
197 }
198 } else {
199 TreeSet<Mod> mods = ModManager.getInstance().getUpdatableMods();
200 TreeSet<Mod> tools = ModManager.getInstance()
201 .getUpdatableTools();
202 int size = 0;
203 JPanel panPackages = new JPanel(new GridLayout(0, 1));
204 execUpdates = new TreeSet<Mod>();
205 execUpdates.addAll(mods);
206 execUpdates.addAll(tools);
207 for (final Mod m : mods) {
208 size += m.getZipSize();
209 JCheckBox check = new JCheckBox("Mod: " + m.getName());
210 check.setSelected(true);
211 check.addItemListener(new ItemListener() {
212 @Override
213 public void itemStateChanged(ItemEvent e) {
214 if (e.getStateChange() == ItemEvent.SELECTED)
215 execUpdates.add(m);
216 else
217 execUpdates.remove(m);
218 }
219 });
220 panPackages.add(check);
221 }
222 for (final Mod m : tools) {
223 size += m.getZipSize();
224 JCheckBox check = new JCheckBox("Tool: " + m.getName());
225 check.setSelected(true);
226 panPackages.add(check);
227 }
228 if (size > 0) {
229 // Build info dialog content
230 JPanel packages = new JPanel(new BorderLayout(0, 7));
231 JLabel lblIntro = new JLabel("<html>"
232 + bundle.getString("updatesAvailable.text")
233 + "</html>");
234 JLabel lblSize = new JLabel("<html>"
235 + String.format(bundle
236 .getString("updatesAvailableSize.text"),
237 SizeFormatter.format(size, 3)) + "</html>");
238 packages.add(lblIntro, BorderLayout.NORTH);
239 packages.add(panPackages, BorderLayout.CENTER);
240 packages.add(lblSize, BorderLayout.SOUTH);
241
242 JPanel pan = new JPanel(new BorderLayout(0, 25));
243 pan.add(packages, BorderLayout.CENTER);
244 JCheckBox checkFutureUpdates = new JCheckBox(
245 bundle.getString("checkOnStartup.text"));
246 checkFutureUpdates.setSelected(Settings.getInstance().get(
247 "notifyupdates", true));
248 checkFutureUpdates.addItemListener(new ItemListener() {
249 @Override
250 public void itemStateChanged(ItemEvent evt) {
251 Settings.getInstance().put("notifyupdates",
252 evt.getStateChange() == ItemEvent.SELECTED);
253 }
254 });
255 pan.add(checkFutureUpdates, BorderLayout.SOUTH);
256
257 // Show dialog
258 int res = JOptionPane.showConfirmDialog(this, pan,
259 bundle.getString("updatesAvailable.title"),
260 JOptionPane.YES_NO_OPTION,
261 JOptionPane.QUESTION_MESSAGE);
262 if (res == JOptionPane.NO_OPTION) {
263 execUpdates = null;
264 }
265 }
266 }
267 }
268 }
269
270 @SuppressWarnings("unused")
271 private void doUpdate() {
272 if (execUpdates != null && execUpdates.size() > 0) {
273 Downloader dl = new Downloader(execUpdates);
274 try {
275 dl.setVisible(true);
276 if (dl.isFinished()) {
277 TreeSet<Integer> installed = Installer.getInstalledTools();
278 TreeSet<Mod> tools = new TreeSet<Mod>();
279 for (Mod m : execUpdates)
280 if (m.isTool()
281 && installed.contains(m.getPackageNumber()))
282 tools.add(m);
283 if (tools.size() > 0) {
284 Installer.installTools(tools);
285 }
286 }
287 } finally {
288 dl.dispose();
289 }
290 }
291 execUpdates = null;
292 }
293
294 @SuppressWarnings("unused")
295 private void focus() {
296 SwingUtilities.invokeLater(new Runnable() {
297
298 @Override
299 public void run() {
300 toFront();
301 repaint();
302 }
303 });
304
305 }
306
307 private void showSettings() {
308 new SettingsDialog().setVisible(true);
309 }
310
311 private void showAbout() {
312 new AboutDialog().setVisible(true);
313 }
314
315 private JFileChooser getConfigOpenSaveDialog(boolean save) {
316 JFileChooser fc = new JFileChooser();
317 fc.setCurrentDirectory(Paths.getEditionBasePath());
318 if (save)
319 fc.setDialogType(JFileChooser.SAVE_DIALOG);
320 else
321 fc.setDialogType(JFileChooser.OPEN_DIALOG);
322 fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
323 fc.setFileFilter(new FileFilter() {
324 @Override
325 public String getDescription() {
326 return "XML files";
327 }
328
329 @Override
330 public boolean accept(File arg0) {
331 return (arg0.isDirectory())
332 || (arg0.getName().toLowerCase().endsWith(".xml"));
333 }
334 });
335 fc.setMultiSelectionEnabled(false);
336 return fc;
337 }
338
339 @SuppressWarnings("unused")
340 private void loadConfig() {
341 JFileChooser fc = getConfigOpenSaveDialog(false);
342 int res = fc.showOpenDialog(this);
343 if (res == JFileChooser.APPROVE_OPTION) {
344 if (fc.getSelectedFile().exists())
345 tblMods.reloadSelection(fc.getSelectedFile());
346 }
347 }
348
349 @SuppressWarnings("unused")
350 private void saveConfig() {
351 JFileChooser fc = getConfigOpenSaveDialog(true);
352 int res = fc.showSaveDialog(this);
353 if (res == JFileChooser.APPROVE_OPTION) {
354 File f = fc.getSelectedFile();
355 if (!f.getName().endsWith(".xml"))
356 f = new File(f.getParentFile(), f.getName() + ".xml");
357 ModManager.getInstance().saveModSelection(f,
358 tblMods.getSelectedMods());
359 }
360 }
361
362 @DoInBackground(progressMessage = "initializingEdition.title", cancelable = false, indeterminateProgress = false)
363 private void reglobalize(final BackgroundEvent evt) {
364 Installer.initializeEdition(new InstallProgressListener() {
365 @Override
366 public void installProgressUpdate(int done, int total, String step) {
367 evt.setProgressEnd(total);
368 evt.setProgressValue(done);
369 evt.setProgressMessage(step);
370 }
371 });
372 }
373
374 @SuppressWarnings("unused")
375 private void tools() {
376 new ToolManager().setVisible(true);
377 }
378
379 @SuppressWarnings("unused")
380 private void refreshToolsMenu() {
381 for (JMenuItem i : toolsMenuItems) {
382 toolsMenu.remove(i);
383 }
384 toolsMenuItems.clear();
385 for (Mod m : ModManager.getInstance().getInstalledTools()) {
386 if (m.getExeFile() != null && m.getExeFile().exists()) {
387 JMenuItem item = new JMenuItem();
388 final Vector<String> params = new Vector<String>();
389 params.add(m.getExeFile().getPath());
390 final File wd = m.getWorkingDir();
391 Icon ico = null;
392 if (m.getIconFile() != null && m.getIconFile().exists()) {
393 ico = new ImageIcon(m.getIconFile().getPath());
394 } else {
395 URL icon = AEInstaller2.class
396 .getResource("images/transparent.png");
397 ico = new ImageIcon(icon);
398 }
399 item.setAction(new AbstractAction(m.getName(), ico) {
400 private static final long serialVersionUID = 1L;
401
402 @Override
403 public void actionPerformed(ActionEvent e) {
404 AppExecution.execute(params, wd);
405 }
406 });
407 toolsMenuItems.add(item);
408 toolsMenu.add(item);
409 }
410 }
411 }
412
413 private void revertSelection() {
414 tblMods.revertSelection();
415 }
416
417 @DoInBackground(progressMessage = "mandatoryFiles.title", cancelable = false, indeterminateProgress = false)
418 private void checkMandatoryFiles(final BackgroundEvent evt) {
419 if (!Settings.getInstance().isOfflineMode()) {
420 TreeSet<Mod> mand = new TreeSet<Mod>();
421 for (Mod m : ModManager.getInstance().getMandatoryTools()) {
422 if (m.isNewerAvailable()) {
423 mand.add(m);
424 }
425 }
426 for (Mod m : ModManager.getInstance().getMandatoryMods()) {
427 if (m.isNewerAvailable()) {
428 mand.add(m);
429 }
430 }
431 if (mand.size() > 0) {
432 ModDownloader m = new ModDownloader(mand,
433 new ModDownloaderListener() {
434 @Override
435 public void updateStatus(ModDownloader source,
436 State state, int filesDown, int filesTotal,
437 int bytesDown, int bytesTotal,
438 int duration, int remaining, int speed) {
439 evt.setProgressEnd(filesTotal);
440 evt.setProgressValue(filesDown);
441 }
442 });
443 while (!m.isFinished()) {
444 try {
445 Thread.sleep(10);
446 } catch (InterruptedException e) {
447 e.printStackTrace();
448 }
449 }
450 }
451 evt.setProgressMessage(bundle
452 .getString("mandatoryToolsInstall.title"));
453 Installer
454 .installTools(ModManager.getInstance().getMandatoryTools());
455 }
456 }
457
458 @DoInBackground(progressMessage = "installing.title", cancelable = false, indeterminateProgress = false)
459 private void install(final BackgroundEvent evt) {
460 TreeSet<Mod> mods = new TreeSet<Mod>();
461 mods.addAll(ModManager.getInstance().getMandatoryMods());
462 mods.addAll(tblMods.getSelectedMods());
463
464 boolean instReady = false;
465 installDone = EInstallResult.DONE;
466
467 while (!instReady) {
468 TreeSet<Mod> toDownload = new TreeSet<Mod>();
469 for (Mod m : mods) {
470 if (!m.isLocalAvailable())
471 toDownload.add(m);
472 }
473 if (Settings.getInstance().isOfflineMode()) {
474 installDone = EInstallResult.OFFLINE;
475 break;
476 }
477 if (toDownload.size() > 0) {
478 Downloader dl = new Downloader(toDownload);
479 try {
480 dl.setVisible(true);
481 if (!dl.isFinished())
482 break;
483 } finally {
484 dl.dispose();
485 }
486 }
487 HashMap<Mod, HashSet<Mod>> dependencies = ModManager.getInstance()
488 .checkDependencies(mods);
489 if (dependencies.size() > 0) {
490 System.out.println("Unmet dependencies: "
491 + dependencies.toString());
492 for (Mod m : dependencies.keySet()) {
493 for (Mod mDep : dependencies.get(m))
494 mods.add(mDep);
495 }
496 } else {
497 HashMap<Mod, HashSet<Mod>> conflicts = ModManager.getInstance()
498 .checkIncompabitilites(mods);
499 if (conflicts.size() > 0) {
500 installDone = EInstallResult.INCOMPATIBLE;
501 System.err.println("Incompatible mods: "
502 + conflicts.toString());
503 break;
504 } else {
505 instReady = true;
506 }
507 }
508 }
509
510 if (instReady) {
511 TreeSet<Mod> actuallyMods = new TreeSet<Mod>();
512 TreeSet<Mod> actuallyTools = new TreeSet<Mod>();
513
514 for (Mod m : mods) {
515 if (m.isTool())
516 actuallyTools.add(m);
517 else
518 actuallyMods.add(m);
519 }
520
521 if (actuallyTools.size() > 0) {
522 Installer.installTools(actuallyTools);
523 }
524
525 Installer.install(actuallyMods, new InstallProgressListener() {
526 @Override
527 public void installProgressUpdate(int done, int total,
528 String step) {
529 evt.setProgressEnd(total);
530 evt.setProgressValue(done);
531 evt.setProgressMessage(step);
532 }
533 });
534 installDone = EInstallResult.DONE;
535 }
536 }
537
538 @SuppressWarnings("unused")
539 private void installDone() {
540 ModManager.getInstance().updateInstalledMods();
541 revertSelection();
542 switch (installDone) {
543 case DONE:
544 JOptionPane.showMessageDialog(this,
545 bundle.getString("installDone.text"),
546 bundle.getString("installDone.title"),
547 JOptionPane.INFORMATION_MESSAGE);
548 break;
549 case OFFLINE:
550 JOptionPane.showMessageDialog(this,
551 bundle.getString("offlineMode.text"),
552 bundle.getString("offlineMode.title"),
553 JOptionPane.WARNING_MESSAGE);
554 break;
555 case INCOMPATIBLE:
556 break;
557 }
558 }
559
560 @Override
561 public void modSelectionChanged(ModTable source, Mod m) {
562 lblTitleVal.setText("");
563 lblSubmitterVal.setText("");
564 lblCreatorVal.setText("");
565 lblDescriptionVal.setText("");
566 lblTypesVal.setText("");
567 lblPlatformVal.setText("");
568 lblPackageNumberVal.setText("");
569 lblVersionNumberVal.setText("");
570 if (m != null) {
571 lblTitleVal.setText(m.getName());
572 lblSubmitterVal.setText(m.getSubmitter());
573 lblCreatorVal.setText(m.getCreator());
574 lblDescriptionVal.setText(m.getDescription());
575
576 String types = "";
577 for (Type t : m.getTypes()) {
578 if (types.length() > 0)
579 types += ", ";
580 types += t.getName();
581 }
582 lblTypesVal.setText(types);
583 lblPlatformVal.setText(m.getPlatform().toString());
584 lblPackageNumberVal.setText(m.getPackageNumberString());
585 lblVersionNumberVal.setText(m.getVersion());
586 }
587 }
588
589 private void updateTableFilter() {
590 Object o = cmbModTypes.getSelectedItem();
591 Type t = null;
592 if (o instanceof Type)
593 t = (Type) o;
594 int downloadState = 0;
595 if (radOnline.isSelected())
596 downloadState = 1;
597 if (radLocal.isSelected())
598 downloadState = 2;
599 tblMods.setFilter(t, downloadState);
600 }
601
602 @SuppressWarnings("unused")
603 private void modTypeSelection() {
604 updateTableFilter();
605 }
606
607 @SuppressWarnings("unused")
608 private void showTypeSelection() {
609 updateTableFilter();
610 }
611
612 @Override
613 public void downloadSizeChanged(int newSize) {
614 lblDownloadSizeVal.setText(SizeFormatter.format(newSize, 2));
615 }
616
617 @SuppressWarnings("unused")
618 private void checkInitialize() {
619 if (!Installer.isEditionInitialized()) {
620 if (!OniSplit.isOniSplitInstalled()) {
621 JOptionPane.showMessageDialog(this,
622 bundle.getString("noOniSplit.text"),
623 bundle.getString("noOniSplit.title"),
624 JOptionPane.ERROR_MESSAGE);
625 exit();
626 } else {
627 int res = JOptionPane
628 .showConfirmDialog(this,
629 bundle.getString("askInitialize.text"),
630 bundle.getString("askInitialize.title"),
631 JOptionPane.YES_NO_OPTION,
632 JOptionPane.QUESTION_MESSAGE);
633 if (res == JOptionPane.NO_OPTION) {
634 saveLocalData();
635 exit();
636 }
637 }
638 }
639 }
640
641 @DoInBackground(progressMessage = "initializingEdition.title", cancelable = false, indeterminateProgress = false)
642 private void initialize(final BackgroundEvent evt) {
643 if (!Installer.isEditionInitialized()) {
644 Installer.initializeEdition(new InstallProgressListener() {
645 @Override
646 public void installProgressUpdate(int done, int total,
647 String step) {
648 evt.setProgressEnd(total);
649 evt.setProgressValue(done);
650 evt.setProgressMessage(step);
651 }
652 });
653 }
654 }
655
656 private Vector<String> getBasicOniLaunchParams() {
657 Vector<String> params = new Vector<String>();
658 File exe = null;
659 switch (Settings.getPlatform()) {
660 case WIN:
661 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
662 if (exe.exists())
663 params.add(exe.getPath());
664 break;
665 case MACOS:
666 exe = new File(Paths.getEditionBasePath(),
667 "Oni.app/Contents/MacOS/Oni");
668 if (exe.exists())
669 params.add(exe.getPath());
670 break;
671 case LINUX:
672 String wine = Settings.getWinePath();
673 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
674 if (exe.exists()) {
675 if (wine != null) {
676 params.add(wine);
677 params.add(exe.getPath());
678 }
679 }
680 break;
681 default:
682 }
683 if (params.size() > 0) {
684 params.add("-debugfiles");
685 }
686 return params;
687 }
688
689 @SuppressWarnings("unused")
690 private void oniFull() {
691 Vector<String> params = getBasicOniLaunchParams();
692 if (params.size() > 0) {
693 AppExecution.execute(params, Paths.getEditionBasePath());
694 }
695 }
696
697 @SuppressWarnings("unused")
698 private void oniWin() {
699 Vector<String> params = getBasicOniLaunchParams();
700 if (params.size() > 0) {
701 params.add("-noswitch");
702 AppExecution.execute(params, Paths.getEditionBasePath());
703 }
704 }
705
706 @SuppressWarnings("unused")
707 private void openEditionFolder() {
708 try {
709 Desktop.getDesktop().open(Paths.getEditionBasePath());
710 } catch (Exception e) {
711 e.printStackTrace();
712 }
713 }
714
715 @Override
716 public void handleAbout(ApplicationEvent event) {
717 event.setHandled(true);
718 showAbout();
719 }
720
721 @Override
722 public void handleOpenApplication(ApplicationEvent event) {
723 }
724
725 @Override
726 public void handleOpenFile(ApplicationEvent event) {
727 }
728
729 @Override
730 public void handlePreferences(ApplicationEvent event) {
731 showSettings();
732 }
733
734 @Override
735 public void handlePrintFile(ApplicationEvent event) {
736 }
737
738 @Override
739 public void handleQuit(ApplicationEvent event) {
740 event.setHandled(true);
741 saveLocalData();
742 exit();
743 }
744
745 @Override
746 public void handleReOpenApplication(ApplicationEvent event) {
747 }
748
749}
Note: See TracBrowser for help on using the repository browser.