Changeset 9571 in josm for trunk/src


Ignore:
Timestamp:
2016-01-22T23:29:57+01:00 (4 years ago)
Author:
Don-vip
Message:

fix #12416 - see #12160 - fix unnecessary use of scrollbar in tagging presets combos (regression from r9465)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r9492 r9571  
    250250                return "<b>" + Utils.escapeReservedCharactersHTML(DIFFERENT) + "</b>";
    251251
    252             final StringBuilder res = new StringBuilder("<b>");
    253             res.append(Utils.escapeReservedCharactersHTML(getDisplayValue(true)))
    254                .append("</b>");
    255             if (getShortDescription(true) != null) {
     252            String displayValue = Utils.escapeReservedCharactersHTML(getDisplayValue(true));
     253            String shortDescription = getShortDescription(true);
     254
     255            if (displayValue.isEmpty() && (shortDescription == null || shortDescription.isEmpty()))
     256                return "&nbsp;";
     257
     258            final StringBuilder res = new StringBuilder("<b>").append(displayValue).append("</b>");
     259            if (shortDescription != null) {
    256260                // wrap in table to restrict the text width
    257261                res.append("<div style=\"width:300px; padding:0 0 5px 5px\">")
    258                    .append(getShortDescription(true))
     262                   .append(shortDescription)
    259263                   .append("</div>");
    260264            }
     
    295299        @Override
    296300        public String toString() {
    297             if (value.equals(DIFFERENT))
     301            if (DIFFERENT.equals(value))
    298302                return DIFFERENT;
    299             return getDisplayValue(true).replaceAll("<.*>", ""); // remove additional markup, e.g. <br>
     303            String displayValue = getDisplayValue(true);
     304            return displayValue != null ? displayValue.replaceAll("<.*>", "") : null; // remove additional markup, e.g. <br>
    300305        }
    301306
Note: See TracChangeset for help on using the changeset viewer.