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