Changeset 9086 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
- Timestamp:
- 2015-12-05T15:38:14+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r9084 r9086 53 53 import javax.swing.JPanel; 54 54 import javax.swing.JPopupMenu; 55 import javax.swing.JTable; 55 56 import javax.swing.KeyStroke; 56 57 import javax.swing.ListCellRenderer; … … 86 87 */ 87 88 class TagEditHelper { 89 private final JTable tagTable; 88 90 private final DefaultTableModel tagData; 89 91 private final Map<String, Map<String, Integer>> valueCount; … … 116 118 }; 117 119 118 TagEditHelper(DefaultTableModel propertyData, Map<String, Map<String, Integer>> valueCount) { 120 TagEditHelper(JTable tagTable, DefaultTableModel propertyData, Map<String, Map<String, Integer>> valueCount) { 121 this.tagTable = tagTable; 119 122 this.tagData = propertyData; 120 123 this.valueCount = valueCount; 124 } 125 126 public final String getDataKey(int viewRow) { 127 return tagData.getValueAt(tagTable.convertRowIndexToModel(viewRow), 0).toString(); 128 } 129 130 @SuppressWarnings("unchecked") 131 public final Map<String, Integer> getDataValues(int viewRow) { 132 return (Map<String, Integer>) tagData.getValueAt(tagTable.convertRowIndexToModel(viewRow), 1); 121 133 } 122 134 … … 152 164 if (sel == null || sel.isEmpty()) return; 153 165 154 String key = tagData.getValueAt(row, 0).toString();166 String key = getDataKey(row); 155 167 objKey = key; 156 168 157 @SuppressWarnings("unchecked") 158 final EditTagDialog editDialog = new EditTagDialog(key, 159 (Map<String, Integer>) tagData.getValueAt(row, 1), focusOnKey); 169 final EditTagDialog editDialog = new EditTagDialog(key, getDataValues(row), focusOnKey); 160 170 editDialog.showDialog(); 161 171 if (editDialog.getValue() != 1) return; … … 567 577 } 568 578 for (int i = 0; i < tagData.getRowCount(); ++i) { 569 if (item.getValue().equals( tagData.getValueAt(i, 0))) {579 if (item.getValue().equals(getDataKey(i))) { 570 580 if (itemToSelect == item) { 571 581 itemToSelect = null; … … 831 841 // performing this action leads to autocomplete to the next key (see #7671 comments) 832 842 for (int j = 0; j < tagData.getRowCount(); ++j) { 833 if (t.getKey().equals( tagData.getValueAt(j, 0))) {843 if (t.getKey().equals(getDataKey(j))) { 834 844 action.setEnabled(false); 835 845 break;
Note:
See TracChangeset
for help on using the changeset viewer.