Changeset 640 for AE/installer2/src/net/oni2/aeinstaller/gui
- Timestamp:
- Jan 20, 2013, 7:02:43 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r639 r640 122 122 + SwingJavaBuilder.getConfig().getResource("appversion")); 123 123 124 setSize(getWidth() +150, getHeight());124 setSize(getWidth() + 150, getHeight()); 125 125 contents.setDividerLocation(500); 126 126 contents.setResizeWeight(0.4); … … 384 384 toolsMenuItems.clear(); 385 385 for (Mod m : ModManager.getInstance().getInstalledTools()) { 386 if (m.getExeFile() != null && m.getExeFile().exists()) { 386 File exe = m.getExeFile(); 387 if (exe != null && exe.exists()) { 387 388 JMenuItem item = new JMenuItem(); 388 389 final Vector<String> params = new Vector<String>(); 389 params.add(m.getExeFile().getPath()); 390 if (exe.getName().toLowerCase().endsWith(".jar")) { 391 File jre = null; 392 if (Settings.getPlatform() == Platform.WIN) 393 jre = new File(System.getProperties().getProperty( 394 "java.home"), "bin/javaw.exe"); 395 else 396 jre = new File(System.getProperties().getProperty( 397 "java.home"), "bin/java"); 398 params.add(jre.getPath()); 399 params.add("-jar"); 400 } 401 params.add(exe.getPath()); 390 402 final File wd = m.getWorkingDir(); 391 403 Icon ico = null; -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r637 r640 6 6 import java.util.ResourceBundle; 7 7 import java.util.TreeMap; 8 import java.util.TreeSet; 8 9 9 10 import javax.swing.AbstractAction; … … 23 24 import javax.swing.event.ListSelectionListener; 24 25 26 import net.oni2.aeinstaller.backend.Settings; 25 27 import net.oni2.aeinstaller.backend.SizeFormatter; 26 28 import net.oni2.aeinstaller.backend.mods.Mod; … … 28 30 import net.oni2.aeinstaller.backend.oni.Installer; 29 31 import net.oni2.aeinstaller.gui.HTMLLinkLabel; 32 import net.oni2.aeinstaller.gui.downloadwindow.Downloader; 30 33 31 34 import org.javabuilders.BuildResult; … … 45 48 46 49 private JSplitPane contents; 47 50 48 51 private JList lstTools; 49 52 53 private JLabel lblTitleVal; 50 54 private JLabel lblSubmitterVal; 51 55 private JLabel lblCreatorVal; … … 101 105 @SuppressWarnings("unused") 102 106 private void install() { 103 // TODO: care for offline mode 104 JOptionPane.showMessageDialog(this, "install", "todo", 105 JOptionPane.INFORMATION_MESSAGE); 106 } 107 Object o = lstTools.getSelectedValue(); 108 if (o instanceof Mod) { 109 Mod theMod = (Mod) o; 107 110 108 @SuppressWarnings("unused") 109 private void installDone() { 111 if (theMod.isInstalled()) { 112 TreeSet<Mod> tools = new TreeSet<Mod>(); 113 tools.add(theMod); 114 Installer.uninstallTools(tools); 115 } else { 116 if (!theMod.isLocalAvailable()) { 117 if (Settings.getInstance().isOfflineMode()) { 118 JOptionPane.showMessageDialog(this, 119 bundle.getString("offlineMode.text"), 120 bundle.getString("offlineMode.title"), 121 JOptionPane.WARNING_MESSAGE); 122 return; 123 } 124 125 TreeSet<Mod> toDownload = new TreeSet<Mod>(); 126 toDownload.add(theMod); 127 128 Downloader dl = new Downloader(toDownload); 129 try { 130 dl.setVisible(true); 131 if (!dl.isFinished()) 132 return; 133 } finally { 134 dl.dispose(); 135 } 136 } 137 138 TreeSet<Mod> tools = new TreeSet<Mod>(); 139 tools.add(theMod); 140 Installer.installTools(tools); 141 } 142 } 143 valueChanged(null); 110 144 } 111 145 112 146 @Override 113 147 public void valueChanged(ListSelectionEvent evt) { 148 lblTitleVal.setText(""); 114 149 lblSubmitterVal.setText(""); 115 150 lblCreatorVal.setText(""); … … 123 158 if (lstTools.getSelectedValue() instanceof Mod) { 124 159 Mod m = (Mod) lstTools.getSelectedValue(); 125 lblSubmitterVal.setText(m.getName()); 160 lblTitleVal.setText(m.getName()); 161 lblSubmitterVal.setText(m.getSubmitter()); 126 162 lblCreatorVal.setText(m.getCreator()); 127 163 lblDescriptionVal.setText(m.getDescription()); … … 130 166 lblDownloadSizeVal.setText(SizeFormatter.format(m.getZipSize(), 3)); 131 167 btnInstall.setEnabled(true); 132 if ( Installer.getInstalledTools().contains(m.getPackageNumber())) {168 if (m.isInstalled()) { 133 169 btnInstall.setText(bundle.getString("btnInstall.un.text")); 134 170 btnInstall.setToolTipText(bundle -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.yml
r626 r640 16 16 scrollTools [grow] 17 17 - JPanel(name=panInfo): 18 - JLabel(name=lblTitle, text=lblTitle.text) 19 - JLabel(name=lblTitleVal) 18 20 - JLabel(name=lblSubmitter, text=lblSubmitter.text) 19 21 - JLabel(name=lblSubmitterVal) … … 29 31 - JLabel(name=lblDownloadSize, text=lblDownloadSize.text) 30 32 - JLabel(name=lblDownloadSizeVal) 31 - JButton(name=btnInstall, icon=img.install, text=btnInstall.text, toolTipText=btnInstall.tooltip, enabled=false, onAction=[install ,installDone])33 - JButton(name=btnInstall, icon=img.install, text=btnInstall.text, toolTipText=btnInstall.tooltip, enabled=false, onAction=[install]) 32 34 - MigLayout: | 33 35 [min] [grow] 36 >lblTitle lblTitleVal [min] 34 37 >lblSubmitter lblSubmitterVal [min] 35 38 >lblCreator lblCreatorVal [min]
Note:
See TracChangeset
for help on using the changeset viewer.