Changeset 17652 in josm for trunk/src


Ignore:
Timestamp:
2021-03-23T23:31:58+01:00 (4 years ago)
Author:
simon04
Message:

see #19078 - Preset preference: checkbox for validate user input

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java

    r17651 r17652  
    3232import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.ValidationListener;
    3333import org.openstreetmap.josm.gui.preferences.SourceEditor;
     34import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
    3435import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader;
    3536import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
    3637import org.openstreetmap.josm.spi.preferences.Config;
    3738import org.openstreetmap.josm.tools.GBC;
     39import org.openstreetmap.josm.tools.ImageProvider;
    3840import org.openstreetmap.josm.tools.Logging;
    3941import org.openstreetmap.josm.tools.Utils;
     
    153155
    154156    private SourceEditor sources;
     157    private JCheckBox useValidator;
    155158    private JCheckBox sortMenu;
    156159
     
    170173    @Override
    171174    public void addGui(PreferenceTabbedPane gui) {
     175        useValidator = new JCheckBox(tr("Run data validator on user input"), TaggingPreset.USE_VALIDATOR.get());
    172176        sortMenu = new JCheckBox(tr("Sort presets menu alphabetically"), TaggingPresets.SORT_MENU.get());
    173177
    174178        final JPanel panel = new JPanel(new GridBagLayout());
    175179        panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    176         panel.add(sortMenu, GBC.eol().insets(5, 5, 5, 0));
     180
     181        panel.add(useValidator, GBC.std().insets(5, 5, 0, 0));
     182        panel.add(new JLabel(ImageProvider.get("dialogs/validator")), GBC.eol().insets(5, 5, 0, 0));
     183        panel.add(sortMenu, GBC.eol().insets(5, 0, 5, 0));
     184
    177185        sources = new TaggingPresetSourceEditor();
    178186        panel.add(sources, GBC.eol().fill(GBC.BOTH));
     
    246254    @Override
    247255    public boolean ok() {
    248         if (sources.finish() || TaggingPresets.SORT_MENU.put(sortMenu.getSelectedObjects() != null)) {
     256        TaggingPreset.USE_VALIDATOR.put(useValidator.isSelected());
     257        if (sources.finish() || TaggingPresets.SORT_MENU.put(sortMenu.isSelected())) {
    249258            TaggingPresets.destroy();
    250259            TaggingPresets.initialize();
Note: See TracChangeset for help on using the changeset viewer.