Changeset 658 for AE/installer2/src/net/oni2/aeinstaller/gui/modtable
- Timestamp:
- Jan 29, 2013, 1:34:16 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/gui/modtable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTable.java
r657 r658 70 70 /** 71 71 * Create a new ModTable 72 */ 73 public ModTable() { 72 * 73 * @param contentType 74 * Content to show 75 */ 76 public ModTable(ETableContentType contentType) { 74 77 super(); 78 79 this.contentType = contentType; 75 80 76 81 setSelectionMode(ListSelectionModel.SINGLE_SELECTION); … … 81 86 ((JComponent) getDefaultRenderer(Boolean.class)).setOpaque(true); 82 87 83 model = new ModTableModel( );88 model = new ModTableModel(contentType); 84 89 85 90 setModel(model); … … 101 106 for (int i = 0; i < model.getColumnCount(); i++) { 102 107 model.setColumnConstraints(i, getColumnModel().getColumn(i)); 108 } 109 110 if (contentType != ETableContentType.MODS) { 111 getColumnModel().removeColumn(getColumnModel().getColumn(0)); 103 112 } 104 113 } -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTableModel.java
r657 r658 14 14 import net.oni2.aeinstaller.backend.packages.Package; 15 15 import net.oni2.aeinstaller.backend.packages.PackageManager; 16 import net.oni2.aeinstaller.gui.modtable.ModTable.ETableContentType; 16 17 17 18 /** … … 32 33 private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 33 34 35 private ETableContentType contentType = ETableContentType.MODS; 36 34 37 /** 35 38 * Create a new model 36 */ 37 public ModTableModel() { 39 * 40 * @param contentType 41 * Content type to show 42 */ 43 public ModTableModel(ETableContentType contentType) { 44 this.contentType = contentType; 38 45 } 39 46 … … 182 189 public void reloadData() { 183 190 items.clear(); 184 items.addAll(PackageManager.getInstance().getModsValidAndNotCore()); 191 switch (contentType) { 192 case MODS: 193 items.addAll(PackageManager.getInstance() 194 .getModsValidAndNotCore()); 195 break; 196 case TOOLS: 197 items.addAll(PackageManager.getInstance().getTools()); 198 break; 199 case CORE: 200 items.addAll(PackageManager.getInstance().getCoreTools()); 201 items.addAll(PackageManager.getInstance().getCoreMods()); 202 break; 203 } 185 204 revertSelection(); 186 205 } … … 205 224 */ 206 225 public void reloadSelection(File config) { 207 Vector<Integer> selected = PackageManager.getInstance() 208 .loadModSelection(config); 209 install.clear(); 210 for (int i = 0; i < items.size(); i++) { 211 install.add(i, selected.contains(items.get(i).getPackageNumber())); 212 } 213 fireTableDataChanged(); 226 if (contentType == ETableContentType.MODS) { 227 Vector<Integer> selected = PackageManager.getInstance() 228 .loadModSelection(config); 229 install.clear(); 230 for (int i = 0; i < items.size(); i++) { 231 install.add(i, 232 selected.contains(items.get(i).getPackageNumber())); 233 } 234 fireTableDataChanged(); 235 } 214 236 } 215 237
Note:
See TracChangeset
for help on using the changeset viewer.