Changeset 5105 in josm
- Timestamp:
- 2012-03-18T21:33:23+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r4968 r5105 508 508 } 509 509 510 Class<?>[] columnClasses = {Boolean.class, SourceEntry.class};511 512 510 @Override 513 511 public Class<?> getColumnClass(int column) { 514 return isMapPaint ? columnClasses[column] : SourceEntry.class; 512 if (isMapPaint && column == 0) 513 return Boolean.class; 514 else return SourceEntry.class; 515 515 } 516 516 … … 615 615 } 616 616 617 public static class ExtendedSourceEntry extends SourceEntry {617 public static class ExtendedSourceEntry extends SourceEntry implements Comparable<ExtendedSourceEntry> { 618 618 public String simpleFileName; 619 619 public String version; … … 635 635 } 636 636 637 private void appendRow(StringBuilder s, String th, String td) { 638 s.append("<tr><th>").append(th).append("</th><td>").append(td).append("</td</tr>"); 639 } 640 637 641 public String getTooltip() { 638 String s = tr("Short Description: {0}", getDisplayName()) + "<br>" + tr("URL: {0}", url); 642 StringBuilder s = new StringBuilder(); 643 appendRow(s, tr("Short Description:"), getDisplayName()); 644 appendRow(s, tr("URL:"), url); 639 645 if (author != null) { 640 s += "<br>" + tr("Author: {0}", author);646 appendRow(s, tr("Author:"), author); 641 647 } 642 648 if (link != null) { 643 s += "<br>" + tr("Webpage: {0}", link);649 appendRow(s, tr("Webpage:"), link); 644 650 } 645 651 if (description != null) { 646 s += "<br>" + tr("Description: {0}", description);652 appendRow(s, tr("Description:"), description); 647 653 } 648 654 if (version != null) { 649 s += "<br>" + tr("Version: {0}", version); 650 } 651 return "<html>" + s + "</html>"; 655 appendRow(s, tr("Version:"), version); 656 } 657 return "<html><style>th{text-align:right}td{width:400px}</style>" 658 + "<table>" + s + "</table></html>"; 652 659 } 653 660 654 661 @Override 655 662 public String toString() { 656 return "<html><b>" + getDisplayName() + "</b> (" + url + ")</html>"; 663 return "<html><b>" + getDisplayName() + "</b>" 664 + (author == null ? "" : " <span color=\"gray\">" + tr("by {0}", author) + "</color>") 665 + "</html>"; 666 } 667 668 @Override 669 public int compareTo(ExtendedSourceEntry o) { 670 if (url.startsWith("resource") && !o.url.startsWith("resource")) { 671 return -1; 672 } 673 if (o.url.startsWith("resource")) { 674 return 1; 675 } else { 676 return getDisplayName().compareToIgnoreCase(o.getDisplayName()); 677 } 657 678 } 658 679 } … … 1228 1249 @Override 1229 1250 protected void finish() { 1251 Collections.sort(sources); 1230 1252 availableSourcesModel.setSources(sources); 1231 1253 } … … 1248 1270 StringBuilder s = new StringBuilder("<html><b>"); 1249 1271 if (entry.title != null) { 1250 s.append(entry.title).append("</b> (");1272 s.append(entry.title).append("</b> <span color=\"gray\">"); 1251 1273 } 1252 1274 s.append(entry.url); 1253 1275 if (entry.title != null) { 1254 s.append(" )");1276 s.append("</span>"); 1255 1277 } 1256 1278 s.append("</html>");
Note:
See TracChangeset
for help on using the changeset viewer.