1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.gui.preferences.advanced;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.Component;
|
---|
7 | import java.awt.Dimension;
|
---|
8 | import java.awt.Font;
|
---|
9 | import java.awt.GridBagLayout;
|
---|
10 | import java.awt.event.ActionEvent;
|
---|
11 | import java.awt.event.ActionListener;
|
---|
12 | import java.awt.event.MouseAdapter;
|
---|
13 | import java.awt.event.MouseEvent;
|
---|
14 | import java.util.ArrayList;
|
---|
15 | import java.util.Collection;
|
---|
16 | import java.util.Collections;
|
---|
17 | import java.util.List;
|
---|
18 | import java.util.Map;
|
---|
19 | import java.util.Map.Entry;
|
---|
20 |
|
---|
21 | import javax.swing.Box;
|
---|
22 | import javax.swing.ButtonGroup;
|
---|
23 | import javax.swing.DefaultCellEditor;
|
---|
24 | import javax.swing.JButton;
|
---|
25 | import javax.swing.JLabel;
|
---|
26 | import javax.swing.JOptionPane;
|
---|
27 | import javax.swing.JPanel;
|
---|
28 | import javax.swing.JRadioButton;
|
---|
29 | import javax.swing.JScrollPane;
|
---|
30 | import javax.swing.JTable;
|
---|
31 | import javax.swing.JTextField;
|
---|
32 | import javax.swing.event.DocumentEvent;
|
---|
33 | import javax.swing.event.DocumentListener;
|
---|
34 | import javax.swing.table.DefaultTableCellRenderer;
|
---|
35 | import javax.swing.table.DefaultTableModel;
|
---|
36 |
|
---|
37 | import org.openstreetmap.josm.Main;
|
---|
38 | import org.openstreetmap.josm.data.Preferences;
|
---|
39 | import org.openstreetmap.josm.data.Preferences.ListListSetting;
|
---|
40 | import org.openstreetmap.josm.data.Preferences.ListSetting;
|
---|
41 | import org.openstreetmap.josm.data.Preferences.MapListSetting;
|
---|
42 | import org.openstreetmap.josm.data.Preferences.Setting;
|
---|
43 | import org.openstreetmap.josm.data.Preferences.StringSetting;
|
---|
44 | import org.openstreetmap.josm.gui.ExtendedDialog;
|
---|
45 | import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
|
---|
46 | import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
|
---|
47 | import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory;
|
---|
48 | import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
|
---|
49 | import org.openstreetmap.josm.tools.CheckParameterUtil;
|
---|
50 | import org.openstreetmap.josm.tools.GBC;
|
---|
51 | import org.openstreetmap.josm.tools.Utils;
|
---|
52 |
|
---|
53 | public class AdvancedPreference extends DefaultTabPreferenceSetting {
|
---|
54 |
|
---|
55 | public static class Factory implements PreferenceSettingFactory {
|
---|
56 | public PreferenceSetting createPreferenceSetting() {
|
---|
57 | return new AdvancedPreference();
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | private AdvancedPreference() {
|
---|
62 | super("advanced", tr("Advanced Preferences"), tr("Setting Preference entries directly. Use with caution!"));
|
---|
63 | }
|
---|
64 |
|
---|
65 | @Override
|
---|
66 | public boolean isExpert() {
|
---|
67 | return true;
|
---|
68 | }
|
---|
69 |
|
---|
70 | public static class PrefEntry implements Comparable<PrefEntry> {
|
---|
71 | private String key;
|
---|
72 | private Setting value;
|
---|
73 | private Setting defaultValue;
|
---|
74 | private boolean isDefault;
|
---|
75 | private boolean changed;
|
---|
76 |
|
---|
77 | public PrefEntry(String key, Setting value, Setting defaultValue, boolean isDefault) {
|
---|
78 | CheckParameterUtil.ensureParameterNotNull(key);
|
---|
79 | CheckParameterUtil.ensureParameterNotNull(value);
|
---|
80 | CheckParameterUtil.ensureParameterNotNull(defaultValue);
|
---|
81 | this.key = key;
|
---|
82 | this.value = value;
|
---|
83 | this.defaultValue = defaultValue;
|
---|
84 | this.isDefault = isDefault;
|
---|
85 | }
|
---|
86 |
|
---|
87 | public String getKey() {
|
---|
88 | return key;
|
---|
89 | }
|
---|
90 |
|
---|
91 | public Setting getValue() {
|
---|
92 | return value;
|
---|
93 | }
|
---|
94 |
|
---|
95 | public Setting getDefaultValue() {
|
---|
96 | return defaultValue;
|
---|
97 | }
|
---|
98 |
|
---|
99 | public void setValue(Setting value) {
|
---|
100 | this.value = value;
|
---|
101 | changed = true;
|
---|
102 | isDefault = false;
|
---|
103 | }
|
---|
104 |
|
---|
105 | public boolean isDefault() {
|
---|
106 | return isDefault;
|
---|
107 | }
|
---|
108 |
|
---|
109 | public boolean isChanged() {
|
---|
110 | return changed;
|
---|
111 | }
|
---|
112 |
|
---|
113 | public void reset() {
|
---|
114 | value = defaultValue;
|
---|
115 | changed = true;
|
---|
116 | isDefault = true;
|
---|
117 | }
|
---|
118 |
|
---|
119 | public int compareTo(PrefEntry other) {
|
---|
120 | return key.compareTo(other.key);
|
---|
121 | }
|
---|
122 | }
|
---|
123 |
|
---|
124 | private AllSettingsTableModel model;
|
---|
125 | protected List<PrefEntry> data;
|
---|
126 | protected List<PrefEntry> displayData;
|
---|
127 | protected JTextField txtFilter;
|
---|
128 |
|
---|
129 | public void addGui(final PreferenceTabbedPane gui) {
|
---|
130 | JPanel p = gui.createPreferenceTab(this);
|
---|
131 |
|
---|
132 | txtFilter = new JTextField();
|
---|
133 | JLabel lbFilter = new JLabel(tr("Search: "));
|
---|
134 | lbFilter.setLabelFor(txtFilter);
|
---|
135 | p.add(lbFilter);
|
---|
136 | p.add(txtFilter, GBC.eol().fill(GBC.HORIZONTAL));
|
---|
137 | txtFilter.getDocument().addDocumentListener(new DocumentListener(){
|
---|
138 | @Override public void changedUpdate(DocumentEvent e) {
|
---|
139 | action();
|
---|
140 | }
|
---|
141 | @Override public void insertUpdate(DocumentEvent e) {
|
---|
142 | action();
|
---|
143 | }
|
---|
144 | @Override public void removeUpdate(DocumentEvent e) {
|
---|
145 | action();
|
---|
146 | }
|
---|
147 | private void action() {
|
---|
148 | applyFilter();
|
---|
149 | }
|
---|
150 | });
|
---|
151 |
|
---|
152 | Map<String, Setting> orig = Main.pref.getAllSettings();
|
---|
153 | Map<String, Setting> defaults = Main.pref.getAllDefaults();
|
---|
154 | orig.remove("osm-server.password");
|
---|
155 | defaults.remove("osm-server.password");
|
---|
156 | prepareData(orig, defaults);
|
---|
157 | model = new AllSettingsTableModel();
|
---|
158 | applyFilter();
|
---|
159 |
|
---|
160 | final JTable list = new JTable(model);
|
---|
161 | list.putClientProperty("terminateEditOnFocusLost", true);
|
---|
162 | list.getColumnModel().getColumn(1).setCellRenderer(new SettingCellRenderer());
|
---|
163 | list.getColumnModel().getColumn(1).setCellEditor(new SettingCellEditor());
|
---|
164 |
|
---|
165 | JScrollPane scroll = new JScrollPane(list);
|
---|
166 | p.add(scroll, GBC.eol().fill(GBC.BOTH));
|
---|
167 | scroll.setPreferredSize(new Dimension(400,200));
|
---|
168 |
|
---|
169 | JButton add = new JButton(tr("Add"));
|
---|
170 | p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
|
---|
171 | p.add(add, GBC.std().insets(0,5,0,0));
|
---|
172 | add.addActionListener(new ActionListener(){
|
---|
173 | public void actionPerformed(ActionEvent e) {
|
---|
174 | addPreference(gui);
|
---|
175 | }
|
---|
176 | });
|
---|
177 |
|
---|
178 | JButton edit = new JButton(tr("Edit"));
|
---|
179 | p.add(edit, GBC.std().insets(5,5,5,0));
|
---|
180 | edit.addActionListener(new ActionListener(){
|
---|
181 | public void actionPerformed(ActionEvent e) {
|
---|
182 | editPreference(gui, list);
|
---|
183 | }
|
---|
184 | });
|
---|
185 |
|
---|
186 | JButton reset = new JButton(tr("Reset"));
|
---|
187 | p.add(reset, GBC.std().insets(0,5,0,0));
|
---|
188 | reset.addActionListener(new ActionListener(){
|
---|
189 | public void actionPerformed(ActionEvent e) {
|
---|
190 | resetPreference(gui, list);
|
---|
191 | }
|
---|
192 | });
|
---|
193 |
|
---|
194 | list.addMouseListener(new MouseAdapter(){
|
---|
195 | @Override public void mouseClicked(MouseEvent e) {
|
---|
196 | if (e.getClickCount() == 2) {
|
---|
197 | editPreference(gui, list);
|
---|
198 | }
|
---|
199 | }
|
---|
200 | });
|
---|
201 | }
|
---|
202 |
|
---|
203 | private void prepareData(Map<String, Setting> orig, Map<String, Setting> defaults) {
|
---|
204 | data = new ArrayList<PrefEntry>();
|
---|
205 | for (Entry<String, Setting> e : orig.entrySet()) {
|
---|
206 | Setting value = e.getValue();
|
---|
207 | Setting def = defaults.get(e.getKey());
|
---|
208 | if (def == null) {
|
---|
209 | def = value.getNullInstance();
|
---|
210 | }
|
---|
211 | PrefEntry en = new PrefEntry(e.getKey(), value, def, false);
|
---|
212 | data.add(en);
|
---|
213 | }
|
---|
214 | for (Entry<String, Setting> e : defaults.entrySet()) {
|
---|
215 | if (!orig.containsKey(e.getKey())) {
|
---|
216 | PrefEntry en = new PrefEntry(e.getKey(), e.getValue(), e.getValue(), true);
|
---|
217 | data.add(en);
|
---|
218 | }
|
---|
219 | }
|
---|
220 | Collections.sort(data);
|
---|
221 | displayData = new ArrayList<PrefEntry>(data);
|
---|
222 | }
|
---|
223 |
|
---|
224 | class AllSettingsTableModel extends DefaultTableModel {
|
---|
225 |
|
---|
226 | public AllSettingsTableModel() {
|
---|
227 | setColumnIdentifiers(new String[]{tr("Key"), tr("Value")});
|
---|
228 | }
|
---|
229 |
|
---|
230 | @Override
|
---|
231 | public boolean isCellEditable(int row, int column) {
|
---|
232 | return column == 1 && (displayData.get(row).getValue() instanceof StringSetting);
|
---|
233 | }
|
---|
234 |
|
---|
235 | @Override
|
---|
236 | public int getRowCount() {
|
---|
237 | return displayData.size();
|
---|
238 | }
|
---|
239 |
|
---|
240 | @Override
|
---|
241 | public Object getValueAt(int row, int column) {
|
---|
242 | if (column == 0)
|
---|
243 | return displayData.get(row).getKey();
|
---|
244 | else
|
---|
245 | return displayData.get(row);
|
---|
246 | }
|
---|
247 |
|
---|
248 | @Override
|
---|
249 | public void setValueAt(Object o, int row, int column) {
|
---|
250 | PrefEntry pe = displayData.get(row);
|
---|
251 | String s = (String) o;
|
---|
252 | if (!s.equals(pe.getValue().getValue())) {
|
---|
253 | pe.setValue(new StringSetting(s));
|
---|
254 | fireTableCellUpdated(row, column);
|
---|
255 | }
|
---|
256 | }
|
---|
257 | }
|
---|
258 |
|
---|
259 | private static class SettingCellRenderer extends DefaultTableCellRenderer {
|
---|
260 | @Override
|
---|
261 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
---|
262 | if (value == null)
|
---|
263 | return this;
|
---|
264 | PrefEntry pe = (PrefEntry) value;
|
---|
265 | Setting setting = pe.getValue();
|
---|
266 | Object val = setting.getValue();
|
---|
267 | String display = val != null ? val.toString() : "<html><i><"+tr("unset")+"></i></html>";
|
---|
268 |
|
---|
269 | JLabel label = (JLabel)super.getTableCellRendererComponent(table,
|
---|
270 | display, isSelected, hasFocus, row, column);
|
---|
271 | if (!pe.isDefault()) {
|
---|
272 | label.setFont(label.getFont().deriveFont(Font.BOLD));
|
---|
273 | }
|
---|
274 | val = pe.getDefaultValue().getValue();
|
---|
275 | if(val != null)
|
---|
276 | {
|
---|
277 | if(pe.isDefault()) {
|
---|
278 | label.setToolTipText(tr("Current value is default."));
|
---|
279 | } else {
|
---|
280 | label.setToolTipText(tr("Default value is ''{0}''.", val));
|
---|
281 | }
|
---|
282 | } else {
|
---|
283 | label.setToolTipText(tr("Default value currently unknown (setting has not been used yet)."));
|
---|
284 | }
|
---|
285 | return label;
|
---|
286 | }
|
---|
287 | }
|
---|
288 |
|
---|
289 | private static class SettingCellEditor extends DefaultCellEditor {
|
---|
290 | public SettingCellEditor() {
|
---|
291 | super(new JTextField());
|
---|
292 | }
|
---|
293 |
|
---|
294 | @Override
|
---|
295 | public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
|
---|
296 | PrefEntry pe = (PrefEntry) value;
|
---|
297 | StringSetting stg = (StringSetting) pe.getValue();
|
---|
298 | String s = stg.getValue() == null ? "" : stg.getValue();
|
---|
299 | return super.getTableCellEditorComponent(table, s, isSelected, row, column);
|
---|
300 | }
|
---|
301 | }
|
---|
302 |
|
---|
303 | private void applyFilter() {
|
---|
304 | displayData.clear();
|
---|
305 | for (PrefEntry e : data) {
|
---|
306 |
|
---|
307 | String prefKey = e.getKey();
|
---|
308 | Setting valueSetting = e.getValue();
|
---|
309 | String prefValue = valueSetting.getValue() == null ? "" : valueSetting.getValue().toString();
|
---|
310 |
|
---|
311 | String input[] = txtFilter.getText().split("\\s+");
|
---|
312 | boolean canHas = true;
|
---|
313 |
|
---|
314 | // Make 'wmsplugin cache' search for e.g. 'cache.wmsplugin'
|
---|
315 | final String prefKeyLower = prefKey.toLowerCase();
|
---|
316 | final String prefValueLower = prefValue.toLowerCase();
|
---|
317 | for (String bit : input) {
|
---|
318 | bit = bit.toLowerCase();
|
---|
319 | if (!prefKeyLower.contains(bit) && !prefValueLower.contains(bit)) {
|
---|
320 | canHas = false;
|
---|
321 | break;
|
---|
322 | }
|
---|
323 | }
|
---|
324 | if (canHas) {
|
---|
325 | displayData.add(e);
|
---|
326 | }
|
---|
327 | }
|
---|
328 | model.fireTableDataChanged();
|
---|
329 | }
|
---|
330 |
|
---|
331 | @Override
|
---|
332 | public boolean ok() {
|
---|
333 | for (PrefEntry e : data) {
|
---|
334 | if (e.isChanged()) {
|
---|
335 | Main.pref.putSetting(e.getKey(), e.getValue());
|
---|
336 | }
|
---|
337 | }
|
---|
338 | return false;
|
---|
339 | }
|
---|
340 |
|
---|
341 | private void resetPreference(final PreferenceTabbedPane gui, final JTable list) {
|
---|
342 | if (list.getSelectedRowCount() == 0) {
|
---|
343 | JOptionPane.showMessageDialog(
|
---|
344 | gui,
|
---|
345 | tr("Please select the row to delete."),
|
---|
346 | tr("Warning"),
|
---|
347 | JOptionPane.WARNING_MESSAGE
|
---|
348 | );
|
---|
349 | return;
|
---|
350 | }
|
---|
351 | for (int row : list.getSelectedRows()) {
|
---|
352 | PrefEntry e = displayData.get(row);
|
---|
353 | e.reset();
|
---|
354 | }
|
---|
355 | model.fireTableDataChanged();
|
---|
356 | }
|
---|
357 |
|
---|
358 | private void addPreference(final PreferenceTabbedPane gui) {
|
---|
359 | JPanel p = new JPanel(new GridBagLayout());
|
---|
360 | p.add(new JLabel(tr("Key")), GBC.std().insets(0,0,5,0));
|
---|
361 | JTextField tkey = new JTextField("", 50);
|
---|
362 | p.add(tkey, GBC.eop().insets(5,0,0,0).fill(GBC.HORIZONTAL));
|
---|
363 |
|
---|
364 | p.add(new JLabel(tr("Select Setting Type:")), GBC.eol().insets(5,15,5,0));
|
---|
365 |
|
---|
366 | JRadioButton rbString = new JRadioButton(tr("Simple"));
|
---|
367 | JRadioButton rbList = new JRadioButton(tr("List"));
|
---|
368 | JRadioButton rbListList = new JRadioButton(tr("List of lists"));
|
---|
369 | JRadioButton rbMapList = new JRadioButton(tr("List of maps"));
|
---|
370 |
|
---|
371 | ButtonGroup group = new ButtonGroup();
|
---|
372 | group.add(rbString);
|
---|
373 | group.add(rbList);
|
---|
374 | group.add(rbListList);
|
---|
375 | group.add(rbMapList);
|
---|
376 |
|
---|
377 | p.add(rbString, GBC.eol());
|
---|
378 | p.add(rbList, GBC.eol());
|
---|
379 | p.add(rbListList, GBC.eol());
|
---|
380 | p.add(rbMapList, GBC.eol());
|
---|
381 |
|
---|
382 | rbString.setSelected(true);
|
---|
383 |
|
---|
384 | ExtendedDialog dlg = new ExtendedDialog(gui, tr("Add setting"), new String[] {tr("OK"), tr("Cancel")});
|
---|
385 | dlg.setButtonIcons(new String[] {"ok.png", "cancel.png"});
|
---|
386 | dlg.setContent(p);
|
---|
387 | dlg.showDialog();
|
---|
388 |
|
---|
389 | PrefEntry pe = null;
|
---|
390 | boolean ok = false;
|
---|
391 | if (dlg.getValue() == 1) {
|
---|
392 | if (rbString.isSelected()) {
|
---|
393 | StringSetting sSetting = new StringSetting(null);
|
---|
394 | pe = new PrefEntry(tkey.getText(), sSetting, sSetting, false);
|
---|
395 | StringEditor sEditor = new StringEditor(gui, pe, sSetting);
|
---|
396 | sEditor.showDialog();
|
---|
397 | if (sEditor.getValue() == 1) {
|
---|
398 | String data = sEditor.getData();
|
---|
399 | if (!Utils.equal(sSetting.getValue(), data)) {
|
---|
400 | pe.setValue(new StringSetting(data));
|
---|
401 | ok = true;
|
---|
402 | }
|
---|
403 | }
|
---|
404 | } else if (rbList.isSelected()) {
|
---|
405 | ListSetting lSetting = new ListSetting(null);
|
---|
406 | pe = new PrefEntry(tkey.getText(), lSetting, lSetting, false);
|
---|
407 | ListEditor lEditor = new ListEditor(gui, pe, lSetting);
|
---|
408 | lEditor.showDialog();
|
---|
409 | if (lEditor.getValue() == 1) {
|
---|
410 | List<String> data = lEditor.getData();
|
---|
411 | if (!Preferences.equalCollection(lSetting.getValue(), data)) {
|
---|
412 | pe.setValue(new ListSetting(data));
|
---|
413 | ok = true;
|
---|
414 | }
|
---|
415 | }
|
---|
416 | } else if (rbListList.isSelected()) {
|
---|
417 | ListListSetting llSetting = new ListListSetting(null);
|
---|
418 | pe = new PrefEntry(tkey.getText(), llSetting, llSetting, false);
|
---|
419 | ListListEditor llEditor = new ListListEditor(gui, pe, llSetting);
|
---|
420 | llEditor.showDialog();
|
---|
421 | if (llEditor.getValue() == 1) {
|
---|
422 | List<List<String>> data = llEditor.getData();
|
---|
423 | if (!Preferences.equalArray((Collection) llSetting.getValue(), data)) {
|
---|
424 | pe.setValue(new ListListSetting(data));
|
---|
425 | ok = true;
|
---|
426 | }
|
---|
427 | }
|
---|
428 | } else if (rbMapList.isSelected()) {
|
---|
429 | MapListSetting mlSetting = new MapListSetting(null);
|
---|
430 | pe = new PrefEntry(tkey.getText(), mlSetting, mlSetting, false);
|
---|
431 | MapListEditor mlEditor = new MapListEditor(gui, pe, mlSetting);
|
---|
432 | mlEditor.showDialog();
|
---|
433 | if (mlEditor.getValue() == 1) {
|
---|
434 | List<Map<String, String>> data = mlEditor.getData();
|
---|
435 | if (!Preferences.equalListOfStructs(mlSetting.getValue(), data)) {
|
---|
436 | pe.setValue(new MapListSetting(data));
|
---|
437 | ok = true;
|
---|
438 | }
|
---|
439 | }
|
---|
440 | }
|
---|
441 | if (ok) {
|
---|
442 | data.add(pe);
|
---|
443 | Collections.sort(data);
|
---|
444 | applyFilter();
|
---|
445 | }
|
---|
446 | }
|
---|
447 | }
|
---|
448 |
|
---|
449 | private void editPreference(final PreferenceTabbedPane gui, final JTable list) {
|
---|
450 | if (list.getSelectedRowCount() != 1) {
|
---|
451 | JOptionPane.showMessageDialog(
|
---|
452 | gui,
|
---|
453 | tr("Please select the row to edit."),
|
---|
454 | tr("Warning"),
|
---|
455 | JOptionPane.WARNING_MESSAGE
|
---|
456 | );
|
---|
457 | return;
|
---|
458 | }
|
---|
459 | final PrefEntry e = (PrefEntry) model.getValueAt(list.getSelectedRow(), 1);
|
---|
460 | Setting stg = e.getValue();
|
---|
461 | if (stg instanceof StringSetting) {
|
---|
462 | list.editCellAt(list.getSelectedRow(), 1);
|
---|
463 | Component editor = list.getEditorComponent();
|
---|
464 | if (editor != null) {
|
---|
465 | editor.requestFocus();
|
---|
466 | }
|
---|
467 | } else if (stg instanceof ListSetting) {
|
---|
468 | ListSetting lSetting = (ListSetting) stg;
|
---|
469 | ListEditor lEditor = new ListEditor(gui, e, lSetting);
|
---|
470 | lEditor.showDialog();
|
---|
471 | if (lEditor.getValue() == 1) {
|
---|
472 | List<String> data = lEditor.getData();
|
---|
473 | if (!Preferences.equalCollection(lSetting.getValue(), data)) {
|
---|
474 | e.setValue(new ListSetting(data));
|
---|
475 | applyFilter();
|
---|
476 | }
|
---|
477 | }
|
---|
478 | } else if (stg instanceof ListListSetting) {
|
---|
479 | ListListEditor llEditor = new ListListEditor(gui, e, (ListListSetting) stg);
|
---|
480 | llEditor.showDialog();
|
---|
481 | if (llEditor.getValue() == 1) {
|
---|
482 | List<List<String>> data = llEditor.getData();
|
---|
483 | if (!Preferences.equalArray((Collection) stg.getValue(), data)) {
|
---|
484 | e.setValue(new ListListSetting(data));
|
---|
485 | applyFilter();
|
---|
486 | }
|
---|
487 | }
|
---|
488 | } else if (stg instanceof MapListSetting) {
|
---|
489 | MapListSetting mlSetting = (MapListSetting) stg;
|
---|
490 | MapListEditor mlEditor = new MapListEditor(gui, e, mlSetting);
|
---|
491 | mlEditor.showDialog();
|
---|
492 | if (mlEditor.getValue() == 1) {
|
---|
493 | List<Map<String, String>> data = mlEditor.getData();
|
---|
494 | if (!Preferences.equalListOfStructs(mlSetting.getValue(), data)) {
|
---|
495 | e.setValue(new MapListSetting(data));
|
---|
496 | applyFilter();
|
---|
497 | }
|
---|
498 | }
|
---|
499 | }
|
---|
500 | }
|
---|
501 | }
|
---|