Changeset 15049 in josm for trunk/src/org
- Timestamp:
- 2019-05-05T02:24:18+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r14214 r15049 10 10 import java.util.Collection; 11 11 import java.util.Collections; 12 import java.util.EnumMap; 12 13 import java.util.List; 13 14 import java.util.Locale; … … 43 44 import org.openstreetmap.josm.tools.CheckParameterUtil; 44 45 import org.openstreetmap.josm.tools.ImageProvider; 46 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 45 47 import org.openstreetmap.josm.tools.LanguageInfo; 46 48 import org.openstreetmap.josm.tools.Logging; … … 123 125 private final String category; 124 126 private final String description; 127 private static final Map<ImageSizes, Map<ImageryCategory, ImageIcon>> iconCache = 128 Collections.synchronizedMap(new EnumMap<>(ImageSizes.class)); 125 129 126 130 ImageryCategory(String category, String description) { … … 143 147 public final String getDescription() { 144 148 return description; 149 } 150 151 /** 152 * Returns the category icon at the given size. 153 * @param size icon wanted size 154 * @return the category icon at the given size 155 * @since 15049 156 */ 157 public final ImageIcon getIcon(ImageSizes size) { 158 return iconCache 159 .computeIfAbsent(size, x -> Collections.synchronizedMap(new EnumMap<>(ImageryCategory.class))) 160 .computeIfAbsent(this, x -> ImageProvider.get("data/imagery", x.category, size)); 145 161 } 146 162 -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r14632 r15049 25 25 import java.util.Map; 26 26 import java.util.Objects; 27 import java.util.Optional; 27 28 import java.util.Set; 28 29 import java.util.stream.Collectors; … … 31 32 import javax.swing.BorderFactory; 32 33 import javax.swing.Box; 34 import javax.swing.ImageIcon; 33 35 import javax.swing.JButton; 34 36 import javax.swing.JLabel; … … 56 58 import org.openstreetmap.josm.data.imagery.ImageryInfo; 57 59 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryBounds; 60 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryCategory; 58 61 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 59 62 import org.openstreetmap.josm.data.imagery.OffsetBookmark; … … 75 78 import org.openstreetmap.josm.tools.GBC; 76 79 import org.openstreetmap.josm.tools.ImageProvider; 80 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 77 81 import org.openstreetmap.josm.tools.LanguageInfo; 78 82 import org.openstreetmap.josm.tools.Logging; … … 335 339 336 340 TableColumnModel mod = defaultTable.getColumnModel(); 337 mod.getColumn(2).setPreferredWidth(800); 338 mod.getColumn(2).setCellRenderer(new ImageryURLTableCellRenderer(layerInfo.getLayers())); 339 mod.getColumn(1).setPreferredWidth(400); 340 mod.getColumn(1).setCellRenderer(new ImageryNameTableCellRenderer()); 341 mod.getColumn(3).setPreferredWidth(775); 342 mod.getColumn(3).setCellRenderer(new ImageryURLTableCellRenderer(layerInfo.getLayers())); 343 mod.getColumn(2).setPreferredWidth(475); 344 mod.getColumn(2).setCellRenderer(new ImageryNameTableCellRenderer()); 345 mod.getColumn(0).setPreferredWidth(50); 341 346 mod.getColumn(0).setPreferredWidth(50); 342 347 … … 757 762 */ 758 763 public ImageryDefaultLayerTableModel() { 759 setColumnIdentifiers(new String[]{"", tr("Menu Name (Default)"), tr("Imagery URL (Default)")});764 setColumnIdentifiers(new String[]{"", "", tr("Menu Name (Default)"), tr("Imagery URL (Default)")}); 760 765 } 761 766 … … 775 780 776 781 @Override 782 public Class<?> getColumnClass(int columnIndex) { 783 return columnIndex == 0 ? ImageIcon.class : super.getColumnClass(columnIndex); 784 } 785 786 @Override 777 787 public Object getValueAt(int row, int column) { 778 788 ImageryInfo info = layerInfo.getAllDefaultLayers().get(row); 789 ImageryCategory cat = Optional.ofNullable(info.getImageryCategory()).orElse(ImageryCategory.OTHER); 779 790 switch (column) { 780 791 case 0: 792 return cat.getIcon(ImageSizes.TABLE); 793 case 1: 781 794 return info.getCountryCode(); 782 case 1:795 case 2: 783 796 return info; 784 case 2:797 case 3: 785 798 return info.getExtendedUrl(); 786 799 } -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r14695 r15049 150 150 */ 151 151 LAYER(Config.getPref().getInt("iconsize.layer", 16)), 152 /** Table icon size 153 * @since 15049 154 */ 155 TABLE(SMALLICON), 152 156 /** Toolbar button icon size 153 157 * @since 9253
Note:
See TracChangeset
for help on using the changeset viewer.