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