- Timestamp:
- 2015-02-14T22:32:42+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r7759 r8065 166 166 private ImageryBounds bounds = null; 167 167 private List<String> serverProjections; 168 private String description; 168 169 private String attributionText; 169 170 private String attributionLinkURL; … … 200 201 @pref String projections; 201 202 @pref String icon; 203 @pref String description; 202 204 203 205 /** … … 229 231 cookies = i.cookies; 230 232 icon = i.icon; 233 description = i.description; 231 234 if (i.bounds != null) { 232 235 bounds = i.bounds.encodeAsString(","); … … 332 335 id = e.id; 333 336 url = e.url; 337 description = e.description; 334 338 cookies = e.cookies; 335 339 eulaAcceptanceRequired = e.eula; … … 389 393 this.countryCode = i.countryCode; 390 394 this.icon = i.icon; 395 this.description = i.description; 391 396 } 392 397 … … 472 477 return false; 473 478 } 479 if (!Objects.equals(this.description, other.description)) { 480 return false; 481 } 474 482 return true; 475 483 } 476 477 484 478 485 @Override … … 774 781 775 782 /** 783 * Returns the description text when existing. 784 * @return The description 785 * @since 8064 786 */ 787 public String getDescription() { 788 return this.description; 789 } 790 791 /** 792 * Sets the description text when existing. 793 * @param description the imagery description text 794 * @since 8064 795 */ 796 public void setDescription(String description) { 797 this.description = description; 798 } 799 800 /** 801 * Returns a tool tip text for display. 802 * @return The text 803 * @since 8064 804 */ 805 public String getToolTipText() { 806 String desc = getDescription(); 807 if (desc != null && !desc.isEmpty()) { 808 return "<html>" + getName() + "<br>" + desc + "</html>"; 809 } 810 return getName(); 811 } 812 813 /** 776 814 * Returns the EULA acceptance URL, if any. 777 815 * @return The URL to an EULA text that has to be accepted before use, or {@code null} -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r7860 r8065 184 184 * Gets a server URL in the preferences dialog. Used by plugins. 185 185 * 186 * @param server 187 * The server name 186 * @param server The server name 188 187 * @return The server URL 189 188 */ … … 228 227 private final ImageryLayerInfo layerInfo; 229 228 230 private static class ImageryTableCellRenderer extends DefaultTableCellRenderer { 229 /** 230 * class to render the URL information of Imagery source 231 * @since 8064 232 */ 233 private static class ImageryURLTableCellRenderer extends DefaultTableCellRenderer { 231 234 232 235 private List<ImageryInfo> layers; 233 236 234 public Imagery TableCellRenderer(List<ImageryInfo> layers) {237 public ImageryURLTableCellRenderer(List<ImageryInfo> layers) { 235 238 this.layers = layers; 236 239 } … … 255 258 } 256 259 } 257 } 260 label.setToolTipText((String)value); 261 } 262 return label; 263 } 264 } 265 266 /** 267 * class to render the name information of Imagery source 268 * @since 8064 269 */ 270 private static class ImageryNameTableCellRenderer extends DefaultTableCellRenderer { 271 @Override 272 public Component getTableCellRendererComponent(JTable table, Object value, boolean 273 isSelected, boolean hasFocus, int row, int column) { 274 ImageryInfo info = (ImageryInfo) value; 275 JLabel label = (JLabel) super.getTableCellRendererComponent( 276 table, info.getName(), isSelected, hasFocus, row, column); 277 label.setBackground(Main.pref.getUIColor("Table.background")); 278 if (isSelected) { 279 label.setForeground(Main.pref.getUIColor("Table.foreground")); 280 } 281 label.setToolTipText(info.getToolTipText()); 258 282 return label; 259 283 } … … 281 305 282 306 defaultModel = new ImageryDefaultLayerTableModel(); 283 defaultTable = new JTable(defaultModel) { 284 @Override 285 public String getToolTipText(MouseEvent e) { 286 java.awt.Point p = e.getPoint(); 287 return (String) defaultModel.getValueAt(rowAtPoint(p), columnAtPoint(p)); 288 } 289 }; 307 defaultTable = new JTable(defaultModel); 290 308 291 309 defaultModel.addTableModelListener( … … 309 327 TableColumnModel mod = defaultTable.getColumnModel(); 310 328 mod.getColumn(2).setPreferredWidth(800); 311 mod.getColumn(2).setCellRenderer(new Imagery TableCellRenderer(layerInfo.getLayers()));329 mod.getColumn(2).setCellRenderer(new ImageryURLTableCellRenderer(layerInfo.getLayers())); 312 330 mod.getColumn(1).setPreferredWidth(400); 331 mod.getColumn(1).setCellRenderer(new ImageryNameTableCellRenderer()); 313 332 mod.getColumn(0).setPreferredWidth(50); 314 333 315 334 mod = activeTable.getColumnModel(); 316 335 mod.getColumn(1).setPreferredWidth(800); 317 mod.getColumn(1).setCellRenderer(new Imagery TableCellRenderer(layerInfo.getDefaultLayers()));336 mod.getColumn(1).setCellRenderer(new ImageryURLTableCellRenderer(layerInfo.getDefaultLayers())); 318 337 mod.getColumn(0).setPreferredWidth(200); 319 338 … … 726 745 return info.getCountryCode(); 727 746 case 1: 728 return info .getName();747 return info; 729 748 case 2: 730 749 return info.getExtendedUrl(); -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r7937 r8065 117 117 "id", 118 118 "type", 119 "description", 119 120 "default", 120 121 "url", … … 206 207 switch(qName) { 207 208 case "name": 209 /* TODO: don't ignore lang attribute */ 208 210 entry.setTranslatedName(accumulator.toString()); 211 break; 212 case "description": 213 /* TODO: don't ignore lang attribute */ 214 entry.setDescription(accumulator.toString()); 209 215 break; 210 216 case "id":
Note:
See TracChangeset
for help on using the changeset viewer.