Changeset 3247 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2010-05-15T10:37:03+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/preferences
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/PrefJPanel.java
r3083 r3247 13 13 import java.util.Map; 14 14 15 import javax.swing.AbstractAction; 15 16 import javax.swing.JEditorPane; 16 17 import javax.swing.JScrollPane; … … 370 371 // even have some duplicated code. Feel free to refactor, If you have 371 372 // more expirience with GUI coding than I have. 372 private class cbAction extends javax.swing.AbstractAction implements ListSelectionListener {373 private class cbAction extends AbstractAction implements ListSelectionListener { 373 374 private PrefJPanel panel; 374 375 public cbAction (PrefJPanel panel) { -
trunk/src/org/openstreetmap/josm/gui/preferences/ShortcutPreference.java
r3083 r3247 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util. Collection;6 import java.util.List; 7 7 8 8 import javax.swing.JPanel; … … 36 36 37 37 public boolean ok() { 38 return false;38 return Shortcut.savePrefs(); 39 39 } 40 40 41 41 // Maybe move this to prefPanel? There's no need for it to be here. 42 42 private static class scListModel extends AbstractTableModel { 43 // private String[] columnNames = new String[]{tr("Action"), tr("Shortcut"), tr("Group"), tr("ID")};44 43 private String[] columnNames = new String[]{tr("Action"), tr("Shortcut")}; 45 private Collection<Shortcut> data; 44 private List<Shortcut> data; 45 46 46 public scListModel() { 47 47 data = Shortcut.listAll(); … … 53 53 return data.size(); 54 54 } 55 @Override 55 56 public String getColumnName(int col) { 56 57 return columnNames[col]; 57 58 } 58 59 public Object getValueAt(int row, int col) { 59 Shortcut sc = (Shortcut)data.toArray()[row];60 if (col == 0) {60 Shortcut sc = data.get(row); 61 if (col == 0) 61 62 return sc.getLongText(); 62 }else if (col == 1){63 else if (col == 1) 63 64 return sc.getKeyText(); 64 } /*else if (col == 2) { 65 if (sc.getRequestedGroup() == Shortcut.GROUP_NONE) { 66 return tr("None"); 67 } else if (sc.getRequestedGroup() == Shortcut.GROUP_HOTKEY) { 68 return tr("Hotkey"); 69 } else if (sc.getRequestedGroup() == Shortcut.GROUP_MENU) { 70 return tr("Menu"); 71 } else if (sc.getRequestedGroup() == Shortcut.GROUP_EDIT) { 72 return tr("Edit"); 73 } else if (sc.getRequestedGroup() == Shortcut.GROUP_LAYER) { 74 return tr("Subwindow"); 75 } else if (sc.getRequestedGroup() == Shortcut.GROUP_DIRECT) { 76 return tr("Direct"); 77 } else if (sc.getRequestedGroup() == Shortcut.GROUP_MNEMONIC) { 78 return tr("Mnemonic"); 79 } else if (sc.getRequestedGroup() == Shortcut.GROUP_RESERVED) { 80 return tr("System"); 81 } else { 82 return tr("Unknown"); 83 } 84 } else if (col == 3) { 85 return sc.getShortText(); 86 } */else { 65 else 87 66 // This is a kind of hack that allows the actions on the editing controls 88 67 // to access the underlying shortcut object without introducing another 89 68 // method. I opted to stay within the interface. 90 69 return sc; 91 }92 70 } 71 @Override 93 72 public boolean isCellEditable(int row, int col) { 94 73 return false;
Note:
See TracChangeset
for help on using the changeset viewer.