Ticket #8196: TaggingPreset.java.patch
File TaggingPreset.java.patch, 2.0 KB (added by , 12 years ago) |
---|
-
src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
312 312 public String display_value; 313 313 public String short_description; 314 314 public String icon; 315 public String icon_size; 315 316 public String locale_display_value; 316 317 public String locale_short_description; 317 318 private final File zipIcons = TaggingPreset.zipIcons; … … 340 341 } 341 342 342 343 public ImageIcon getIcon() { 343 return icon == null ? null : loadImageIcon(icon, zipIcons, 24); 344 return icon == null ? null : loadImageIcon(icon, zipIcons, parseInteger(icon_size)); 345 } 346 347 private Integer parseInteger(String str) { 348 if (str == null || "".equals(str)) 349 return null; 350 try { 351 return Integer.parseInt(str); 352 } catch (Exception e) { 353 // 354 } 355 return null; 344 356 } 345 357 346 358 public PresetListEntry() { … … 760 772 boolean isSelected, 761 773 boolean cellHasFocus) { 762 774 PresetListEntry item = (PresetListEntry) value; 763 775 764 776 // Only return cached size, item is not shown 765 777 if (!list.isShowing() && item.prefferedWidth != -1 && item.prefferedHeight != -1) { 766 778 if (index == -1) { … … 1275 1287 final Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null); 1276 1288 ImageProvider imgProv = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true); 1277 1289 if (maxSize != null) { 1278 imgProv.setMaxSize( 24);1290 imgProv.setMaxSize(maxSize); 1279 1291 } 1280 1292 return imgProv.get(); 1281 1293 }