Changeset 646 for AE/installer2/src/net/oni2/aeinstaller/gui
- Timestamp:
- Jan 23, 2013, 12:43:13 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/gui
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r645 r646 54 54 import net.oni2.aeinstaller.gui.about.AboutDialog; 55 55 import net.oni2.aeinstaller.gui.downloadwindow.Downloader; 56 import net.oni2.aeinstaller.gui.mandatorypackages.MandatoryPackagesDialog; 56 57 import net.oni2.aeinstaller.gui.modtable.DownloadSizeListener; 57 58 import net.oni2.aeinstaller.gui.modtable.ModSelectionListener; … … 117 118 private EInstallState installState = EInstallState.DONE; 118 119 private TreeSet<Mod> installMods = null; 120 private TreeSet<Mod> installDeps = null; 119 121 120 122 /** … … 275 277 private void doUpdate() { 276 278 if (execUpdates != null && execUpdates.size() > 0) { 277 Downloader dl = new Downloader(execUpdates );279 Downloader dl = new Downloader(execUpdates, null); 278 280 try { 279 281 dl.setVisible(true); … … 308 310 309 311 } 310 312 311 313 @SuppressWarnings("unused") 312 314 private void showMandatoryPackagesDialog() { 313 // TODO: open mand-pack-dialog315 new MandatoryPackagesDialog().setVisible(true); 314 316 } 315 317 … … 454 456 @Override 455 457 public void updateStatus(ModDownloader source, 456 State state, int filesDown, int filesTotal, 458 Mod currentDownload, State state, 459 int filesDown, int filesTotal, 457 460 int bytesDown, int bytesTotal, 458 461 int duration, int remaining, int speed) { … … 497 500 mods.addAll(tblMods.getSelectedMods()); 498 501 502 installDeps = new TreeSet<Mod>(); 503 499 504 installState = EInstallState.CHECKING; 500 505 … … 510 515 } 511 516 if (toDownload.size() > 0) { 512 Downloader dl = new Downloader(toDownload );517 Downloader dl = new Downloader(toDownload, installDeps); 513 518 try { 514 519 dl.setVisible(true); … … 524 529 .checkDependencies(mods); 525 530 if (dependencies.size() > 0) { 526 int size = 0; 527 String depsLocalString = ""; 528 String depsDownloadString = ""; 529 for (Mod m : dependencies.keySet()) { 530 for (Mod mDep : dependencies.get(m)) { 531 if (!mods.contains(mDep)) { 531 for (HashSet<Mod> hm : dependencies.values()) { 532 installDeps.addAll(hm); 533 for (Mod mDep : hm) { 534 if (!mods.contains(mDep)) 532 535 mods.add(mDep); 533 if (!mDep.isLocalAvailable()) { 534 size += mDep.getZipSize(); 535 if (depsDownloadString.length() > 0) 536 depsDownloadString += "\n"; 537 depsDownloadString += " - " + mDep.getName(); 538 } else { 539 if (depsLocalString.length() > 0) 540 depsLocalString += "\n"; 541 depsLocalString += " - " + mDep.getName(); 536 } 537 } 538 539 if (!Settings.getInstance() 540 .get("notifyDepsAfterInstall", false)) { 541 int size = 0; 542 String depsLocalString = ""; 543 String depsDownloadString = ""; 544 for (Mod m : dependencies.keySet()) { 545 for (Mod mDep : dependencies.get(m)) { 546 if (!mods.contains(mDep)) { 547 mods.add(mDep); 548 if (!mDep.isLocalAvailable()) { 549 size += mDep.getZipSize(); 550 if (depsDownloadString.length() > 0) 551 depsDownloadString += "\n"; 552 depsDownloadString += " - " 553 + mDep.getName(); 554 } else { 555 if (depsLocalString.length() > 0) 556 depsLocalString += "\n"; 557 depsLocalString += " - " + mDep.getName(); 558 } 542 559 } 543 560 } 544 561 } 545 } 546 if (depsLocalString.length() == 0) 547 depsLocalString = bundle 548 .getString("installDependencies.none"); 549 if (depsDownloadString.length() == 0) 550 depsDownloadString = bundle 551 .getString("installDependencies.none"); 552 553 int res = JOptionPane.showConfirmDialog(this, String.format( 554 bundle.getString("installDependencies.text"), 555 depsLocalString, depsDownloadString, 556 SizeFormatter.format(size, 3)), bundle 557 .getString("installDependencies.title"), 558 JOptionPane.YES_NO_OPTION, 559 JOptionPane.INFORMATION_MESSAGE); 560 if (res == JOptionPane.NO_OPTION) { 561 installState = EInstallState.ABORTED; 562 break; 562 if (depsLocalString.length() == 0) 563 depsLocalString = bundle 564 .getString("installDependencies.none"); 565 if (depsDownloadString.length() == 0) 566 depsDownloadString = bundle 567 .getString("installDependencies.none"); 568 569 int res = JOptionPane.showConfirmDialog(this, String 570 .format(bundle 571 .getString("installDependencies.text"), 572 depsLocalString, depsDownloadString, 573 SizeFormatter.format(size, 3)), bundle 574 .getString("installDependencies.title"), 575 JOptionPane.YES_NO_OPTION, 576 JOptionPane.INFORMATION_MESSAGE); 577 if (res == JOptionPane.NO_OPTION) { 578 installState = EInstallState.ABORTED; 579 break; 580 } 563 581 } 564 582 } else { … … 635 653 case DONE: 636 654 revertSelection(); 637 JOptionPane.showMessageDialog(this, 638 bundle.getString("installDone.text"), 639 bundle.getString("installDone.title"), 640 JOptionPane.INFORMATION_MESSAGE); 655 if (installDeps.size() > 0 656 && Settings.getInstance().get("notifyDepsAfterInstall", 657 false)) { 658 String installedDeps = ""; 659 for (Mod m : installDeps) { 660 if (installedDeps.length() > 0) 661 installedDeps += "\n"; 662 installedDeps += " - " + m.getName(); 663 } 664 JOptionPane.showMessageDialog(this, String.format( 665 bundle.getString("installDoneDeps.text"), 666 installedDeps), bundle 667 .getString("installDone.title"), 668 JOptionPane.INFORMATION_MESSAGE); 669 } else { 670 JOptionPane.showMessageDialog(this, 671 bundle.getString("installDone.text"), 672 bundle.getString("installDone.title"), 673 JOptionPane.INFORMATION_MESSAGE); 674 } 641 675 break; 642 676 case OFFLINE: … … 649 683 break; 650 684 } 685 installDeps = null; 651 686 } 652 687 -
AE/installer2/src/net/oni2/aeinstaller/gui/downloadwindow/Downloader.java
r638 r646 31 31 private BuildResult result = SwingJavaBuilder.build(this, bundle); 32 32 33 private JLabel lblNameVal; 34 private JLabel lblIsDep; 33 35 private JLabel lblElapsedVal; 34 36 private JLabel lblRemainingVal; … … 37 39 private JLabel lblRateVal; 38 40 private JProgressBar progress; 39 41 40 42 private JButton btnAbort; 41 43 42 44 private ModDownloader downloader; 45 private TreeSet<Mod> dependencies = new TreeSet<Mod>(); 43 46 44 47 /** 45 48 * @param mods 46 49 * Mods to download 50 * @param dependencies 51 * List of mods that only are auto-resolved dependencies 47 52 */ 48 public Downloader(TreeSet<Mod> mods ) {53 public Downloader(TreeSet<Mod> mods, TreeSet<Mod> dependencies) { 49 54 super(); 50 55 51 56 setResizable(false); 52 57 setSize(500, (int) getSize().getHeight()); 58 59 if (dependencies != null) 60 this.dependencies = dependencies; 53 61 54 62 downloader = new ModDownloader(mods, this); … … 84 92 85 93 @Override 86 public void updateStatus(ModDownloader source, State state, int filesDown,87 int filesTotal, int bytesDown, int bytesTotal, int duration,88 int remaining, int speed) {94 public void updateStatus(ModDownloader source, Mod currentDownload, 95 State state, int filesDown, int filesTotal, int bytesDown, 96 int bytesTotal, int duration, int remaining, int speed) { 89 97 if (state == ModDownloader.State.FINISHED) { 90 98 close(); … … 92 100 if (state == State.LAST_FILE_DOWNLOADED) 93 101 btnAbort.setEnabled(false); 94 102 95 103 progress.setValue(bytesDown); 96 104 progress.setToolTipText(String.format("%d / %d files downloaded", 97 105 filesDown, filesTotal)); 106 107 if (currentDownload != null) { 108 lblNameVal.setText(currentDownload.getName()); 109 lblIsDep.setVisible(dependencies.contains(currentDownload)); 110 } else { 111 lblNameVal.setText(bundle.getString("unpacking")); 112 lblIsDep.setVisible(false); 113 } 98 114 99 115 lblElapsedVal.setText(formatTime(duration)); -
AE/installer2/src/net/oni2/aeinstaller/gui/downloadwindow/Downloader.yml
r605 r646 10 10 content: 11 11 - JButton(name=btnAbort, text=btnAbort.title, icon=img.stop, onAction=[confirm,close]) 12 - JLabel(name=lblName, text=lblName.title) 13 - JLabel(name=lblNameVal, font=14pt) 14 - JLabel(name=lblIsDep, text=lblIsDep.title, foreground=darkred, visible=false) 12 15 - JLabel(name=lblElapsed, text=lblElapsed.title) 13 16 - JLabel(name=lblElapsedVal) … … 23 26 - MigLayout: | 24 27 [grow] 28 lblName<,lblNameVal<,lblIsDep< [min] 25 29 lblElapsed=1,lblElapsedVal=2,lblRemaining=1,lblRemainingVal=2 [min] 26 30 lblDownloaded=1,lblDownloadedVal=2,lblTotal=1,lblTotalVal=2 [min] -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTableModel.java
r638 r646 30 30 private HashSet<DownloadSizeListener> listeners = new HashSet<DownloadSizeListener>(); 31 31 32 private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 33 32 34 /** 33 35 * Create a new model … … 58 60 return res; 59 61 case 5: 60 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");61 62 if (mod.getFile() != null) 62 63 return sdf.format(new Date( … … 177 178 install.add(i, items.get(i).isInstalled()); 178 179 } 180 notifyDownloadSize(0); 179 181 fireTableDataChanged(); 180 182 } … … 220 222 public boolean isCellEditable(int rowIndex, int columnIndex) { 221 223 return columnIndex == 0; 224 } 225 226 private void notifyDownloadSize(int size) { 227 for (DownloadSizeListener dsl : listeners) 228 dsl.downloadSizeChanged(size); 222 229 } 223 230 … … 236 243 } 237 244 } 238 for (DownloadSizeListener dsl : listeners) 239 dsl.downloadSizeChanged(size); 245 notifyDownloadSize(size); 240 246 } 241 247 } -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java
r641 r646 35 35 36 36 private JCheckBox chkNotifyOnStart; 37 private JCheckBox chkNotifyDepsAfterInstall; 37 38 private JCheckBox chkCopyIntro; 38 39 private JCheckBox chkCopyOutro; … … 71 72 72 73 chkNotifyOnStart.setSelected(set.get("notifyupdates", true)); 74 chkNotifyDepsAfterInstall.setSelected(set.get("notifyDepsAfterInstall", false)); 73 75 chkCopyIntro.setSelected(set.get("copyintro", false)); 74 76 chkCopyOutro.setSelected(set.get("copyoutro", true)); … … 80 82 81 83 set.put("notifyupdates", chkNotifyOnStart.isSelected()); 84 set.put("notifyDepsAfterInstall", chkNotifyDepsAfterInstall.isSelected()); 82 85 set.put("copyintro", chkCopyIntro.isSelected()); 83 86 set.put("copyoutro", chkCopyOutro.isSelected()); -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.yml
r625 r646 13 13 - JLabel(name=lblNotifyOnStart, text=lblNotifyOnStart) 14 14 - JCheckBox(name=chkNotifyOnStart) 15 - JLabel(name=lblNotifyDepsAfterInstall, text=lblNotifyDepsAfterInstall, toolTipText=lblNotifyDepsAfterInstall.tooltip) 16 - JCheckBox(name=chkNotifyDepsAfterInstall, toolTipText=lblNotifyDepsAfterInstall.tooltip) 15 17 - JLabel(name=lblCopyIntro, text=lblCopyIntro) 16 18 - JCheckBox(name=chkCopyIntro) … … 18 20 - JCheckBox(name=chkCopyOutro) 19 21 - MigLayout: | 20 [min] [grow] 21 >lblNotifyOnStart chkNotifyOnStart [pref] 22 >lblCopyIntro chkCopyIntro [pref] 23 >lblCopyOutro chkCopyOutro [pref] 22 [min] [grow] 23 >lblNotifyOnStart chkNotifyOnStart [pref] 24 >lblNotifyDepsAfterInstall chkNotifyDepsAfterInstall [pref] 25 >lblCopyIntro chkCopyIntro [pref] 26 >lblCopyOutro chkCopyOutro [pref] 24 27 - JPanel(name=panUI, groupTitle=panUI): 25 28 - JLabel(name=lblLaF, text=lblLaF) -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r641 r646 4 4 import java.awt.event.ActionEvent; 5 5 import java.awt.event.KeyEvent; 6 import java.text.SimpleDateFormat; 7 import java.util.Date; 6 8 import java.util.ResourceBundle; 7 9 import java.util.TreeMap; … … 55 57 private JLabel lblPlatformVal; 56 58 private JLabel lblPackageNumberVal; 59 private JLabel lblVersionNumberVal; 60 private JLabel lblLastChangeVal; 57 61 private HTMLLinkLabel lblDescriptionVal; 58 62 private JLabel lblDownloadSizeVal; … … 62 66 private Icon icoInstall = null; 63 67 private Icon icoUninstall = null; 68 69 private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 64 70 65 71 /** … … 100 106 icoUninstall = new ImageIcon(getClass().getResource( 101 107 SwingJavaBuilder.getConfig().getResource("img.uninstall"))); 102 108 103 109 setLocationRelativeTo(null); 104 110 } … … 127 133 toDownload.add(theMod); 128 134 129 Downloader dl = new Downloader(toDownload );135 Downloader dl = new Downloader(toDownload, null); 130 136 try { 131 137 dl.setVisible(true); … … 152 158 lblPlatformVal.setText(""); 153 159 lblPackageNumberVal.setText(""); 160 lblVersionNumberVal.setText(""); 161 lblLastChangeVal.setText(""); 154 162 lblDownloadSizeVal.setText(""); 155 163 btnInstall.setEnabled(false); … … 163 171 lblPlatformVal.setText(m.getPlatform().toString()); 164 172 lblPackageNumberVal.setText(m.getPackageNumberString()); 173 lblVersionNumberVal.setText(m.getVersion()); 174 if (m.getFile() != null) 175 lblLastChangeVal.setText(sdf.format(new Date(m.getFile() 176 .getTimestamp() * 1000))); 165 177 lblDownloadSizeVal.setText(SizeFormatter.format(m.getZipSize(), 3)); 166 178 btnInstall.setEnabled(true); -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.yml
r641 r646 24 24 - JLabel(name=lblPackageNumber, text=lblPackageNumber.text) 25 25 - JLabel(name=lblPackageNumberVal) 26 - JLabel(name=lblVersionNumber, text=lblVersionNumber.text) 27 - JLabel(name=lblVersionNumberVal) 28 - JLabel(name=lblLastChange, text=lblLastChange.text) 29 - JLabel(name=lblLastChangeVal) 26 30 - JLabel(name=lblDescription, text=lblDescription.text) 27 31 - JScrollPane(name=scrollDescription, vScrollBar=always, hScrollBar=asNeeded): … … 36 40 >lblPlatform lblPlatformVal [min] 37 41 >lblPackageNumber lblPackageNumberVal [min] 42 >lblVersionNumber lblVersionNumberVal [min] 43 >lblLastChange lblLastChangeVal [min] 38 44 >^lblDescription scrollDescription [grow] 39 45 >lblDownloadSize lblDownloadSizeVal [min]
Note:
See TracChangeset
for help on using the changeset viewer.