Changeset 626 for AE/installer2/src/net
- Timestamp:
- Jan 17, 2013, 8:52:55 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r625 r626 1 1 appname=AE Installer 2 2 appversion=0.8 52 appversion=0.86 3 3 4 4 invalidPath.title=Wrong directory -
AE/installer2/src/net/oni2/aeinstaller/backend/depot/DepotConfig.java
r621 r626 1 1 package net.oni2.aeinstaller.backend.depot; 2 3 import java.util.TreeSet; 2 4 3 5 import net.oni2.aeinstaller.backend.Settings; … … 65 67 66 68 /** 67 * @return Taxonomy term name for modtype Tool69 * @return Taxonomy term names for mods of type Tool 68 70 */ 69 public static String getTaxonomyName_ModType_Tool() { 70 return "Tool"; 71 public static TreeSet<String> getTaxonomyName_ModType_Tool() { 72 TreeSet<String> res = new TreeSet<String>(); 73 res.add("Tool"); 74 res.add("Patch"); 75 return res; 71 76 } 72 77 -
AE/installer2/src/net/oni2/aeinstaller/backend/depot/model/NodeMod.java
r603 r626 153 153 */ 154 154 public boolean isTool() { 155 TaxonomyTerm tt = DepotManager.getInstance().getTaxonomyTerm( 156 DepotConfig.getTaxonomyName_ModType_Tool()); 157 return getTypes().contains(tt); 155 HashSet<TaxonomyTerm> types = getTypes(); 156 for (String s : DepotConfig.getTaxonomyName_ModType_Tool()) { 157 TaxonomyTerm tt = DepotManager.getInstance().getTaxonomyTerm(s); 158 if (types.contains(tt)) 159 return true; 160 } 161 return false; 158 162 } 159 163 } -
AE/installer2/src/net/oni2/aeinstaller/backend/mods/ModManager.java
r624 r626 10 10 import java.util.HashMap; 11 11 import java.util.HashSet; 12 import java.util.TreeMap; 12 13 import java.util.TreeSet; 13 14 import java.util.Vector; … … 208 209 * @return Collection of tools valid on this platform and not mandatory 209 210 */ 210 public Collection<Mod> getTools() {211 Vector<Mod> res = new Vector<Mod>();211 public TreeMap<String, Mod> getTools() { 212 TreeMap<String, Mod> res = new TreeMap<String, Mod>(); 212 213 for (Mod m : tools.values()) 213 214 if (m.isValidOnPlatform() && !m.isMandatoryMod()) 214 res. add(m);215 res.put(m.getName(), m); 215 216 return res; 216 217 } -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r625 r626 1 1 package net.oni2.aeinstaller.gui.toolmanager; 2 2 3 import java.awt.Dimension; 4 import java.awt.event.ActionEvent; 5 import java.awt.event.KeyEvent; 6 import java.util.ResourceBundle; 7 import java.util.TreeMap; 8 9 import javax.swing.AbstractAction; 10 import javax.swing.DefaultListModel; 11 import javax.swing.JButton; 12 import javax.swing.JComponent; 3 13 import javax.swing.JDialog; 14 import javax.swing.JLabel; 15 import javax.swing.JList; 16 import javax.swing.JOptionPane; 17 import javax.swing.KeyStroke; 18 import javax.swing.ListSelectionModel; 19 import javax.swing.event.ListSelectionEvent; 20 import javax.swing.event.ListSelectionListener; 21 22 import net.oni2.aeinstaller.backend.SizeFormatter; 23 import net.oni2.aeinstaller.backend.mods.Mod; 24 import net.oni2.aeinstaller.backend.mods.ModManager; 25 import net.oni2.aeinstaller.backend.oni.Installer; 26 import net.oni2.aeinstaller.gui.HTMLLinkLabel; 27 28 import org.javabuilders.BuildResult; 29 import org.javabuilders.swing.SwingJavaBuilder; 4 30 5 31 /** 6 32 * @author Christian Illy 7 33 */ 8 public class ToolManager extends JDialog {34 public class ToolManager extends JDialog implements ListSelectionListener { 9 35 private static final long serialVersionUID = 343221630538866384L; 10 36 11 //TODO 37 private ResourceBundle bundle = ResourceBundle.getBundle(getClass() 38 .getName()); 39 @SuppressWarnings("unused") 40 private BuildResult result = SwingJavaBuilder.build(this, bundle); 41 42 private JList lstTools; 43 44 private JLabel lblSubmitterVal; 45 private JLabel lblCreatorVal; 46 private JLabel lblPlatformVal; 47 private JLabel lblPackageNumberVal; 48 private HTMLLinkLabel lblDescriptionVal; 49 private JLabel lblDownloadSizeVal; 50 51 private JButton btnInstall; 52 53 /** 54 * Open the dialog 55 */ 56 public ToolManager() { 57 setMinimumSize(new Dimension(getWidth() + 100, getHeight() + 100)); 58 59 AbstractAction closeAction = new AbstractAction() { 60 61 private static final long serialVersionUID = 1L; 62 63 public void actionPerformed(ActionEvent arg0) { 64 dispose(); 65 } 66 }; 67 KeyStroke ksCtrlW = KeyStroke 68 .getKeyStroke('W', KeyEvent.CTRL_DOWN_MASK); 69 getRootPane() 70 .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) 71 .put(ksCtrlW, "close"); 72 getRootPane().getActionMap().put("close", closeAction); 73 74 lstTools.addListSelectionListener(this); 75 lstTools.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 76 77 DefaultListModel dlm = new DefaultListModel(); 78 TreeMap<String, Mod> tools = ModManager.getInstance().getTools(); 79 for (String name : tools.keySet()) 80 dlm.addElement(tools.get(name)); 81 } 82 83 @SuppressWarnings("unused") 84 private void install() { 85 // TODO: care for offline mode 86 JOptionPane.showMessageDialog(this, "install", "todo", 87 JOptionPane.INFORMATION_MESSAGE); 88 } 89 90 @SuppressWarnings("unused") 91 private void installDone() { 92 } 93 94 @Override 95 public void valueChanged(ListSelectionEvent evt) { 96 lblSubmitterVal.setText(""); 97 lblCreatorVal.setText(""); 98 lblDescriptionVal.setText(""); 99 lblPlatformVal.setText(""); 100 lblPackageNumberVal.setText(""); 101 lblDownloadSizeVal.setText(""); 102 btnInstall.setEnabled(false); 103 104 if (lstTools.getSelectedValue() instanceof Mod) { 105 Mod m = (Mod) lstTools.getSelectedValue(); 106 lblSubmitterVal.setText(m.getName()); 107 lblCreatorVal.setText(m.getCreator()); 108 lblDescriptionVal.setText(m.getDescription()); 109 lblPlatformVal.setText(m.getPlatform().toString()); 110 lblPackageNumberVal.setText(m.getPackageNumberString()); 111 lblDownloadSizeVal.setText(SizeFormatter.format(m.getZipSize(), 3)); 112 btnInstall.setEnabled(true); 113 if (Installer.getInstalledTools().contains(m.getPackageNumber())) { 114 btnInstall.setText(bundle.getString("btnInstall.un.text")); 115 btnInstall.setToolTipText(bundle 116 .getString("btnInstall.un.tooltip")); 117 } else { 118 btnInstall.setText(bundle.getString("btnInstall.text")); 119 btnInstall.setToolTipText(bundle 120 .getString("btnInstall.tooltip")); 121 } 122 } 123 } 12 124 }
Note:
See TracChangeset
for help on using the changeset viewer.