- Timestamp:
- 2010-06-04T07:55:25+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r3302 r3306 477 477 List<RelationMember> role = new ArrayList<RelationMember>(); 478 478 List<Integer> position = new ArrayList<Integer>(); 479 private String positionString = null; 479 480 void add(RelationMember r, Integer p) 480 481 { 481 482 role.add(r); 482 483 position.add(p); 484 } 485 String getPositionString() 486 { 487 if(positionString == null) 488 { 489 Collections.sort(position); 490 positionString = String.valueOf(position.get(0)); 491 int cnt = 0; 492 int last = position.get(0); 493 for(int i = 1; i < position.size(); ++i) { 494 int cur = position.get(i); 495 if(cur == last+1) { 496 ++cnt; 497 } else { 498 if(cnt == 1) 499 positionString += ","+String.valueOf(last); 500 else if(cnt > 1) 501 positionString += "-"+String.valueOf(last); 502 positionString += "-"+String.valueOf(cur); 503 cnt = 0; 504 } 505 last = cur; 506 } 507 if(cnt == 1) 508 positionString += ","+String.valueOf(last); 509 else if(cnt > 1) 510 positionString += "-"+String.valueOf(last); 511 } 512 if(positionString.length() > 20) 513 positionString = positionString.substring(0,17)+"..."; 514 return positionString; 483 515 } 484 516 } … … 548 580 Relation r = (Relation)value; 549 581 label.setText(r.getDisplayName(DefaultNameFormatter.getInstance())); 550 if (r.is Filtered()) {582 if (r.isDisabledAndHidden()) { 551 583 label.setFont(label.getFont().deriveFont(Font.ITALIC)); 552 584 } … … 561 593 boolean isSelected, boolean hasFocus, int row, int column) { 562 594 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 563 boolean is Filtered = (((Relation)table.getValueAt(row, 0))).isFiltered();595 boolean isDisabledAndHidden = (((Relation)table.getValueAt(row, 0))).isDisabledAndHidden(); 564 596 if (c instanceof JLabel) { 565 597 JLabel label = (JLabel)c; … … 578 610 579 611 label.setText(text); 580 if (is Filtered) {612 if (isDisabledAndHidden) { 581 613 label.setFont(label.getFont().deriveFont(Font.ITALIC)); 582 614 } … … 591 623 boolean isSelected, boolean hasFocus, int row, int column) { 592 624 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 593 boolean is Filtered = (((Relation)table.getValueAt(row, 0))).isFiltered();625 boolean isDisabledAndHidden = (((Relation)table.getValueAt(row, 0))).isDisabledAndHidden(); 594 626 if (c instanceof JLabel) { 595 627 JLabel label = (JLabel)c; 596 MemberInfo col = (MemberInfo) table.getValueAt(row, 1); 597 598 String text = ""; 599 for (Integer p : col.position) { 600 if (text.length() != 0) 601 text += ","; 602 text += String.valueOf(p); 603 } 604 605 label.setText(text); 606 if (isFiltered) { 628 label.setText(((MemberInfo) table.getValueAt(row, 1)).getPositionString()); 629 if (isDisabledAndHidden) { 607 630 label.setFont(label.getFont().deriveFont(Font.ITALIC)); 608 631 } … … 849 872 if (ref instanceof Relation && !ref.isIncomplete() && !ref.isDeleted()) { 850 873 Relation r = (Relation) ref; 851 MemberInfo mi = mi = new MemberInfo(); 874 MemberInfo mi = roles.get(r); 875 if(mi == null) 876 mi = new MemberInfo(); 852 877 roles.put(r, mi); 853 878 int i = 1; … … 865 890 Collections.sort(sortedRelations, new Comparator<Relation>() { 866 891 public int compare(Relation o1, Relation o2) { 867 int comp = Boolean.valueOf(o1.is Filtered()).compareTo(o2.isFiltered());892 int comp = Boolean.valueOf(o1.isDisabledAndHidden()).compareTo(o2.isDisabledAndHidden()); 868 893 if (comp == 0) { 869 894 comp = o1.getDisplayName(DefaultNameFormatter.getInstance()).compareTo(o2.getDisplayName(DefaultNameFormatter.getInstance()));
Note:
See TracChangeset
for help on using the changeset viewer.