Changeset 645 for AE/installer2/src/net/oni2/aeinstaller/gui/modtable
- Timestamp:
- Jan 22, 2013, 10:24:47 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTable.java
r639 r645 26 26 import javax.swing.SortOrder; 27 27 import javax.swing.event.ListSelectionEvent; 28 import javax.swing.event.RowSorterEvent; 28 29 import javax.swing.table.TableRowSorter; 29 30 31 import net.oni2.aeinstaller.backend.Settings; 30 32 import net.oni2.aeinstaller.backend.mods.Mod; 31 33 import net.oni2.aeinstaller.backend.mods.Type; … … 68 70 69 71 List<RowSorter.SortKey> sortKeys = new ArrayList<RowSorter.SortKey>(); 70 sortKeys.add(new RowSorter.SortKey(1, SortOrder.ASCENDING)); 72 73 int sortCol = Settings.getInstance().get("modSortColumn", 1); 74 SortOrder sortOrder = SortOrder.valueOf(Settings.getInstance().get( 75 "modSortOrder", "ASCENDING")); 76 77 sortKeys.add(new RowSorter.SortKey(sortCol, sortOrder)); 71 78 sorter.setSortKeys(sortKeys); 72 79 … … 180 187 public void setFilter(Type type, int downloadState) { 181 188 sorter.setRowFilter(new ModTableFilter(type, downloadState)); 189 } 190 191 @Override 192 public void sorterChanged(RowSorterEvent evt) { 193 super.sorterChanged(evt); 194 if (evt.getType() == RowSorterEvent.Type.SORT_ORDER_CHANGED) { 195 @SuppressWarnings("unchecked") 196 RowSorter<ModTableModel> rs = (RowSorter<ModTableModel>) getRowSorter(); 197 List<? extends RowSorter.SortKey> keys = rs.getSortKeys(); 198 if (keys.size() > 0) { 199 int col = keys.get(0).getColumn(); 200 SortOrder so = keys.get(0).getSortOrder(); 201 Settings.getInstance().put("modSortColumn", col); 202 Settings.getInstance().put("modSortOrder", so.toString()); 203 } 204 } 182 205 } 183 206 … … 273 296 setRowSelectionInterval(i, i); 274 297 JViewport viewport = (JViewport) getParent(); 275 Rectangle rect = getCellRect(i, 0, 276 true); 298 Rectangle rect = getCellRect(i, 0, true); 277 299 Rectangle r2 = viewport.getVisibleRect(); 278 300 scrollRectToVisible(new Rectangle(rect.x, rect.y,
Note:
See TracChangeset
for help on using the changeset viewer.