- Timestamp:
- 2010-05-08T14:05:33+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r3214 r3219 25 25 import java.util.Comparator; 26 26 import java.util.HashMap; 27 import java.util.HashSet;28 27 import java.util.Iterator; 29 28 import java.util.List; … … 82 81 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 83 82 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; 84 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList;85 83 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem; 86 84 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; … … 199 197 List<AutoCompletionListItem> keyList = autocomplete.getKeys(); 200 198 Collections.sort(keyList, defaultACItemComparator); 201 199 202 200 final AutoCompletingComboBox keys = new AutoCompletingComboBox(); 203 201 keys.setPossibleACItems(keyList); … … 231 229 }); 232 230 values.setEditable(true); 233 231 234 232 List<AutoCompletionListItem> valueList = autocomplete.getValues(key); 235 233 Collections.sort(valueList, defaultACItemComparator); 236 234 237 235 values.setPossibleACItems(valueList); 238 236 Map<String, Integer> m=(Map<String, Integer>)propertyData.getValueAt(row, 1); … … 419 417 @Override public void focusGained(FocusEvent e) { 420 418 String key = keys.getEditor().getItem().toString(); 421 419 422 420 List<AutoCompletionListItem> valueList = autocomplete.getValues(key); 423 421 Collections.sort(valueList, defaultACItemComparator); … … 535 533 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 536 534 if (c instanceof JLabel) { 537 ((JLabel)c).setText(((Relation)value).getDisplayName(DefaultNameFormatter.getInstance())); 535 JLabel label = (JLabel)c; 536 Relation r = (Relation)value; 537 label.setText(r.getDisplayName(DefaultNameFormatter.getInstance())); 538 if (r.isFiltered()) { 539 label.setFont(label.getFont().deriveFont(Font.ITALIC)); 540 } 538 541 } 539 542 return c; … … 546 549 boolean isSelected, boolean hasFocus, int row, int column) { 547 550 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 551 boolean isFiltered = (((Relation)table.getValueAt(row, 0))).isFiltered(); 548 552 if (c instanceof JLabel) { 553 JLabel label = (JLabel)c; 549 554 Collection<RelationMember> col = (Collection<RelationMember>) value; 550 555 … … 560 565 } 561 566 562 ((JLabel)c).setText(text); 567 label.setText(text); 568 if (isFiltered) { 569 label.setFont(label.getFont().deriveFont(Font.ITALIC)); 570 } 563 571 } 564 572 return c; … … 800 808 for (OsmPrimitive primitive: newSelection) { 801 809 for (OsmPrimitive ref: primitive.getReferrers()) { 802 if (ref instanceof Relation && !ref.is Filtered() && !ref.isIncomplete() && !ref.isDeleted()) {810 if (ref instanceof Relation && !ref.isIncomplete() && !ref.isDeleted()) { 803 811 Relation r = (Relation) ref; 812 Collection<RelationMember> members = new ArrayList<RelationMember>(); 813 roles.put(r, members); 804 814 for (RelationMember m : r.getMembers()) { 805 815 if (m.getMember() == primitive) { 806 Collection<RelationMember> value = roles.get(r); 807 if (value == null) { 808 value = new HashSet<RelationMember>(); 809 roles.put(r, value); 810 } 811 value.add(m); 816 members.add(m); 812 817 } 813 818 } … … 816 821 } 817 822 818 for (Entry<Relation, Collection<RelationMember>> e : roles.entrySet()) { 819 membershipData.addRow(new Object[]{e.getKey(), e.getValue()}); 823 List<Relation> sortedRelations = new ArrayList<Relation>(roles.keySet()); 824 Collections.sort(sortedRelations, new Comparator<Relation>() { 825 public int compare(Relation o1, Relation o2) { 826 int comp = Boolean.valueOf(o1.isFiltered()).compareTo(o2.isFiltered()); 827 if (comp == 0) { 828 comp = o1.getDisplayName(DefaultNameFormatter.getInstance()).compareTo(o2.getDisplayName(DefaultNameFormatter.getInstance())); 829 } 830 return comp; 831 }} 832 ); 833 834 for (Relation r: sortedRelations) { 835 membershipData.addRow(new Object[]{r, roles.get(r)}); 820 836 } 821 837
Note:
See TracChangeset
for help on using the changeset viewer.