Ticket #8196: TaggingPreset.java.patch

File TaggingPreset.java.patch, 2.0 KB (added by kendzi, 11 years ago)

fix for bug

  • src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

     
    312312        public String display_value;
    313313        public String short_description;
    314314        public String icon;
     315        public String icon_size;
    315316        public String locale_display_value;
    316317        public String locale_short_description;
    317318        private final File zipIcons = TaggingPreset.zipIcons;
     
    340341        }
    341342
    342343        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;
    344356        }
    345357
    346358        public PresetListEntry() {
     
    760772                    boolean isSelected,
    761773                    boolean cellHasFocus) {
    762774                PresetListEntry item = (PresetListEntry) value;
    763                
     775
    764776                // Only return cached size, item is not shown
    765777                if (!list.isShowing() && item.prefferedWidth != -1 && item.prefferedHeight != -1) {
    766778                    if (index == -1) {
     
    12751287        final Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null);
    12761288        ImageProvider imgProv = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true);
    12771289        if (maxSize != null) {
    1278             imgProv.setMaxSize(24);
     1290            imgProv.setMaxSize(maxSize);
    12791291        }
    12801292        return imgProv.get();
    12811293    }