Changeset 10611 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
- Timestamp:
- 2016-07-23T18:46:45+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r10604 r10611 17 17 import java.awt.datatransfer.Transferable; 18 18 import java.awt.event.ActionEvent; 19 import java.awt.event.ActionListener;20 19 import java.awt.event.FocusAdapter; 21 20 import java.awt.event.FocusEvent; … … 108 107 private String objKey; 109 108 110 private final Comparator<AutoCompletionListItem> defaultACItemComparator = new Comparator<AutoCompletionListItem>() { 111 @Override 112 public int compare(AutoCompletionListItem o1, AutoCompletionListItem o2) { 113 return String.CASE_INSENSITIVE_ORDER.compare(o1.getValue(), o2.getValue()); 114 } 115 }; 109 private final Comparator<AutoCompletionListItem> defaultACItemComparator = 110 (o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getValue(), o2.getValue()); 116 111 117 112 private String lastAddKey; … … 365 360 private final String key; 366 361 private final transient Map<String, Integer> m; 367 368 private final transient Comparator<AutoCompletionListItem> usedValuesAwareComparator = new Comparator<AutoCompletionListItem>() { 369 @Override 370 public int compare(AutoCompletionListItem o1, AutoCompletionListItem o2) { 371 boolean c1 = m.containsKey(o1.getValue()); 372 boolean c2 = m.containsKey(o2.getValue()); 373 if (c1 == c2) 374 return String.CASE_INSENSITIVE_ORDER.compare(o1.getValue(), o2.getValue()); 375 else if (c1) 376 return -1; 377 else 378 return +1; 379 } 380 }; 362 private final transient Comparator<AutoCompletionListItem> usedValuesAwareComparator; 381 363 382 364 private final transient ListCellRenderer<AutoCompletionListItem> cellRenderer = new ListCellRenderer<AutoCompletionListItem>() { … … 409 391 this.m = map; 410 392 393 usedValuesAwareComparator = (o1, o2) -> { 394 boolean c1 = m.containsKey(o1.getValue()); 395 boolean c2 = m.containsKey(o2.getValue()); 396 if (c1 == c2) 397 return String.CASE_INSENSITIVE_ORDER.compare(o1.getValue(), o2.getValue()); 398 else if (c1) 399 return -1; 400 else 401 return +1; 402 }; 403 411 404 JPanel mainPanel = new JPanel(new BorderLayout()); 412 405 … … 450 443 p.add(Box.createHorizontalStrut(10), GBC.std()); 451 444 p.add(values, GBC.eol().fill(GBC.HORIZONTAL)); 452 values.getEditor().addActionListener(new ActionListener() { 453 @Override 454 public void actionPerformed(ActionEvent e) { 455 buttonAction(0, null); // emulate OK button click 456 } 457 }); 445 values.getEditor().addActionListener(e -> buttonAction(0, null)); 458 446 addFocusAdapter(autocomplete, usedValuesAwareComparator); 459 447
Note:
See TracChangeset
for help on using the changeset viewer.