Changeset 660
- Timestamp:
- Jan 30, 2013, 11:05:56 AM (12 years ago)
- Location:
- AE/installer2
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/locales/net/oni2/aeinstaller/localization/MainWin_de.properties
r657 r660 43 43 radOnline.text=Online 44 44 radLocal.text=Heruntergeladen 45 lblShowFilter.text=Filter: 45 46 lblDownloadSize.text=Größe der herunterzuladenden Dateien: 46 47 -
AE/installer2/locales/net/oni2/aeinstaller/localization/ModTable_de.properties
r657 r660 6 6 mod.added=Hinzugefügt 7 7 mod.date=Letzte Änderung 8 9 filterTo.ALL=Alles 10 filterTo.NAME=Mod Name 11 filterTo.CREATOR=Entwickler 12 filterTo.DESCRIPTION=Beschreibung 8 13 9 14 state.installed=Ist <b>I</b>nstalliert -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r659 r660 1 1 appname=AE Installer 2 2 appversion=0.99 j2 appversion=0.99k -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r658 r660 7 7 import java.awt.event.ItemEvent; 8 8 import java.awt.event.ItemListener; 9 import java.awt.event.KeyAdapter; 10 import java.awt.event.KeyEvent; 9 11 import java.io.File; 10 12 import java.net.URL; … … 33 35 import javax.swing.JScrollPane; 34 36 import javax.swing.JSplitPane; 37 import javax.swing.JTextField; 35 38 import javax.swing.SwingUtilities; 36 39 import javax.swing.ToolTipManager; … … 57 60 import net.oni2.aeinstaller.gui.downloadwindow.Downloader; 58 61 import net.oni2.aeinstaller.gui.modtable.DownloadSizeListener; 62 import net.oni2.aeinstaller.gui.modtable.EApplyFilterTo; 59 63 import net.oni2.aeinstaller.gui.modtable.ModSelectionListener; 60 64 import net.oni2.aeinstaller.gui.modtable.ModTable; … … 94 98 private JRadioButton radOnline; 95 99 private JRadioButton radLocal; 100 private JTextField txtShowFilter; 101 private JComboBox cmbShowFilterTo; 96 102 private JScrollPane scrollMods; 97 103 private ModTable tblMods; … … 99 105 100 106 private PackageInfoBox pkgInfo; 101 107 102 108 private JButton btnInstall; 103 109 … … 142 148 lblDownloadSizeVal.setText(SizeFormatter.format(0, 2)); 143 149 radAll.setSelected(true); 150 151 for (EApplyFilterTo f : EApplyFilterTo.values()) { 152 cmbShowFilterTo.addItem(f); 153 } 154 txtShowFilter.addKeyListener(new KeyAdapter() { 155 @Override 156 public void keyReleased(KeyEvent e) { 157 super.keyReleased(e); 158 updateTableFilter(); 159 } 160 }); 144 161 145 162 tblMods.addModSelectionListener(this); … … 716 733 if (radLocal.isSelected()) 717 734 downloadState = 2; 718 tblMods.setFilter(t, downloadState); 719 } 720 721 @SuppressWarnings("unused") 722 private void modTypeSelection() { 723 updateTableFilter(); 724 } 725 726 @SuppressWarnings("unused") 727 private void showTypeSelection() { 728 updateTableFilter(); 735 tblMods.setFilter(t, downloadState, txtShowFilter.getText(), 736 (EApplyFilterTo) cmbShowFilterTo.getSelectedItem()); 729 737 } 730 738 -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.yml
r658 r660 51 51 - JPanel(name=panMods): 52 52 - JLabel(name=lblModTypes, text=lblModTypes.text) 53 - JComboBox(name=cmbModTypes, onAction= modTypeSelection)53 - JComboBox(name=cmbModTypes, onAction=updateTableFilter) 54 54 - JLabel(name=lblShowOnly, text=lblShowOnly.text) 55 - JRadioButton(name=radAll, text=radAll.text, onAction= showTypeSelection)56 - JRadioButton(name=radOnline, text=radOnline.text, onAction= showTypeSelection)57 - JRadioButton(name=radLocal, text=radLocal.text, onAction= showTypeSelection)55 - JRadioButton(name=radAll, text=radAll.text, onAction=updateTableFilter) 56 - JRadioButton(name=radOnline, text=radOnline.text, onAction=updateTableFilter) 57 - JRadioButton(name=radLocal, text=radLocal.text, onAction=updateTableFilter) 58 58 - ButtonGroup: [radAll,radOnline,radLocal] 59 - JLabel(name=lblShowFilter, text=lblShowFilter.text) 60 - JTextField(name=txtShowFilter) 61 - JComboBox(name=cmbShowFilterTo, onAction=updateTableFilter) 59 62 - JScrollPane(name=scrollMods, vScrollBar=always, hScrollBar=never) 60 63 - JButton(name=btnUnSelectAll, icon=img.unSelect16, text=btnUnSelectAll.text, onAction=[unSelectAll]) … … 64 67 - JLabel(name=lblDownloadSizeVal) 65 68 - MigLayout: | 66 [grow] 67 lblModTypes<,cmbModTypes [min] 68 lblShowOnly<,radAll,radOnline,radLocal [min] 69 scrollMods [grow] 70 >btnUnSelectAll,>btnRevertSelection,btnInstall [min] 71 lblDownloadSize,lblDownloadSizeVal [min] 69 [min] [grow] 70 >lblModTypes cmbModTypes [min] 71 >lblShowOnly radAll,radOnline,radLocal [min] 72 >lblShowFilter txtShowFilter>,cmbShowFilterTo< [min] 73 scrollMods+* [grow] 74 >btnUnSelectAll+*,>btnRevertSelection,btnInstall [min] 75 lblDownloadSize+*,lblDownloadSizeVal [min] 72 76 - PackageInfoBox(name=pkgInfo) 73 77 - MigLayout: -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTable.java
r659 r660 98 98 setRowSorter(sorter); 99 99 100 setFilter(null, 0 );100 setFilter(null, 0, null, EApplyFilterTo.ALL); 101 101 102 102 List<RowSorter.SortKey> sortKeys = new ArrayList<RowSorter.SortKey>(); … … 221 221 * @param downloadState 222 222 * Show only: 0 = all, 1 = online, 2 = downloaded 223 */ 224 public void setFilter(Type type, int downloadState) { 223 * @param filterString 224 * String to filter on 225 * @param filterTo 226 * Fields to use string filter on 227 */ 228 public void setFilter(Type type, int downloadState, String filterString, 229 EApplyFilterTo filterTo) { 225 230 sorter.setRowFilter(new ModTableFilter(type, downloadState, 226 contentType == ETableContentType.CORE, false)); 231 filterString, filterTo, contentType == ETableContentType.CORE, 232 false)); 227 233 } 228 234 … … 378 384 379 385 private class KeyEventHandler extends KeyAdapter { 386 private void goToRow(int row) { 387 setRowSelectionInterval(row, row); 388 JViewport viewport = (JViewport) getParent(); 389 Rectangle rect = getCellRect(row, 0, true); 390 Rectangle r2 = viewport.getVisibleRect(); 391 scrollRectToVisible(new Rectangle(rect.x, rect.y, 392 (int) r2.getWidth(), (int) r2.getHeight())); 393 } 394 380 395 @Override 381 396 public void keyTyped(KeyEvent e) { … … 384 399 if (e.getModifiers() == 0) { 385 400 String key = String.valueOf(e.getKeyChar()).toLowerCase(); 386 for (int i = 0; i < getRowCount(); i++) { 401 int row = getSelectedRow(); 402 if (row == (getRowCount() - 1)) 403 row = -1; 404 for (int i = row + 1; i < getRowCount(); i++) { 387 405 Package m = (Package) getValueAt(i, -1); 388 406 if (m.getName().toLowerCase().startsWith(key)) { 389 setRowSelectionInterval(i, i); 390 JViewport viewport = (JViewport) getParent(); 391 Rectangle rect = getCellRect(i, 0, true); 392 Rectangle r2 = viewport.getVisibleRect(); 393 scrollRectToVisible(new Rectangle(rect.x, rect.y, 394 (int) r2.getWidth(), (int) r2.getHeight())); 395 break; 407 goToRow(i); 408 return; 409 } 410 } 411 if (row > 0) { 412 for (int i = 0; i < row; i++) { 413 Package m = (Package) getValueAt(i, -1); 414 if (m.getName().toLowerCase().startsWith(key)) { 415 goToRow(i); 416 return; 417 } 396 418 } 397 419 } -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTableFilter.java
r657 r660 12 12 private Type type = null; 13 13 private int downloadState = 0; 14 private EApplyFilterTo filterTo = EApplyFilterTo.ALL; 15 private String filterString = null; 14 16 15 17 private boolean showCorePackages = false; … … 21 23 * @param downloadState 22 24 * Show only: 0 = all, 1 = online, 2 = downloaded 25 * @param filterString 26 * Filter for the given string 27 * @param filterTo 28 * Use the string filter only on the named field 23 29 * @param showCorePackages 24 30 * Show core packages in table … … 26 32 * Show packages not valid on this platform 27 33 */ 28 public ModTableFilter(Type type, int downloadState, 29 boolean showCorePackages, boolean showInvalidPlatform) { 34 public ModTableFilter(Type type, int downloadState, String filterString, 35 EApplyFilterTo filterTo, boolean showCorePackages, 36 boolean showInvalidPlatform) { 30 37 super(); 31 38 this.type = type; 32 39 this.downloadState = downloadState; 40 if (filterString != null) 41 this.filterString = filterString.toLowerCase(); 42 this.filterTo = filterTo; 33 43 this.showCorePackages = showCorePackages; 34 44 this.showInvalidPlatform = showInvalidPlatform; … … 58 68 break; 59 69 } 70 if (filterString != null && filterString.length() > 1) { 71 switch (filterTo) { 72 case ALL: 73 result &= mod.getName().toLowerCase() 74 .contains(filterString) 75 || mod.getCreator().toLowerCase() 76 .contains(filterString) 77 || mod.getDescription().toLowerCase() 78 .contains(filterString); 79 break; 80 case CREATOR: 81 result &= mod.getCreator().toLowerCase() 82 .contains(filterString); 83 break; 84 case DESCRIPTION: 85 result &= mod.getDescription().toLowerCase() 86 .contains(filterString); 87 break; 88 case NAME: 89 result &= mod.getName().toLowerCase() 90 .contains(filterString); 91 break; 92 } 93 } 60 94 61 95 return result; -
AE/installer2/src/net/oni2/aeinstaller/localization/MainWin.properties
r657 r660 43 43 radOnline.text=Online 44 44 radLocal.text=Downloaded 45 lblShowFilter.text=Filter: 45 46 lblDownloadSize.text=Size of files to download: 46 47 -
AE/installer2/src/net/oni2/aeinstaller/localization/ModTable.properties
r657 r660 6 6 mod.added=Added 7 7 mod.date=Last change 8 9 filterTo.ALL=All 10 filterTo.NAME=Mod name 11 filterTo.CREATOR=Creator 12 filterTo.DESCRIPTION=Description 8 13 9 14 state.installed=Is <b>I</b>nstalled
Note:
See TracChangeset
for help on using the changeset viewer.