Package org.openstreetmap.josm.data.Preferences

Examples of org.openstreetmap.josm.data.Preferences.ListListSetting


                    e.setValue(new ListSetting(data));
                    return true;
                }
            }
        } else if (stg instanceof ListListSetting) {
            ListListSetting llSetting = (ListListSetting) stg;
            ListListEditor llEditor = new ListListEditor(gui, e, llSetting);
            llEditor.showDialog();
            if (llEditor.getValue() == 1) {
                List<List<String>> data = llEditor.getData();
                if (!llSetting.equalVal(data)) {
                    e.setValue(new ListListSetting(data));
                    return true;
                }
            }
        } else if (stg instanceof MapListSetting) {
            MapListSetting mlSetting = (MapListSetting) stg;
View Full Code Here


                        pe.setValue(new ListSetting(data));
                        ok = true;
                    }
                }
            } else if (rbListList.isSelected()) {
                ListListSetting llSetting = new ListListSetting(null);
                pe = new PrefEntry(tkey.getText(), llSetting, llSetting, false);
                ListListEditor llEditor = new ListListEditor(gui, pe, llSetting);
                llEditor.showDialog();
                if (llEditor.getValue() == 1) {
                    List<List<String>> data = llEditor.getData();
                    if (!llSetting.equalVal(data)) {
                        pe.setValue(new ListListSetting(data));
                        ok = true;
                    }
                }
            } else if (rbMapList.isSelected()) {
                MapListSetting mlSetting = new MapListSetting(null);
View Full Code Here

                            newItems.add(item);
                        }
                    }
                    mainpref.putCollection(key, newItems);
                } else if (entry.getValue() instanceof ListListSetting) {
                    ListListSetting llSetting = (ListListSetting) entry.getValue();
                    Collection<Collection<String>> newLists = getArray(mainpref, key, true);
                    if (newLists == null) continue;

                    for (Collection<String> list : llSetting.getValue()) {
                        // add nonexisting list (equals comparison for lists is used implicitly)
                        if (!newLists.contains(list)) {
                            newLists.add(list);
                        }
                    }
View Full Code Here

                        log("Deleting preferences: from list %s: %s\n", key, item);
                        newItems.remove(item);
                    }
                    mainpref.putCollection(entry.getKey(), newItems);
                } else if (entry.getValue() instanceof ListListSetting) {
                    ListListSetting llSetting = (ListListSetting) entry.getValue();
                    Collection<Collection<String>> newLists = getArray(mainpref, key, true);
                    if (newLists == null) continue;

                    // if items are found in one of lists, remove that list!
                    Iterator<Collection<String>> listIterator = newLists.iterator();
                    while (listIterator.hasNext()) {
                        Collection<String> list = listIterator.next();
                        for (Collection<String> removeList : llSetting.getValue()) {
                            if (list.containsAll(removeList)) {
                                // remove current list, because it matches search criteria
                                log("Deleting preferences: list from lists %s: %s\n", key, list);
                                listIterator.remove();
                            }
View Full Code Here

        else
            return defaults.getValue() == null ? null : new ArrayList<>(defaults.getValue());
    }

    private static Collection<Collection<String>> getArray(Preferences mainpref, String key, boolean warnUnknownDefault)  {
        ListListSetting existing = Utils.cast(mainpref.settingsMap.get(key), ListListSetting.class);
        ListListSetting defaults = Utils.cast(mainpref.defaultsMap.get(key), ListListSetting.class);

        if (existing == null && defaults == null) {
            if (warnUnknownDefault) defaultUnknownWarning(key);
            return null;
        }
        if (existing != null)
            return new ArrayList<Collection<String>>(existing.getValue());
        else
            return defaults.getValue() == null ? null : new ArrayList<Collection<String>>(defaults.getValue());
    }
View Full Code Here

        }

        for (Entry<String, List<Collection<String>>> e : listlistMap.entrySet()) {
            @SuppressWarnings("unchecked")
            List<List<String>> value = (List)e.getValue();
            tmp.put(e.getKey(), new ListListSetting(value));
        }
        for (Entry<String, List<Map<String, String>>> e : listmapMap.entrySet()) {
            tmp.put(e.getKey(), new MapListSetting(e.getValue()));
        }
        for (Entry<String, Setting<?>> e : tmp.entrySet()) {
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.Preferences.ListListSetting

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.