Changeset 15072 in josm


Ignore:
Timestamp:
2019-05-11T22:23:33+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #17698 - don't merge single checks into immediate following checkgroup

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/defaultpresets.xml

    r15062 r15072  
    10311031                <text key="step_count" text="Amount of Steps" />
    10321032                <space />
    1033                 <checkgroup columns="1" > <!-- workaround -->
    1034                     <check key="ramp" text="Ramp" />
    1035                 </checkgroup>
     1033                <check key="ramp" text="Ramp" />
    10361034                <checkgroup columns="2" >
    10371035                    <check key="ramp:stroller" text="Stroller ramp" />
     
    10411039                <combo key="ramp:luggage" text="Luggage ramp" values="yes,automatic,manual,no" />
    10421040                <space />
    1043                 <checkgroup columns="1" > <!-- workaround -->
    1044                     <check key="handrail" text="Handrail" />
    1045                 </checkgroup>
     1041                <check key="handrail" text="Handrail" />
    10461042                <checkgroup columns="3" >
    10471043                    <check key="handrail:left" text="Left handrail" />
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java

    r14153 r15072  
    131131        parser.mapOnStart("roles", Roles.class);
    132132        parser.map("role", Role.class);
    133         parser.map("checkgroup", CheckGroup.class);
     133        parser.mapBoth("checkgroup", CheckGroup.class);
    134134        parser.map("check", Check.class);
    135135        parser.map("combo", Combo.class);
     
    167167        XmlObjectParser parser = buildParser();
    168168
     169        /** to detect end of {@code <checkgroup>} */
     170        CheckGroup lastcheckgroup = null;
    169171        /** to detect end of {@code <group>} */
    170172        TaggingPresetMenu lastmenu = null;
     
    281283                        lastrole.roles.add((Role) o);
    282284                    } else if (o instanceof Check) {
    283                         checks.add((Check) o);
     285                        if (lastcheckgroup != null) {
     286                            checks.add((Check) o);
     287                        } else {
     288                            all.getLast().data.add((TaggingPresetItem) o);
     289                        }
    284290                    } else if (o instanceof ComboMultiSelect.PresetListEntry) {
    285291                        listEntries.add((ComboMultiSelect.PresetListEntry) o);
    286292                    } else if (o instanceof CheckGroup) {
    287                         all.getLast().data.add((TaggingPresetItem) o);
    288                         // Make sure list of checks is empty to avoid adding checks several times
    289                         // when used in chunks (fix #10801)
    290                         ((CheckGroup) o).checks.clear();
    291                         ((CheckGroup) o).checks.addAll(checks);
    292                         checks.clear();
     293                        CheckGroup cg = (CheckGroup) o;
     294                        if (cg == lastcheckgroup) {
     295                            lastcheckgroup = null;
     296                            all.getLast().data.add(cg);
     297                            // Make sure list of checks is empty to avoid adding checks several times
     298                            // when used in chunks (fix #10801)
     299                            cg.checks.clear();
     300                            cg.checks.addAll(checks);
     301                            checks.clear();
     302                        } else {
     303                            lastcheckgroup = cg;
     304                        }
    293305                    } else {
    294306                        if (!checks.isEmpty()) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Check.java

    r14214 r15072  
    113113    @Override
    114114    public String toString() {
    115         return "Check ["
     115        return "Check [key=" + key + ", text=" + text + ", "
    116116                + (locale_text != null ? "locale_text=" + locale_text + ", " : "")
    117117                + (value_on != null ? "value_on=" + value_on + ", " : "")
Note: See TracChangeset for help on using the changeset viewer.