Ignore:
Timestamp:
2017-08-25T21:51:00+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15182 - code refactoring to avoid dependence on GUI packages from Preferences

Location:
trunk/src/org/openstreetmap/josm/gui/preferences
Files:
6 edited

Legend:

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

    r12634 r12649  
    3030import java.util.HashMap;
    3131import java.util.Iterator;
    32 import java.util.LinkedHashSet;
    3332import java.util.List;
    3433import java.util.Map;
    3534import java.util.Objects;
    36 import java.util.Set;
    3735import java.util.concurrent.CopyOnWriteArrayList;
    3836import java.util.regex.Matcher;
     
    7775import org.openstreetmap.josm.actions.ExtensionFileFilter;
    7876import org.openstreetmap.josm.data.Version;
     77import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry;
     78import org.openstreetmap.josm.data.preferences.sources.SourceEntry;
     79import org.openstreetmap.josm.data.preferences.sources.SourcePrefHelper;
     80import org.openstreetmap.josm.data.preferences.sources.SourceProvider;
     81import org.openstreetmap.josm.data.preferences.sources.SourceType;
    7982import org.openstreetmap.josm.gui.ExtendedDialog;
    8083import org.openstreetmap.josm.gui.HelpAwareOptionPane;
     
    787790            }
    788791            selectionModel.setValueIsAdjusting(false);
    789         }
    790     }
    791 
    792     /**
    793      * Source entry with additional metadata.
    794      */
    795     public static class ExtendedSourceEntry extends SourceEntry implements Comparable<ExtendedSourceEntry> {
    796         /** file name used for display */
    797         public String simpleFileName;
    798         /** version used for display */
    799         public String version;
    800         /** author name used for display */
    801         public String author;
    802         /** webpage link used for display */
    803         public String link;
    804         /** short description used for display */
    805         public String description;
    806         /** Style type: can only have one value: "xml". Used to filter out old XML styles. For MapCSS styles, the value is not set. */
    807         public String styleType;
    808         /** minimum JOSM version required to enable this source entry */
    809         public Integer minJosmVersion;
    810 
    811         /**
    812          * Constructs a new {@code ExtendedSourceEntry}.
    813          * @param simpleFileName file name used for display
    814          * @param url URL that {@link org.openstreetmap.josm.io.CachedFile} understands
    815          */
    816         public ExtendedSourceEntry(String simpleFileName, String url) {
    817             super(url, null, null, true);
    818             this.simpleFileName = simpleFileName;
    819         }
    820 
    821         /**
    822          * @return string representation for GUI list or menu entry
    823          */
    824         public String getDisplayName() {
    825             return title == null ? simpleFileName : title;
    826         }
    827 
    828         private static void appendRow(StringBuilder s, String th, String td) {
    829             s.append("<tr><th>").append(th).append("</th><td>").append(Utils.escapeReservedCharactersHTML(td)).append("</td</tr>");
    830         }
    831 
    832         /**
    833          * Returns a tooltip containing available metadata.
    834          * @return a tooltip containing available metadata
    835          */
    836         public String getTooltip() {
    837             StringBuilder s = new StringBuilder();
    838             appendRow(s, tr("Short Description:"), getDisplayName());
    839             appendRow(s, tr("URL:"), url);
    840             if (author != null) {
    841                 appendRow(s, tr("Author:"), author);
    842             }
    843             if (link != null) {
    844                 appendRow(s, tr("Webpage:"), link);
    845             }
    846             if (description != null) {
    847                 appendRow(s, tr("Description:"), description);
    848             }
    849             if (version != null) {
    850                 appendRow(s, tr("Version:"), version);
    851             }
    852             if (minJosmVersion != null) {
    853                 appendRow(s, tr("Minimum JOSM Version:"), Integer.toString(minJosmVersion));
    854             }
    855             return "<html><style>th{text-align:right}td{width:400px}</style>"
    856                     + "<table>" + s + "</table></html>";
    857         }
    858 
    859         @Override
    860         public String toString() {
    861             return "<html><b>" + getDisplayName() + "</b>"
    862                     + (author == null ? "" : " <span color=\"gray\">" + tr("by {0}", author) + "</color>")
    863                     + "</html>";
    864         }
    865 
    866         @Override
    867         public int compareTo(ExtendedSourceEntry o) {
    868             if (url.startsWith("resource") && !o.url.startsWith("resource"))
    869                 return -1;
    870             if (o.url.startsWith("resource"))
    871                 return 1;
    872             else
    873                 return getDisplayName().compareToIgnoreCase(o.getDisplayName());
    874792        }
    875793    }
     
    17661684
    17671685    /**
    1768      * Helper class for specialized extensions preferences.
    1769      */
    1770     public abstract static class SourcePrefHelper {
    1771 
    1772         private final String pref;
    1773 
    1774         /**
    1775          * Constructs a new {@code SourcePrefHelper} for the given preference key.
    1776          * @param pref The preference key
    1777          */
    1778         public SourcePrefHelper(String pref) {
    1779             this.pref = pref;
    1780         }
    1781 
    1782         /**
    1783          * Returns the default sources provided by JOSM core.
    1784          * @return the default sources provided by JOSM core
    1785          */
    1786         public abstract Collection<ExtendedSourceEntry> getDefault();
    1787 
    1788         /**
    1789          * Serializes the given source entry as a map.
    1790          * @param entry source entry to serialize
    1791          * @return map (key=value)
    1792          */
    1793         public abstract Map<String, String> serialize(SourceEntry entry);
    1794 
    1795         /**
    1796          * Deserializes the given map as a source entry.
    1797          * @param entryStr map (key=value)
    1798          * @return source entry
    1799          */
    1800         public abstract SourceEntry deserialize(Map<String, String> entryStr);
    1801 
    1802         /**
    1803          * Returns the list of sources.
    1804          * @return The list of sources
    1805          */
    1806         public List<SourceEntry> get() {
    1807 
    1808             Collection<Map<String, String>> src = Main.pref.getListOfStructs(pref, (Collection<Map<String, String>>) null);
    1809             if (src == null)
    1810                 return new ArrayList<>(getDefault());
    1811 
    1812             List<SourceEntry> entries = new ArrayList<>();
    1813             for (Map<String, String> sourcePref : src) {
    1814                 SourceEntry e = deserialize(new HashMap<>(sourcePref));
    1815                 if (e != null) {
    1816                     entries.add(e);
    1817                 }
    1818             }
    1819             return entries;
    1820         }
    1821 
    1822         /**
    1823          * Saves a list of sources to JOSM preferences.
    1824          * @param entries list of sources
    1825          * @return {@code true}, if something has changed (i.e. value is different than before)
    1826          */
    1827         public boolean put(Collection<? extends SourceEntry> entries) {
    1828             Collection<Map<String, String>> setting = serializeList(entries);
    1829             boolean unset = Main.pref.getListOfStructs(pref, (Collection<Map<String, String>>) null) == null;
    1830             if (unset) {
    1831                 Collection<Map<String, String>> def = serializeList(getDefault());
    1832                 if (setting.equals(def))
    1833                     return false;
    1834             }
    1835             return Main.pref.putListOfStructs(pref, setting);
    1836         }
    1837 
    1838         private Collection<Map<String, String>> serializeList(Collection<? extends SourceEntry> entries) {
    1839             Collection<Map<String, String>> setting = new ArrayList<>(entries.size());
    1840             for (SourceEntry e : entries) {
    1841                 setting.add(serialize(e));
    1842             }
    1843             return setting;
    1844         }
    1845 
    1846         /**
    1847          * Returns the set of active source URLs.
    1848          * @return The set of active source URLs.
    1849          */
    1850         public final Set<String> getActiveUrls() {
    1851             Set<String> urls = new LinkedHashSet<>(); // retain order
    1852             for (SourceEntry e : get()) {
    1853                 if (e.active) {
    1854                     urls.add(e.url);
    1855                 }
    1856             }
    1857             return urls;
    1858         }
    1859     }
    1860 
    1861     /**
    18621686     * Defers loading of sources to the first time the adequate tab is selected.
    18631687     * @param tab The preferences tab
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java

    r12630 r12649  
    77import java.awt.GridBagLayout;
    88import java.util.ArrayList;
    9 import java.util.Arrays;
    109import java.util.Collection;
    11 import java.util.HashMap;
    1210import java.util.List;
    13 import java.util.Map;
    14 import java.util.Objects;
    15 import java.util.TreeSet;
    1611
    1712import javax.swing.BorderFactory;
     
    2015
    2116import org.openstreetmap.josm.Main;
     17import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry;
     18import org.openstreetmap.josm.data.preferences.sources.MapPaintPrefHelper;
     19import org.openstreetmap.josm.data.preferences.sources.SourceEntry;
     20import org.openstreetmap.josm.data.preferences.sources.SourceProvider;
     21import org.openstreetmap.josm.data.preferences.sources.SourceType;
    2222import org.openstreetmap.josm.gui.MainApplication;
    2323import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
     
    2727import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    2828import org.openstreetmap.josm.gui.preferences.SourceEditor;
    29 import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry;
    30 import org.openstreetmap.josm.gui.preferences.SourceEntry;
    31 import org.openstreetmap.josm.gui.preferences.SourceProvider;
    32 import org.openstreetmap.josm.gui.preferences.SourceType;
    3329import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;
    3430import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
    3531import org.openstreetmap.josm.tools.GBC;
    3632import org.openstreetmap.josm.tools.Logging;
    37 import org.openstreetmap.josm.tools.Utils;
    3833
    3934/**
     
    193188    }
    194189
    195     /**
    196      * Helper class for map paint styles preferences.
    197      */
    198     public static class MapPaintPrefHelper extends SourceEditor.SourcePrefHelper {
    199 
    200         /**
    201          * The unique instance.
    202          */
    203         public static final MapPaintPrefHelper INSTANCE = new MapPaintPrefHelper();
    204 
    205         /**
    206          * Constructs a new {@code MapPaintPrefHelper}.
    207          */
    208         public MapPaintPrefHelper() {
    209             super("mappaint.style.entries");
    210         }
    211 
    212         @Override
    213         public List<SourceEntry> get() {
    214             List<SourceEntry> ls = super.get();
    215             if (insertNewDefaults(ls)) {
    216                 put(ls);
    217             }
    218             return ls;
    219         }
    220 
    221         /**
    222          * If the selection of default styles changes in future releases, add
    223          * the new entries to the user-configured list. Remember the known URLs,
    224          * so an item that was deleted explicitly is not added again.
    225          * @param list new defaults
    226          * @return {@code true} if a change occurred
    227          */
    228         private boolean insertNewDefaults(List<SourceEntry> list) {
    229             boolean changed = false;
    230 
    231             Collection<String> knownDefaults = new TreeSet<>(Main.pref.getCollection("mappaint.style.known-defaults"));
    232 
    233             Collection<ExtendedSourceEntry> defaults = getDefault();
    234             int insertionIdx = 0;
    235             for (final SourceEntry def : defaults) {
    236                 int i = Utils.indexOf(list, se -> Objects.equals(def.url, se.url));
    237                 if (i == -1 && !knownDefaults.contains(def.url)) {
    238                     def.active = false;
    239                     list.add(insertionIdx, def);
    240                     insertionIdx++;
    241                     changed = true;
    242                 } else {
    243                     if (i >= insertionIdx) {
    244                         insertionIdx = i + 1;
    245                     }
    246                 }
    247                 knownDefaults.add(def.url);
    248             }
    249             Main.pref.putCollection("mappaint.style.known-defaults", knownDefaults);
    250 
    251             // XML style is not bundled anymore
    252             list.remove(Utils.find(list, se -> "resource://styles/standard/elemstyles.xml".equals(se.url)));
    253 
    254             return changed;
    255         }
    256 
    257         @Override
    258         public Collection<ExtendedSourceEntry> getDefault() {
    259             ExtendedSourceEntry defJosmMapcss = new ExtendedSourceEntry("elemstyles.mapcss", "resource://styles/standard/elemstyles.mapcss");
    260             defJosmMapcss.active = true;
    261             defJosmMapcss.name = "standard";
    262             defJosmMapcss.title = tr("JOSM default (MapCSS)");
    263             defJosmMapcss.description = tr("Internal style to be used as base for runtime switchable overlay styles");
    264             ExtendedSourceEntry defPL2 = new ExtendedSourceEntry("potlatch2.mapcss", "resource://styles/standard/potlatch2.mapcss");
    265             defPL2.active = false;
    266             defPL2.name = "standard";
    267             defPL2.title = tr("Potlatch 2");
    268             defPL2.description = tr("the main Potlatch 2 style");
    269 
    270             return Arrays.asList(defJosmMapcss, defPL2);
    271         }
    272 
    273         @Override
    274         public Map<String, String> serialize(SourceEntry entry) {
    275             Map<String, String> res = new HashMap<>();
    276             res.put("url", entry.url == null ? "" : entry.url);
    277             res.put("title", entry.title == null ? "" : entry.title);
    278             res.put("active", Boolean.toString(entry.active));
    279             if (entry.name != null) {
    280                 res.put("ptoken", entry.name);
    281             }
    282             return res;
    283         }
    284 
    285         @Override
    286         public SourceEntry deserialize(Map<String, String> s) {
    287             return new SourceEntry(s.get("url"), s.get("ptoken"), s.get("title"), Boolean.parseBoolean(s.get("active")));
    288         }
    289     }
    290 
    291190    @Override
    292191    public boolean isExpert() {
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java

    r12620 r12649  
    99import java.util.ArrayList;
    1010import java.util.Collection;
    11 import java.util.Collections;
    12 import java.util.HashMap;
    1311import java.util.List;
    14 import java.util.Map;
    1512
    1613import javax.swing.BorderFactory;
     
    2118
    2219import org.openstreetmap.josm.Main;
     20import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry;
     21import org.openstreetmap.josm.data.preferences.sources.PresetPrefHelper;
     22import org.openstreetmap.josm.data.preferences.sources.SourceEntry;
     23import org.openstreetmap.josm.data.preferences.sources.SourceProvider;
     24import org.openstreetmap.josm.data.preferences.sources.SourceType;
    2325import org.openstreetmap.josm.gui.ExtendedDialog;
    2426import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     
    2729import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.ValidationListener;
    2830import org.openstreetmap.josm.gui.preferences.SourceEditor;
    29 import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry;
    30 import org.openstreetmap.josm.gui.preferences.SourceEntry;
    31 import org.openstreetmap.josm.gui.preferences.SourceProvider;
    32 import org.openstreetmap.josm.gui.preferences.SourceType;
    3331import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;
    3432import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
     
    254252    }
    255253
    256     /**
    257      * Helper class for tagging presets preferences.
    258      */
    259     public static class PresetPrefHelper extends SourceEditor.SourcePrefHelper {
    260 
    261         /**
    262          * The unique instance.
    263          */
    264         public static final PresetPrefHelper INSTANCE = new PresetPrefHelper();
    265 
    266         /**
    267          * Constructs a new {@code PresetPrefHelper}.
    268          */
    269         public PresetPrefHelper() {
    270             super("taggingpreset.entries");
    271         }
    272 
    273         @Override
    274         public Collection<ExtendedSourceEntry> getDefault() {
    275             ExtendedSourceEntry i = new ExtendedSourceEntry("defaultpresets.xml", "resource://data/defaultpresets.xml");
    276             i.title = tr("Internal Preset");
    277             i.description = tr("The default preset for JOSM");
    278             return Collections.singletonList(i);
    279         }
    280 
    281         @Override
    282         public Map<String, String> serialize(SourceEntry entry) {
    283             Map<String, String> res = new HashMap<>();
    284             res.put("url", entry.url);
    285             res.put("title", entry.title == null ? "" : entry.title);
    286             return res;
    287         }
    288 
    289         @Override
    290         public SourceEntry deserialize(Map<String, String> s) {
    291             return new SourceEntry(s.get("url"), null, s.get("title"), true);
    292         }
    293     }
    294 
    295254    @Override
    296255    public boolean isExpert() {
  • trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreference.java

    r10880 r12649  
    66import javax.swing.JTabbedPane;
    77
    8 import org.openstreetmap.josm.data.preferences.BooleanProperty;
    98import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
    109import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     
    3635    }
    3736
    38     /** The preferences prefix */
    39     public static final String PREFIX = "validator";
    40 
    41     /** The preferences key for error layer */
    42     public static final BooleanProperty PREF_LAYER = new BooleanProperty(PREFIX + ".layer", true);
    43 
    44     /** The preferences key for enabled tests */
    45     public static final String PREF_SKIP_TESTS = PREFIX + ".skip";
    46 
    47     /** The preferences key for enabled tests */
    48     public static final BooleanProperty PREF_USE_IGNORE = new BooleanProperty(PREFIX + ".ignore", true);
    49 
    50     /** The preferences key for enabled tests before upload*/
    51     public static final String PREF_SKIP_TESTS_BEFORE_UPLOAD = PREFIX + ".skipBeforeUpload";
    52 
    53     /** The preferences key for ignored severity other on upload */
    54     public static final BooleanProperty PREF_OTHER_UPLOAD = new BooleanProperty(PREFIX + ".otherUpload", false);
    55 
    56     /** The preferences for ignored severity other */
    57     public static final BooleanProperty PREF_OTHER = new BooleanProperty(PREFIX + ".other", false);
    58 
    59     /**
    60      * The preferences key for enabling the permanent filtering
    61      * of the displayed errors in the tree regarding the current selection
    62      */
    63     public static final String PREF_FILTER_BY_SELECTION = PREFIX + ".selectionFilter";
    64 
    6537    @Override
    6638    public void addGui(PreferenceTabbedPane gui) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java

    r11247 r12649  
    88import java.util.Collection;
    99import java.util.Collections;
    10 import java.util.HashMap;
    1110import java.util.List;
    12 import java.util.Map;
    1311
    1412import org.openstreetmap.josm.Main;
     13import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry;
     14import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper;
     15import org.openstreetmap.josm.data.preferences.sources.SourceEntry;
     16import org.openstreetmap.josm.data.preferences.sources.SourceProvider;
     17import org.openstreetmap.josm.data.preferences.sources.SourceType;
    1518import org.openstreetmap.josm.data.validation.OsmValidator;
    1619import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
     
    1922import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    2023import org.openstreetmap.josm.gui.preferences.SourceEditor;
    21 import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry;
    22 import org.openstreetmap.josm.gui.preferences.SourceEntry;
    23 import org.openstreetmap.josm.gui.preferences.SourceProvider;
    24 import org.openstreetmap.josm.gui.preferences.SourceType;
    2524import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;
    2625import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
     
    6463        @Override
    6564        public Collection<? extends SourceEntry> getInitialSourcesList() {
    66             return RulePrefHelper.INSTANCE.get();
     65            return ValidatorPrefHelper.INSTANCE.get();
    6766        }
    6867
    6968        @Override
    7069        public boolean finish() {
    71             return RulePrefHelper.INSTANCE.put(activeSourcesModel.getSources());
     70            return ValidatorPrefHelper.INSTANCE.put(activeSourcesModel.getSources());
    7271        }
    7372
    7473        @Override
    7574        public Collection<ExtendedSourceEntry> getDefault() {
    76             return RulePrefHelper.INSTANCE.getDefault();
     75            return ValidatorPrefHelper.INSTANCE.getDefault();
    7776        }
    7877
     
    123122    }
    124123
    125     /**
    126      * Helper class for validator tag checker rules preferences.
    127      */
    128     public static class RulePrefHelper extends SourceEditor.SourcePrefHelper {
    129 
    130         /**
    131          * The unique instance.
    132          */
    133         public static final RulePrefHelper INSTANCE = new RulePrefHelper();
    134 
    135         /**
    136          * Constructs a new {@code PresetPrefHelper}.
    137          */
    138         public RulePrefHelper() {
    139             super(MapCSSTagChecker.ENTRIES_PREF_KEY);
    140         }
    141 
    142         @Override
    143         public Collection<ExtendedSourceEntry> getDefault() {
    144             List<ExtendedSourceEntry> def = new ArrayList<>();
    145 
    146             // CHECKSTYLE.OFF: SingleSpaceSeparator
    147             addDefault(def, "addresses",    tr("Addresses"),           tr("Checks for errors on addresses"));
    148             addDefault(def, "combinations", tr("Tag combinations"),    tr("Checks for missing tag or suspicious combinations"));
    149             addDefault(def, "deprecated",   tr("Deprecated features"), tr("Checks for deprecated features"));
    150             addDefault(def, "geometry",     tr("Geometry"),            tr("Checks for geometry errors"));
    151             addDefault(def, "highway",      tr("Highways"),            tr("Checks for errors on highways"));
    152             addDefault(def, "multiple",     tr("Multiple values"),     tr("Checks for wrong multiple values"));
    153             addDefault(def, "numeric",      tr("Numeric values"),      tr("Checks for wrong numeric values"));
    154             addDefault(def, "religion",     tr("Religion"),            tr("Checks for errors on religious objects"));
    155             addDefault(def, "relation",     tr("Relations"),           tr("Checks for errors on relations"));
    156             addDefault(def, "territories",  tr("Territories"),         tr("Checks for territories-specific features"));
    157             addDefault(def, "unnecessary",  tr("Unnecessary tags"),    tr("Checks for unnecessary tags"));
    158             addDefault(def, "wikipedia",    tr("Wikipedia"),           tr("Checks for wrong wikipedia tags"));
    159             // CHECKSTYLE.ON: SingleSpaceSeparator
    160 
    161             return def;
    162         }
    163 
    164         private static void addDefault(List<ExtendedSourceEntry> defaults, String filename, String title, String description) {
    165             ExtendedSourceEntry i = new ExtendedSourceEntry(filename+".mapcss", "resource://data/validator/"+filename+".mapcss");
    166             i.title = title;
    167             i.description = description;
    168             defaults.add(i);
    169         }
    170 
    171         @Override
    172         public Map<String, String> serialize(SourceEntry entry) {
    173             Map<String, String> res = new HashMap<>();
    174             res.put("url", entry.url);
    175             res.put("title", entry.title == null ? "" : entry.title);
    176             res.put("active", Boolean.toString(entry.active));
    177             return res;
    178         }
    179 
    180         @Override
    181         public SourceEntry deserialize(Map<String, String> s) {
    182             return new SourceEntry(s.get("url"), null, s.get("title"), Boolean.parseBoolean(s.get("active")));
    183         }
    184     }
    185 
    186124    private SourceEditor sources;
    187125
  • trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreference.java

    r10880 r12649  
    1717
    1818import org.openstreetmap.josm.Main;
     19import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper;
    1920import org.openstreetmap.josm.data.validation.OsmValidator;
    2021import org.openstreetmap.josm.data.validation.Test;
     
    5859        testPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    5960
    60         prefUseIgnore = new JCheckBox(tr("Use ignore list."), ValidatorPreference.PREF_USE_IGNORE.get());
     61        prefUseIgnore = new JCheckBox(tr("Use ignore list."), ValidatorPrefHelper.PREF_USE_IGNORE.get());
    6162        prefUseIgnore.setToolTipText(tr("Use the ignore list to suppress warnings."));
    6263        testPanel.add(prefUseIgnore, GBC.eol());
    6364
    64         prefUseLayer = new JCheckBox(tr("Use error layer."), ValidatorPreference.PREF_LAYER.get());
     65        prefUseLayer = new JCheckBox(tr("Use error layer."), ValidatorPrefHelper.PREF_LAYER.get());
    6566        prefUseLayer.setToolTipText(tr("Use the error layer to display problematic elements."));
    6667        testPanel.add(prefUseLayer, GBC.eol());
    6768
    68         prefOther = new JCheckBox(tr("Show informational level."), ValidatorPreference.PREF_OTHER.get());
     69        prefOther = new JCheckBox(tr("Show informational level."), ValidatorPrefHelper.PREF_OTHER.get());
    6970        prefOther.setToolTipText(tr("Show the informational tests."));
    7071        testPanel.add(prefOther, GBC.eol());
    7172
    7273        prefOtherUpload = new JCheckBox(tr("Show informational level on upload."),
    73                 ValidatorPreference.PREF_OTHER_UPLOAD.get());
     74                ValidatorPrefHelper.PREF_OTHER_UPLOAD.get());
    7475        prefOtherUpload.setToolTipText(tr("Show the informational tests in the upload check windows."));
    7576        testPanel.add(prefOtherUpload, GBC.eol());
     
    115116        OsmValidator.initializeTests(testsToInitialize);
    116117
    117         Main.pref.putCollection(ValidatorPreference.PREF_SKIP_TESTS, tests);
    118         Main.pref.putCollection(ValidatorPreference.PREF_SKIP_TESTS_BEFORE_UPLOAD, testsBeforeUpload);
    119         ValidatorPreference.PREF_USE_IGNORE.put(prefUseIgnore.isSelected());
    120         ValidatorPreference.PREF_OTHER.put(prefOther.isSelected());
    121         ValidatorPreference.PREF_OTHER_UPLOAD.put(prefOtherUpload.isSelected());
    122         ValidatorPreference.PREF_LAYER.put(prefUseLayer.isSelected());
     118        Main.pref.putCollection(ValidatorPrefHelper.PREF_SKIP_TESTS, tests);
     119        Main.pref.putCollection(ValidatorPrefHelper.PREF_SKIP_TESTS_BEFORE_UPLOAD, testsBeforeUpload);
     120        ValidatorPrefHelper.PREF_USE_IGNORE.put(prefUseIgnore.isSelected());
     121        ValidatorPrefHelper.PREF_OTHER.put(prefOther.isSelected());
     122        ValidatorPrefHelper.PREF_OTHER_UPLOAD.put(prefOtherUpload.isSelected());
     123        ValidatorPrefHelper.PREF_LAYER.put(prefUseLayer.isSelected());
    123124        return false;
    124125    }
Note: See TracChangeset for help on using the changeset viewer.