Changeset 31890 in osm for applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap
- Timestamp:
- 2015-12-30T23:11:38+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java
r30939 r31890 34 34 import javax.swing.KeyStroke; 35 35 import javax.swing.ListSelectionModel; 36 import javax.swing.UIManager; 36 37 import javax.swing.event.ListSelectionEvent; 37 38 import javax.swing.event.ListSelectionListener; … … 68 69 private final HistoryComboBox cbTagSet = new HistoryComboBox(); 69 70 private List<OsmPrimitive> currentSelection; 70 71 71 72 private static final String HISTORY_KEY = "utilsplugin2.multitaghistory"; 72 73 String defaultHistory[] = {"addr:street, addr:housenumber, building, ${area}", 73 74 "highway, name, ${id}, ${length}", 74 75 "name name:en name:ru name:de"}; 75 76 76 77 public MultiTagDialog() { 77 78 super(Main.parent, tr("Edit tags"), new String[]{tr("Ok"), tr("Cancel")}, false); 78 79 JPanel pnl = new JPanel(new GridBagLayout()); 79 80 tbl = createTable(); 80 81 81 82 cbTagSet.addItemListener(tagSetChanger); 82 83 cbTagSet.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) 83 84 .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), "applyTagSet"); 84 85 cbTagSet.getActionMap().put("applyTagSet", tagSetChanger); 85 86 86 87 tbl.addMouseListener(new PopupMenuLauncher(createPopupMenu())); 87 88 88 89 pnl.add(cbTagSet,GBC.std().fill(GBC.HORIZONTAL)); 89 90 pnl.add(new JButton(new DeleteFromHistoryAction()),GBC.std()); … … 97 98 }); 98 99 pnl.add(jt,GBC.eol()); 99 100 100 101 101 102 pnl.add(createTypeFilterPanel(), GBC.eol().fill(GBC.HORIZONTAL)); 102 103 pnl.add(tbl.getTableHeader(),GBC.eop().fill(GBC.HORIZONTAL)); 103 104 104 105 pnl.add(new JScrollPane(tbl), GBC.eol().fill(GBC.BOTH)); 105 106 setContent(pnl); 106 107 setDefaultButton(-1); 107 108 loadHistory(); 108 109 109 110 WindowGeometry defaultGeometry = WindowGeometry.centerInWindow(Main.parent, new Dimension(500, 500)); 110 111 setRememberWindowGeometry(getClass().getName() + ".geometry", defaultGeometry); … … 158 159 highlightHelper.clear(); 159 160 tbl.getSelectionModel().removeListSelectionListener(selectionListener); 160 super.buttonAction(buttonIndex, evt); 161 } 162 161 super.buttonAction(buttonIndex, evt); 162 } 163 163 164 @Override 164 165 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 165 166 tableModel.selectionChanged(newSelection); 166 167 } 167 168 168 169 /*private OsmPrimitive getSelectedPrimitive() { 169 170 int idx = tbl.getSelectedRow(); … … 174 175 } 175 176 }*/ 176 177 177 178 private final MouseAdapter tableMouseAdapter = new MouseAdapter() { 178 179 @Override … … 182 183 } 183 184 } 184 185 185 186 }; 186 187 private final ListSelectionListener selectionListener = new ListSelectionListener() { … … 195 196 } 196 197 }; 197 198 198 199 public List<OsmPrimitive> getSelectedPrimitives() { 199 200 ArrayList<OsmPrimitive> sel = new ArrayList<>(100); … … 203 204 return sel; 204 205 } 205 206 206 207 private final TagSetChanger tagSetChanger = new TagSetChanger(); 207 208 … … 302 303 } 303 304 } 304 305 305 306 private class FindMatchingAction extends AbstractAction { 306 307 public FindMatchingAction() { … … 314 315 } 315 316 } 316 317 317 318 private class TagSetChanger extends AbstractAction implements ItemListener { 318 319 String oldTags; 319 320 320 321 321 @Override 322 322 public void itemStateChanged(ItemEvent e) { … … 337 337 338 338 }; 339 339 340 340 private void specifyTagSet(String s) { 341 341 Main.info("Multitagger tags="+s); … … 352 352 tableModel.fireTableDataChanged(); 353 353 } 354 354 355 355 class ColoredRenderer extends DefaultTableCellRenderer { 356 private final Color highlightColor = 356 private final Color highlightColor = 357 357 Main.pref.getColor( marktr("Multitag Background: highlight"), 358 358 new Color(255,255,200)); … … 367 367 } else { 368 368 if (isSelected) { 369 label.setBackground( Main.pref.getUIColor("Table.selectionBackground"));369 label.setBackground(UIManager.getColor("Table.selectionBackground")); 370 370 } else { 371 label.setBackground( Main.pref.getUIColor("Table.background"));371 label.setBackground(UIManager.getColor("Table.background")); 372 372 } 373 373 }
Note:
See TracChangeset
for help on using the changeset viewer.