- Timestamp:
- Dec 31, 2012, 2:48:32 PM (12 years ago)
- Location:
- AE/installer2
- Files:
-
- 13 added
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/.classpath
r591 r593 19 19 <classpathentry kind="lib" path="lib/httpclient/commons-logging-1.1.1.jar"/> 20 20 <classpathentry kind="lib" path="lib/xstream-1.4.3.jar"/> 21 <classpathentry kind="lib" path="lib/macify.jar"/> 21 22 <classpathentry kind="output" path="bin"/> 22 23 </classpath> -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r592 r593 1 appname=AE Installer 2 2 appversion=0.32 3 1 4 invalidPath.title=Wrong directory 2 5 invalidPath.text=This program has to be placed in the subfolder Edition/AEInstaller inside a vanilla Oni folder.\nThe full path of the .jar-file has to be:\nOniFolder/Edition/AEInstaller/AEInstaller2.jar -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r592 r593 1 1 package net.oni2.aeinstaller; 2 2 3 import java.awt.image.BufferedImage; 3 4 import java.io.File; 4 5 import java.io.FileNotFoundException; 6 import java.io.IOException; 5 7 import java.io.PrintStream; 8 import java.net.URL; 6 9 import java.util.ResourceBundle; 7 10 11 import javax.imageio.ImageIO; 8 12 import javax.swing.JFrame; 9 13 import javax.swing.JOptionPane; … … 14 18 15 19 import net.oni2.aeinstaller.backend.Settings; 20 import net.oni2.aeinstaller.backend.Settings.Platform; 16 21 import net.oni2.aeinstaller.backend.StuffToRefactorLater; 17 22 import net.oni2.aeinstaller.backend.depot.DepotManager; … … 19 24 20 25 import org.javabuilders.swing.SwingJavaBuilder; 26 import org.simplericity.macify.eawt.Application; 27 import org.simplericity.macify.eawt.DefaultApplication; 21 28 22 29 /** 23 30 * @author Christian Illy 24 * @version 0.125 31 */ 26 32 public class AEInstaller2 { 33 34 private static ResourceBundle imagesBundle = ResourceBundle 35 .getBundle(AEInstaller2.class.getPackage().getName() + ".Images"); 36 private static ResourceBundle basicBundle = ResourceBundle 37 .getBundle(AEInstaller2.class.getPackage().getName() 38 + ".AEInstaller"); 39 40 private static Application app = null; 41 42 private static void initMacOS() { 43 System.setProperty("apple.laf.useScreenMenuBar", "true"); 44 System.setProperty("com.apple.mrj.application.apple.menu.about.name", 45 basicBundle.getString("appname")); 46 app = new DefaultApplication(); 47 48 URL icon = AEInstaller2.class.getResource("images/AElogo.png"); 49 try { 50 BufferedImage img = ImageIO.read(icon); 51 app.setApplicationIconImage(img); 52 } catch (IOException e) { 53 // TODO Auto-generated catch block 54 e.printStackTrace(); 55 } 56 } 27 57 28 58 /** … … 49 79 } 50 80 81 if (Settings.getPlatform() == Platform.MACOS) 82 initMacOS(); 83 51 84 Settings.deserializeFromFile(); 52 85 Settings.setDebug(debug); 53 86 DepotManager.getInstance().loadFromFile( 54 87 new File(Settings.getDepotCacheFilename())); 55 56 ResourceBundle imagesBundle = ResourceBundle57 .getBundle(AEInstaller2.class.getPackage().getName()58 + ".Images");59 ResourceBundle basicBundle = ResourceBundle60 .getBundle(AEInstaller2.class.getPackage().getName()61 + ".AEInstaller");62 88 63 89 SwingJavaBuilder.getConfig().addResourceBundle(imagesBundle); … … 66 92 SwingJavaBuilder.getConfig().addType("JToolBarSeparator", 67 93 JToolBar.Separator.class); 68 // SwingJavaBuilder.getConfig().addType("ScreenshotBrowser",69 // ScreenshotBrowser.class);70 // SwingJavaBuilder.getConfig().addType("HTMLLinkLabel",71 // HTMLLinkLabel.class);72 94 73 95 System.setProperty("networkaddress.cache.ttl", "5"); 74 96 System.setProperty("networkaddress.cache.negative.ttl", "1"); 75 97 76 98 try { 77 99 String laf = Settings.getInstance().get("lookandfeel", 78 100 (String) null); 79 101 if (laf == null) { 80 for (LookAndFeelInfo lafInfo : UIManager 81 .getInstalledLookAndFeels()) { 82 if (lafInfo.getName().equals("Nimbus")) 83 laf = lafInfo.getClassName(); 102 if (Settings.getPlatform() == Platform.MACOS) { 103 laf = UIManager.getSystemLookAndFeelClassName(); 104 } else { 105 for (LookAndFeelInfo lafInfo : UIManager 106 .getInstalledLookAndFeels()) { 107 if (lafInfo.getName().equals("Nimbus")) 108 laf = lafInfo.getClassName(); 109 } 84 110 } 85 111 } … … 115 141 public void run() { 116 142 try { 117 new MainWin().setVisible(true); 143 MainWin mw = new MainWin(); 144 if (app != null) { 145 app.addAboutMenuItem(); 146 app.setEnabledAboutMenu(true); 147 app.addPreferencesMenuItem(); 148 app.setEnabledPreferencesMenu(true); 149 app.addApplicationListener(mw); 150 } 151 mw.setVisible(true); 118 152 } catch (Exception e) { 119 153 e.printStackTrace(); -
AE/installer2/src/net/oni2/aeinstaller/Images.properties
r592 r593 1 1 img.connect=/net/oni2/aeinstaller/images/tango/network-idle.png 2 2 img.disconnect=/net/oni2/aeinstaller/images/tango/network-offline.png 3 img.exit=/net/oni2/aeinstaller/images/tango/system-log-out.png4 3 img.manageExams=/net/oni2/aeinstaller/images/tango/document-open.png 5 4 img.manageMembers=/net/oni2/aeinstaller/images/tango/contact-new.png 6 img.updatesvn=/net/oni2/aeinstaller/images/tango/view-refresh.png7 img.settings=/net/oni2/aeinstaller/images/tango/preferences-system.png8 5 img.print=/net/oni2/aeinstaller/images/tango/document-print.png 9 6 img.edit=/net/oni2/aeinstaller/images/tango/text-editor.png … … 11 8 img.add=/net/oni2/aeinstaller/images/tango/list-add.png 12 9 img.refresh=/net/oni2/aeinstaller/images/tango/go-jump.png 13 img.openFile=/net/oni2/aeinstaller/images/tango/document-open.png14 10 img.sale=/net/oni2/aeinstaller/images/tango/accessories-calculator.png 15 11 img.orders=/net/oni2/aeinstaller/images/tango/bookmark-new.png … … 20 16 img.downloadFolder=/net/oni2/aeinstaller/images/open_icon_library/folder-games.png 21 17 22 img.kdt=/net/oni2/aeinstaller/images/kdt.png 18 img.openFile=/net/oni2/aeinstaller/images/tango/document-open.png 19 img.saveFile=/net/oni2/aeinstaller/images/tango/document-save-as.png 20 img.settings=/net/oni2/aeinstaller/images/tango/preferences-system.png 21 img.about=/net/oni2/aeinstaller/images/open_icon_library/help-about-3.png 22 img.exit=/net/oni2/aeinstaller/images/tango/system-log-out.png 23 img.undo=/net/oni2/aeinstaller/images/tango/edit-undo.png 24 img.undo16=/net/oni2/aeinstaller/images/tango/edit-undo16.png 25 img.redo=/net/oni2/aeinstaller/images/tango/edit-redo.png 26 img.refresh=/net/oni2/aeinstaller/images/tango/view-refresh.png 27 28 img.ae=/net/oni2/aeinstaller/images/AElogo.png -
AE/installer2/src/net/oni2/aeinstaller/gui/HTMLLinkLabel.java
r592 r593 77 77 super.setText(prefix + t + suffix); 78 78 } 79 79 80 } -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r592 r593 10 10 11 11 import javax.swing.JComboBox; 12 import javax.swing.JComponent; 12 13 import javax.swing.JFrame; 13 14 import javax.swing.JLabel; 15 import javax.swing.JMenu; 16 import javax.swing.JOptionPane; 14 17 import javax.swing.JSplitPane; 15 18 import javax.swing.JTable; … … 23 26 24 27 import net.oni2.aeinstaller.backend.Settings; 28 import net.oni2.aeinstaller.backend.Settings.Platform; 25 29 import net.oni2.aeinstaller.backend.depot.DepotCacheUpdateProgressListener; 26 30 import net.oni2.aeinstaller.backend.depot.DepotConfig; … … 29 33 import net.oni2.aeinstaller.backend.depot.model.TaxonomyTerm; 30 34 import net.oni2.aeinstaller.backend.depot.model.TaxonomyVocabulary; 35 import net.oni2.aeinstaller.gui.about.AboutDialog; 31 36 import net.oni2.aeinstaller.gui.modtable.ModTableFilter; 32 37 import net.oni2.aeinstaller.gui.modtable.ModTableModel; … … 37 42 import org.javabuilders.event.BackgroundEvent; 38 43 import org.javabuilders.swing.SwingJavaBuilder; 44 import org.simplericity.macify.eawt.ApplicationEvent; 45 import org.simplericity.macify.eawt.ApplicationListener; 39 46 40 47 /** 41 48 * @author Christian Illy 42 49 */ 43 public class MainWin extends JFrame {50 public class MainWin extends JFrame implements ApplicationListener { 44 51 private static final long serialVersionUID = -4027395051382659650L; 45 52 … … 48 55 @SuppressWarnings("unused") 49 56 private BuildResult result = SwingJavaBuilder.build(this, bundle); 57 58 private JMenu mainMenu; 50 59 51 60 private JSplitPane contents; … … 66 75 */ 67 76 public MainWin() { 68 this.setTitle(bundle.getString("frame.title") + " - v" 69 + bundle.getString("version")); 77 this.setTitle(SwingJavaBuilder.getConfig().getResource("appname") 78 + " - v" 79 + SwingJavaBuilder.getConfig().getResource("appversion")); 70 80 71 81 contents.setDividerLocation(400); 72 82 initTable(); 73 83 initModTypeBox(); 84 85 if (Settings.getPlatform() == Platform.MACOS) { 86 mainMenu.setVisible(false); 87 } 74 88 } 75 89 … … 115 129 }); 116 130 131 // To get checkbox-cells with background of row 132 ((JComponent) tblMods.getDefaultRenderer(Boolean.class)) 133 .setOpaque(true); 134 117 135 model = new ModTableModel(); 118 136 … … 148 166 } 149 167 150 @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 151 176 private boolean closeFrames() { 152 177 System.gc(); … … 158 183 } 159 184 160 @SuppressWarnings("unused")161 185 private void exit() { 162 186 setVisible(false); … … 164 188 } 165 189 166 @SuppressWarnings("unused")167 190 private void saveLocalData() { 168 191 Settings.getInstance().serializeToFile(); … … 213 236 } 214 237 215 @SuppressWarnings("unused")216 238 private void showSettings() { 217 SettingsDialog.openWindow(); 218 } 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 219 275 220 276 private void modSelection(NodeMod n) { … … 243 299 sorter.setRowFilter(new ModTableFilter(-1)); 244 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 } 245 340 } -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.properties
r592 r593 1 1 # Main Frame 2 frame.title=AE Installer 23 2 buttonExit.title=Exit 4 version=0.15 3 6 menu. file=&Menu4 menu.main=&Main 7 5 menu.settings=&Settings 8 6 menu.settingsTooltip=Settings 7 menu.about=&About 8 menu.aboutTooltip=About 9 9 menu.exit=&Exit\tCtrl+Q 10 10 menu.exitTooltip=Exit 11 11 12 menu.file=&File 13 menu.loadConfig=&Load configuration... 14 menu.loadConfigTooltip=Load configuration 15 menu.saveConfig=&Save configuration... 16 menu.saveConfigTooltip=Save configuration 17 18 menu.reglobalize=&Rebuild Core Data 19 menu.reglobalizeTooltip=Rebuild Core Data 20 21 btnRevertSelection.text=Revert selection 22 btnRevertSelection.tooltip=Select mods which are currently installed 12 23 lblModTypes.text=Mod types: 13 24 … … 22 33 updatesAvailable.title=Updates available 23 34 updatesAvailable.text=Some mods have newer versions available. 35 36 askClose.title=Confirm close request 37 askClose.text=Are you sure you want to close the program? -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.yml
r592 r593 1 1 JFrame: 2 2 name: frame 3 title: frame.title3 title: appname 4 4 size: 800x600 5 5 minimumSize: 400x300 … … 7 7 defaultCloseOperation: doNothingOnClose 8 8 onWindowOpened: [execDepotUpdate,checkUpdates,focus] 9 onWindowClosing: [ $confirm,closeFrames,saveLocalData,exit]10 iconImage: img. kdt9 onWindowClosing: [askClose,closeFrames,saveLocalData,exit] 10 iconImage: img.ae 11 11 content: 12 - Action(name=exitAction, text=menu.exit, toolTipText=menu.exitTooltip, icon=img.exit, onAction=[ $confirm,closeFrames,saveLocalData,exit])12 - Action(name=exitAction, text=menu.exit, toolTipText=menu.exitTooltip, icon=img.exit, onAction=[askClose,closeFrames,saveLocalData,exit]) 13 13 - Action(name=settings, text=menu.settings, toolTipText=menu.settingsTooltip, icon=img.settings, onAction=[showSettings]) 14 - Action(name=about, text=menu.about, toolTipText=menu.aboutTooltip, icon=img.about, onAction=[showAbout]) 15 - Action(name=loadConfig, text=menu.loadConfig, toolTipText=menu.loadConfigTooltip, icon=img.openFile, onAction=[loadConfig]) 16 - Action(name=saveConfig, text=menu.saveConfig, toolTipText=menu.saveConfigTooltip, icon=img.saveFile, onAction=[saveConfig]) 17 - Action(name=reglobalize, text=menu.reglobalize, toolTipText=menu.reglobalizeTooltip, icon=img.refresh, onAction=[reglobalize]) 14 18 - JMenuBar: 19 - JMenu(name=mainMenu, text=menu.main): 20 - JMenuItem(action=settings) 21 - JMenuItem(action=about) 22 - JMenuItem(action=exitAction) 15 23 - JMenu(name=fileMenu, text=menu.file): 16 - JMenuItem(action=settings) 17 - JMenuItem(action=exitAction) 24 - JMenuItem(action=loadConfig) 25 - JMenuItem(action=saveConfig) 26 - JSeparator() 27 - JMenuItem(action=reglobalize) 18 28 - JToolBar(name=tools, floatable=false, orientation=0): 19 29 - JButton(action=exitAction, hideActionText=true) 20 30 - JToolBarSeparator() 21 31 - JButton(action=settings, hideActionText=true) 32 - JButton(action=about, hideActionText=true) 22 33 - JSplitPane(name=contents, orientation=horizontalSplit, continuousLayout=true): 23 34 - JPanel(name=panMods): 35 - JButton(name=btnRevertSelection, icon=img.undo16, text=btnRevertSelection.text, toolTipText=btnRevertSelection.tooltip, onAction=[revertSelection]) 24 36 - JLabel(name=lblModTypes, text=lblModTypes.text) 25 37 - JComboBox(name=cmbModTypes, onAction=modTypeSelection) … … 28 40 - MigLayout: | 29 41 [grow] 42 btnRevertSelection [min] 30 43 lblModTypes<,cmbModTypes [min] 31 44 scrollMods [grow] -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTableModel.java
r592 r593 22 22 23 23 private Vector<NodeMod> items; 24 private Vector<Boolean> install; 24 25 private int vocabModTypeID = -1; 25 26 private int vocabPlatformID = -1; … … 45 46 String type = ""; 46 47 if (vocabModTypeID < 0) { 47 vocabModTypeID = DepotManager.getInstance() 48 .getVocabulary(DepotConfig.getVocabularyName_ModType()).getVid(); 48 vocabModTypeID = DepotManager 49 .getInstance() 50 .getVocabulary( 51 DepotConfig.getVocabularyName_ModType()) 52 .getVid(); 49 53 } 50 54 for (int tid : node.getTaxonomyTerms().get(vocabModTypeID)) { … … 57 61 case 3: 58 62 if (vocabPlatformID < 0) { 59 vocabPlatformID = DepotManager.getInstance() 60 .getVocabulary(DepotConfig.getVocabularyName_Platform()).getVid(); 63 vocabPlatformID = DepotManager 64 .getInstance() 65 .getVocabulary( 66 DepotConfig.getVocabularyName_Platform()) 67 .getVid(); 61 68 } 62 69 int tid = node.getTaxonomyTerms().get(vocabPlatformID) … … 64 71 return DepotManager.getInstance().getTaxonomyTerm(tid) 65 72 .getName(); 73 case 4: 74 return install.get(row); 66 75 } 67 76 return null; … … 79 88 case 3: 80 89 return bundle.getString("mod.platform"); 90 case 4: 91 return bundle.getString("mod.install"); 81 92 } 82 93 return null; … … 90 101 @Override 91 102 public int getColumnCount() { 92 return 4;103 return 5; 93 104 } 94 105 … … 104 115 case 3: 105 116 return String.class; 117 case 4: 118 return Boolean.class; 106 119 } 107 120 return null; … … 137 150 col.setMaxWidth(w); 138 151 break; 152 case 4: 153 w = 60; 154 col.setPreferredWidth(w); 155 col.setMinWidth(w); 156 col.setMaxWidth(w); 157 break; 139 158 } 140 159 } … … 145 164 public void reloadData() { 146 165 items = DepotManager.getInstance().getModPackageNodes(); 166 install = new Vector<Boolean>(); 167 // TODO check installed 168 for (int i = 0; i < items.size(); i++) { 169 install.add(i, false); 170 } 147 171 } 148 172 … … 156 180 } 157 181 182 @Override 183 public boolean isCellEditable(int rowIndex, int columnIndex) { 184 return columnIndex == 4; 185 } 186 187 @Override 188 public void setValueAt(Object aValue, int rowIndex, int columnIndex) { 189 super.setValueAt(aValue, rowIndex, columnIndex); 190 if (columnIndex == 4) { 191 install.set(rowIndex, (Boolean) aValue); 192 } 193 } 194 158 195 } -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTableModel.properties
r591 r593 3 3 mod.package_number=Pkg# 4 4 mod.platform=Platform 5 mod.install=Install? -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java
r592 r593 9 9 import javax.swing.JComboBox; 10 10 import javax.swing.JComponent; 11 import javax.swing.J Frame;11 import javax.swing.JDialog; 12 12 import javax.swing.JOptionPane; 13 13 import javax.swing.KeyStroke; 14 import javax.swing.SwingUtilities;15 14 import javax.swing.UIManager; 16 15 … … 23 22 * @author Christian Illy 24 23 */ 25 public class SettingsDialog extends J Frame{24 public class SettingsDialog extends JDialog { 26 25 private static final long serialVersionUID = -5719515325671846620L; 27 26 … … 31 30 private BuildResult result = SwingJavaBuilder.build(this, bundle); 32 31 33 private static SettingsDialog openWindow = null;34 35 32 private JComboBox cmbLaF; 36 33 private LaFComboModel laFModel; 37 34 38 35 /** 39 * Open the Settings dialog if not currently opened or brings the existing 40 * one to front 36 * Open the settings 41 37 */ 42 public static void openWindow() { 43 if (openWindow != null) { 44 SwingUtilities.invokeLater(new Runnable() { 45 46 @Override 47 public void run() { 48 openWindow.toFront(); 49 openWindow.repaint(); 50 } 51 }); 52 } else { 53 new SettingsDialog().setVisible(true); 54 } 55 } 56 57 private SettingsDialog() { 58 openWindow = this; 38 public SettingsDialog() { 59 39 setMinimumSize(new Dimension(500, (int) getSize().getHeight() + 0)); 60 40 … … 85 65 86 66 @SuppressWarnings("unused") 87 private void close() {88 openWindow = null;89 }90 91 @SuppressWarnings("unused")92 67 private boolean save() { 93 68 Settings set = Settings.getInstance(); -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.yml
r591 r593 1 J Frame:1 JDialog: 2 2 name: frame 3 3 title: frame.title … … 5 5 locationRelativeTo: null 6 6 defaultCloseOperation: disposeOnClose 7 onWindowClosed: [close]8 iconImage: img.kdt7 iconImage: img.ae 8 modalityType: applicationModal 9 9 content: 10 10 - JButton(name=btnOk, text=btnOk, onAction=[save,dispose])
Note:
See TracChangeset
for help on using the changeset viewer.