ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/java/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
(Generate patch)

Comparing AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java (file contents):
Revision 592 by alloc, Sat Dec 29 16:01:15 2012 UTC vs.
Revision 593 by alloc, Mon Dec 31 13:48:32 2012 UTC

# Line 9 | Line 9 | import java.util.ResourceBundle;
9   import java.util.TreeMap;
10  
11   import javax.swing.JComboBox;
12 + import javax.swing.JComponent;
13   import javax.swing.JFrame;
14   import javax.swing.JLabel;
15 + import javax.swing.JMenu;
16 + import javax.swing.JOptionPane;
17   import javax.swing.JSplitPane;
18   import javax.swing.JTable;
19   import javax.swing.ListSelectionModel;
# Line 22 | Line 25 | import javax.swing.event.ListSelectionLi
25   import javax.swing.table.TableRowSorter;
26  
27   import net.oni2.aeinstaller.backend.Settings;
28 + import net.oni2.aeinstaller.backend.Settings.Platform;
29   import net.oni2.aeinstaller.backend.depot.DepotCacheUpdateProgressListener;
30   import net.oni2.aeinstaller.backend.depot.DepotConfig;
31   import net.oni2.aeinstaller.backend.depot.DepotManager;
32   import net.oni2.aeinstaller.backend.depot.model.NodeMod;
33   import net.oni2.aeinstaller.backend.depot.model.TaxonomyTerm;
34   import net.oni2.aeinstaller.backend.depot.model.TaxonomyVocabulary;
35 + import net.oni2.aeinstaller.gui.about.AboutDialog;
36   import net.oni2.aeinstaller.gui.modtable.ModTableFilter;
37   import net.oni2.aeinstaller.gui.modtable.ModTableModel;
38   import net.oni2.aeinstaller.gui.settings.SettingsDialog;
# Line 36 | Line 41 | import org.javabuilders.BuildResult;
41   import org.javabuilders.annotations.DoInBackground;
42   import org.javabuilders.event.BackgroundEvent;
43   import org.javabuilders.swing.SwingJavaBuilder;
44 + import org.simplericity.macify.eawt.ApplicationEvent;
45 + import org.simplericity.macify.eawt.ApplicationListener;
46  
47   /**
48   * @author Christian Illy
49   */
50 < public class MainWin extends JFrame {
50 > public class MainWin extends JFrame implements ApplicationListener {
51          private static final long serialVersionUID = -4027395051382659650L;
52  
53          private ResourceBundle bundle = ResourceBundle.getBundle(getClass()
# Line 48 | Line 55 | public class MainWin extends JFrame {
55          @SuppressWarnings("unused")
56          private BuildResult result = SwingJavaBuilder.build(this, bundle);
57  
58 +        private JMenu mainMenu;
59 +
60          private JSplitPane contents;
61  
62          private JComboBox cmbModTypes;
# Line 65 | Line 74 | public class MainWin extends JFrame {
74           * Constructor of main window.
75           */
76          public MainWin() {
77 <                this.setTitle(bundle.getString("frame.title") + " - v"
78 <                                + bundle.getString("version"));
77 >                this.setTitle(SwingJavaBuilder.getConfig().getResource("appname")
78 >                                + " - v"
79 >                                + SwingJavaBuilder.getConfig().getResource("appversion"));
80  
81                  contents.setDividerLocation(400);
82                  initTable();
83                  initModTypeBox();
84 +
85 +                if (Settings.getPlatform() == Platform.MACOS) {
86 +                        mainMenu.setVisible(false);
87 +                }
88          }
89  
90          private void initModTypeBox() {
# Line 114 | Line 128 | public class MainWin extends JFrame {
128                                          }
129                                  });
130  
131 +                // To get checkbox-cells with background of row
132 +                ((JComponent) tblMods.getDefaultRenderer(Boolean.class))
133 +                                .setOpaque(true);
134 +
135                  model = new ModTableModel();
136  
137                  tblMods.setModel(model);
# Line 147 | Line 165 | public class MainWin extends JFrame {
165                  // }
166          }
167  
168 <        @SuppressWarnings("unused")
168 >        private boolean askClose() {
169 >                int res = JOptionPane.showConfirmDialog(this,
170 >                                bundle.getString("askClose.text"),
171 >                                bundle.getString("askClose.title"), JOptionPane.YES_NO_OPTION,
172 >                                JOptionPane.QUESTION_MESSAGE);
173 >                return res == JOptionPane.YES_OPTION;
174 >        }
175 >
176          private boolean closeFrames() {
177                  System.gc();
178                  for (Frame f : Frame.getFrames()) {
# Line 157 | Line 182 | public class MainWin extends JFrame {
182                  return true;
183          }
184  
160        @SuppressWarnings("unused")
185          private void exit() {
186                  setVisible(false);
187                  dispose();
188          }
189  
166        @SuppressWarnings("unused")
190          private void saveLocalData() {
191                  Settings.getInstance().serializeToFile();
192                  DepotManager.getInstance().saveToFile(
# Line 212 | Line 235 | public class MainWin extends JFrame {
235  
236          }
237  
215        @SuppressWarnings("unused")
238          private void showSettings() {
239 <                SettingsDialog.openWindow();
239 >                new SettingsDialog().setVisible(true);
240 >        }
241 >
242 >        private void showAbout() {
243 >                new AboutDialog().setVisible(true);
244 >        }
245 >
246 >        @SuppressWarnings("unused")
247 >        private void loadConfig() {
248 >                // TODO Auto-generated method stub
249 >                JOptionPane.showMessageDialog(this, "loadConfig", "todo",
250 >                                JOptionPane.INFORMATION_MESSAGE);
251 >        }
252 >
253 >        @SuppressWarnings("unused")
254 >        private void saveConfig() {
255 >                // TODO Auto-generated method stub
256 >                JOptionPane.showMessageDialog(this, "saveConfig", "todo",
257 >                                JOptionPane.INFORMATION_MESSAGE);
258 >        }
259 >
260 >        @SuppressWarnings("unused")
261 >        private void reglobalize() {
262 >                // TODO Auto-generated method stub
263 >                JOptionPane.showMessageDialog(this, "reglobalize", "todo",
264 >                                JOptionPane.INFORMATION_MESSAGE);
265          }
266 +        
267 +        @SuppressWarnings("unused")
268 +        private void revertSelection() {
269 +                // TODO Auto-generated method stub
270 +                JOptionPane.showMessageDialog(this, "revertSelection", "todo",
271 +                                JOptionPane.INFORMATION_MESSAGE);
272 +        }
273 +        
274 +        
275  
276          private void modSelection(NodeMod n) {
277                  lblSubmitterVal.setText("");
# Line 242 | Line 298 | public class MainWin extends JFrame {
298                  else
299                          sorter.setRowFilter(new ModTableFilter(-1));
300          }
301 +
302 +        @Override
303 +        public void handleAbout(ApplicationEvent event) {
304 +                event.setHandled(true);
305 +                showAbout();
306 +        }
307 +
308 +        @Override
309 +        public void handleOpenApplication(ApplicationEvent event) {
310 +        }
311 +
312 +        @Override
313 +        public void handleOpenFile(ApplicationEvent event) {
314 +        }
315 +
316 +        @Override
317 +        public void handlePreferences(ApplicationEvent event) {
318 +                showSettings();
319 +        }
320 +
321 +        @Override
322 +        public void handlePrintFile(ApplicationEvent event) {
323 +        }
324 +
325 +        @Override
326 +        public void handleQuit(ApplicationEvent event) {
327 +                if (askClose()) {
328 +                        event.setHandled(true);
329 +                        closeFrames();
330 +                        saveLocalData();
331 +                        exit();
332 +                } else {
333 +                        event.setHandled(false);
334 +                }
335 +        }
336 +
337 +        @Override
338 +        public void handleReOpenApplication(ApplicationEvent event) {
339 +        }
340   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)