Ignore:
Timestamp:
2013-12-31T13:04:42+01:00 (12 years ago)
Author:
bastiK
Message:

Preferences rework. Merges the 4 maps for the 4 setting
types into a single map. The code for the get...() and set...()
methods is also unified.
Additional consistency checks.

File:
1 edited

Legend:

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

    r6495 r6578  
    11// License: GPL. See LICENSE file for details.
    22package org.openstreetmap.josm.gui.preferences.advanced;
     3
     4import static org.openstreetmap.josm.tools.I18n.marktr;
     5import static org.openstreetmap.josm.tools.I18n.tr;
    36
    47import java.awt.Color;
     
    1215import java.util.List;
    1316import java.util.Map;
     17
    1418import javax.swing.ButtonGroup;
    1519import javax.swing.DefaultCellEditor;
     
    2226import javax.swing.table.DefaultTableCellRenderer;
    2327import javax.swing.table.DefaultTableModel;
     28
    2429import org.openstreetmap.josm.Main;
    2530import org.openstreetmap.josm.data.Preferences;
     
    2732import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2833import org.openstreetmap.josm.tools.GBC;
    29 import static org.openstreetmap.josm.tools.I18n.marktr;
    30 import static org.openstreetmap.josm.tools.I18n.tr;
    3134import org.openstreetmap.josm.tools.Utils;
    3235
     
    106109            if (lEditor.getValue() == 1) {
    107110                List<String> data = lEditor.getData();
    108                 if (!Preferences.equalCollection(lSetting.getValue(), data)) {
     111                if (!lSetting.equalVal(data)) {
    109112                    e.setValue(new Preferences.ListSetting(data));
    110113                    return true;
     
    112115            }
    113116        } else if (stg instanceof Preferences.ListListSetting) {
    114             ListListEditor llEditor = new ListListEditor(gui, e, (Preferences.ListListSetting) stg);
     117            Preferences.ListListSetting llSetting = (Preferences.ListListSetting) stg;
     118            ListListEditor llEditor = new ListListEditor(gui, e, llSetting);
    115119            llEditor.showDialog();
    116120            if (llEditor.getValue() == 1) {
     
    118122                @SuppressWarnings("unchecked")
    119123                Collection<Collection<String>> stgValue = (Collection<Collection<String>>) stg.getValue();
    120                 if (!Preferences.equalArray(stgValue, data)) {
     124                if (!llSetting.equalVal(data)) {
    121125                    e.setValue(new Preferences.ListListSetting(data));
    122126                    return true;
     
    129133            if (mlEditor.getValue() == 1) {
    130134                List<Map<String, String>> data = mlEditor.getData();
    131                 if (!Preferences.equalListOfStructs(mlSetting.getValue(), data)) {
     135                if (!mlSetting.equalVal(data)) {
    132136                    e.setValue(new Preferences.MapListSetting(data));
    133137                    return true;
     
    196200                if (lEditor.getValue() == 1) {
    197201                    List<String> data = lEditor.getData();
    198                     if (!Preferences.equalCollection(lSetting.getValue(), data)) {
     202                    if (!lSetting.equalVal(data)) {
    199203                        pe.setValue(new Preferences.ListSetting(data));
    200204                        ok = true;
     
    208212                if (llEditor.getValue() == 1) {
    209213                    List<List<String>> data = llEditor.getData();
    210                     @SuppressWarnings("unchecked")
    211                     Collection<Collection<String>> llSettingValue = (Collection) llSetting.getValue();
    212                     if (!Preferences.equalArray(llSettingValue, data)) {
     214                    if (!llSetting.equalVal(data)) {
    213215                        pe.setValue(new Preferences.ListListSetting(data));
    214216                        ok = true;
     
    222224                if (mlEditor.getValue() == 1) {
    223225                    List<Map<String, String>> data = mlEditor.getData();
    224                     if (!Preferences.equalListOfStructs(mlSetting.getValue(), data)) {
     226                    if (!mlSetting.equalVal(data)) {
    225227                        pe.setValue(new Preferences.MapListSetting(data));
    226228                        ok = true;
Note: See TracChangeset for help on using the changeset viewer.