- Timestamp:
- Jan 29, 2013, 12:43:01 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTable.java
r648 r657 19 19 import javax.swing.JComponent; 20 20 import javax.swing.JMenuItem; 21 import javax.swing.JOptionPane; 21 22 import javax.swing.JPopupMenu; 22 23 import javax.swing.JTable; … … 42 43 .getBundle("net.oni2.aeinstaller.localization.ModTable"); 43 44 45 /** 46 * @author Christian Illy 47 */ 48 public enum ETableContentType { 49 /** 50 * Table showing mods 51 */ 52 MODS, 53 /** 54 * Table showing tools 55 */ 56 TOOLS, 57 /** 58 * Table showing core packages 59 */ 60 CORE 61 }; 62 44 63 private HashSet<ModSelectionListener> modSelListeners = new HashSet<ModSelectionListener>(); 45 64 46 65 private ModTableModel model; 47 66 private TableRowSorter<ModTableModel> sorter; 67 68 private ETableContentType contentType = ETableContentType.MODS; 48 69 49 70 /** … … 186 207 */ 187 208 public void setFilter(Type type, int downloadState) { 188 sorter.setRowFilter(new ModTableFilter(type, downloadState)); 209 sorter.setRowFilter(new ModTableFilter(type, downloadState, 210 contentType == ETableContentType.CORE, false)); 189 211 } 190 212 … … 203 225 } 204 226 } 227 } 228 229 /** 230 * Select/Unselect all currently visible items depending on the current 231 * state of selection 232 */ 233 public void unSelectAll() { 234 boolean isAll = true; 235 for (int i = 0; i < getRowCount(); i++) { 236 int modRow = convertRowIndexToModel(i); 237 boolean inst = (Boolean) model.getValueAt(modRow, 0); 238 if (!inst) { 239 isAll = false; 240 break; 241 } 242 } 243 244 for (int i = 0; i < getRowCount(); i++) { 245 int modRow = convertRowIndexToModel(i); 246 model.setValueAt(!isAll, modRow, 0); 247 } 248 invalidate(); 249 repaint(); 205 250 } 206 251 … … 267 312 } 268 313 314 if (mod.isLocalAvailable() 315 && contentType != ETableContentType.CORE) { 316 // Delete package folder item 317 JMenuItem deleteModFolder = new JMenuItem( 318 bundle.getString("deletePackage.text")); 319 deleteModFolder.addActionListener(new ActionListener() { 320 @Override 321 public void actionPerformed(ActionEvent arg0) { 322 if (mod.getNode() == null) { 323 JOptionPane.showMessageDialog( 324 null, 325 bundle.getString("deletePackageLocalOnly.text"), 326 bundle.getString("deletePackageLocalOnly.title"), 327 JOptionPane.INFORMATION_MESSAGE); 328 } else { 329 int res = JOptionPane.showConfirmDialog( 330 null, 331 bundle.getString("deletePackageConfirm.text"), 332 bundle.getString("deletePackageConfirm.title"), 333 JOptionPane.YES_NO_OPTION, 334 JOptionPane.WARNING_MESSAGE); 335 if (res == JOptionPane.YES_OPTION) { 336 mod.deleteLocalPackage(); 337 invalidate(); 338 repaint(); 339 } 340 } 341 } 342 }); 343 popup.add(deleteModFolder); 344 } 345 269 346 if (popup.getSubElements().length > 0) 270 347 popup.show(e.getComponent(), e.getX(), e.getY());
Note:
See TracChangeset
for help on using the changeset viewer.