Changeset 18077 in josm for trunk/src/org


Ignore:
Timestamp:
2021-07-20T00:45:25+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21142 - Make checkbox changes update value_template fields in presets (patch by marcello)

File:
1 edited

Legend:

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

    r17650 r18077  
    9090            p.add(check, GBC.eol()); // Do not fill, see #15104
    9191        }
     92        check.addChangeListener(l -> support.fireItemValueModified(this, key, getValue()));
    9293        return true;
    9394    }
     
    99100
    100101        // otherwise change things according to the selected value.
    101         changedTags.add(new Tag(key,
    102                 check.getState() == QuadStateCheckBox.State.SELECTED ? value_on :
    103                     check.getState() == QuadStateCheckBox.State.NOT_SELECTED ? value_off :
    104                         null));
     102        changedTags.add(new Tag(key, getValue()));
     103    }
     104
     105    protected String getValue() {
     106        return check.getState() == QuadStateCheckBox.State.SELECTED ? value_on :
     107            check.getState() == QuadStateCheckBox.State.NOT_SELECTED ? value_off :
     108                null;
    105109    }
    106110
Note: See TracChangeset for help on using the changeset viewer.