Changeset 17609 in josm


Ignore:
Timestamp:
2021-03-20T23:07:02+01:00 (4 years ago)
Author:
simon04
Message:

see #18949 - Extract class TaggingPresetItemGuiSupport

Location:
trunk
Files:
1 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

    r17606 r17609  
    329329
    330330        boolean presetInitiallyMatches = !selected.isEmpty() && selected.stream().allMatch(this);
     331        final TaggingPresetItemGuiSupport itemGuiSupport = TaggingPresetItemGuiSupport.create(presetInitiallyMatches, selected);
    331332        JPanel items = new JPanel(new GridBagLayout());
    332333        TaggingPresetItem previous = null;
     
    342343                    }
    343344                }
    344                 if (i.addToPanel(items, selected, presetInitiallyMatches)) {
     345                if (i.addToPanel(items, itemGuiSupport)) {
    345346                    p.hasElements = true;
    346347                }
     
    355356        // add Link
    356357        for (Link link : l) {
    357             link.addToPanel(p, selected, presetInitiallyMatches);
     358            link.addToPanel(p, itemGuiSupport);
    358359        }
    359360
     
    674675        return iconFuture;
    675676    }
     677
    676678}
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java

    r16690 r17609  
    5757     *
    5858     * @param p The panel where components must be added
    59      * @param sel The related selected OSM primitives
    60      * @param presetInitiallyMatches Whether this {@link TaggingPreset} already matched before applying,
    61      *                               i.e. whether the map feature already existed on the primitive.
     59     * @param support supporting class for creating the GUI
    6260     * @return {@code true} if this item adds semantic tagging elements, {@code false} otherwise.
    6361     */
    64     protected abstract boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches);
     62    protected abstract boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support);
    6563
    6664    /**
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Check.java

    r17607 r17609  
    1616import org.openstreetmap.josm.data.osm.OsmUtils;
    1717import org.openstreetmap.josm.data.osm.Tag;
     18import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1819import org.openstreetmap.josm.gui.widgets.QuadStateCheckBox;
    1920import org.openstreetmap.josm.tools.GBC;
     
    3839
    3940    @Override
    40     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     41    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    4142
    4243        // find out if our key is already used in the selection.
    43         final Usage usage = determineBooleanUsage(sel, key);
     44        final Usage usage = determineBooleanUsage(support.getSelected(), key);
    4445        final String oneValue = usage.values.isEmpty() ? null : usage.values.last();
    4546        def = "on".equals(default_) ? Boolean.TRUE : "off".equals(default_) ? Boolean.FALSE : null;
     
    5051            if (def != null && !PROP_FILL_DEFAULT.get()) {
    5152                // default is set and filling default values feature is disabled - check if all primitives are untagged
    52                 for (OsmPrimitive s : sel) {
     53                for (OsmPrimitive s : support.getSelected()) {
    5354                    if (s.hasKeys()) {
    5455                        def = null;
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroup.java

    r16042 r17609  
    33
    44import java.awt.GridLayout;
    5 import java.util.Collection;
    65import java.util.LinkedList;
    76import java.util.List;
     
    109import javax.swing.JPanel;
    1110
    12 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1311import org.openstreetmap.josm.data.osm.Tag;
    1412import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1514import org.openstreetmap.josm.tools.GBC;
    1615
     
    3231
    3332    @Override
    34     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     33    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    3534        int rows = (int) Math.ceil(checks.size() / ((double) columns));
    3635        JPanel panel = new JPanel(new GridLayout(rows, columns));
    3736
    3837        for (Check check : checks) {
    39             check.addToPanel(panel, sel, presetInitiallyMatches);
     38            check.addToPanel(panel, support);
    4039        }
    4140
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r17605 r17609  
    2828import javax.swing.ListCellRenderer;
    2929
    30 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    3130import org.openstreetmap.josm.data.osm.Tag;
     31import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    3232import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector;
    3333import org.openstreetmap.josm.spi.preferences.Config;
     
    206206
    207207    @Override
    208     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     208    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    209209        initListEntries(true);
    210210
    211211        // find out if our key is already used in the selection.
    212         usage = determineTextUsage(sel, key);
     212        usage = determineTextUsage(support.getSelected(), key);
    213213        if (!usage.hasUniqueValue() && !usage.unused()) {
    214214            presetListEntries.add(new PresetListEntry(DIFFERENT));
     
    220220        label.setComponentPopupMenu(getPopupMenu());
    221221        p.add(label, GBC.std().insets(0, 0, 10, 0));
    222         addToPanelAnchor(p, default_, presetInitiallyMatches);
     222        addToPanelAnchor(p, default_, support.isPresetInitiallyMatches());
    223223        label.setLabelFor(component);
    224224        component.setToolTipText(getKeyTooltipText());
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparator.java

    r9665 r17609  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    33
    4 import java.util.Collection;
    54import java.util.List;
    65
     
    87import javax.swing.JSeparator;
    98
    10 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    119import org.openstreetmap.josm.data.osm.Tag;
    1210import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem;
     11import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1312import org.openstreetmap.josm.tools.GBC;
    1413
     
    2019
    2120    @Override
    22     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     21    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    2322        p.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(0, 5, 0, 5));
    2423        return false;
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Key.java

    r9665 r17609  
    88import javax.swing.JPanel;
    99
    10 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1110import org.openstreetmap.josm.data.osm.Tag;
     11import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1212
    1313/**
     
    2020
    2121    @Override
    22     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     22    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    2323        return false;
    2424    }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Label.java

    r17605 r17609  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    3 
    4 import java.util.Collection;
    53
    64import javax.swing.JLabel;
    75import javax.swing.JPanel;
    86
    9 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     7import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    108import org.openstreetmap.josm.tools.GBC;
    119
     
    1614
    1715    @Override
    18     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     16    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    1917        initializeLocaleText(null);
    2018        JLabel label = new JLabel(locale_text);
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Link.java

    r17605 r17609  
    66import java.awt.event.MouseEvent;
    77import java.util.Arrays;
    8 import java.util.Collection;
    98import java.util.Optional;
    109
     
    1211import javax.swing.SwingUtilities;
    1312
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1513import org.openstreetmap.josm.gui.dialogs.properties.HelpAction;
     14import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1615import org.openstreetmap.josm.gui.widgets.UrlLabel;
    1716import org.openstreetmap.josm.spi.preferences.Config;
     
    3534
    3635    @Override
    37     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     36    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    3837        initializeLocaleText(tr("More information about this feature"));
    3938        Optional.ofNullable(buildUrlLabel()).ifPresent(label -> p.add(label, GBC.eol().insets(0, 10, 0, 0).fill(GBC.HORIZONTAL)));
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Optional.java

    r9665 r17609  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.util.Collection;
    7 
    86import javax.swing.JLabel;
    97import javax.swing.JPanel;
    108
    11 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     9import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1210import org.openstreetmap.josm.tools.GBC;
    1311
     
    2018    // TODO: Draw a box around optional stuff
    2119    @Override
    22     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     20    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    2321        initializeLocaleText(tr("Optional Attributes:"));
    2422        p.add(new JLabel(" "), GBC.eol()); // space
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetLink.java

    r16699 r17609  
    1616import org.openstreetmap.josm.data.osm.Tag;
    1717import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
     18import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1819import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetLabel;
    1920import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
     
    5455
    5556    @Override
    56     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     57    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    5758        final String presetName = preset_name;
    5859        Optional<TaggingPreset> found = TaggingPresets.getTaggingPresets().stream().filter(preset -> presetName.equals(preset.name)).findFirst();
     
    6061            TaggingPreset t = found.get();
    6162            JLabel lbl = new TaggingPresetLabel(t);
    62             lbl.addMouseListener(new TaggingPresetMouseAdapter(t, sel));
     63            lbl.addMouseListener(new TaggingPresetMouseAdapter(t, support.getSelected()));
    6364            p.add(lbl, GBC.eol().fill(GBC.HORIZONTAL));
    6465        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Roles.java

    r17333 r17609  
    66import java.awt.GridBagLayout;
    77import java.util.ArrayList;
    8 import java.util.Collection;
    98import java.util.List;
    109import java.util.Set;
     
    1312import javax.swing.JPanel;
    1413
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1614import org.openstreetmap.josm.data.osm.Tag;
    1715import org.openstreetmap.josm.data.osm.search.SearchCompiler;
     
    1917import org.openstreetmap.josm.data.osm.search.SearchSetting;
    2018import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem;
     19import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    2120import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetType;
    2221import org.openstreetmap.josm.tools.GBC;
     
    191190
    192191    @Override
    193     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     192    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    194193        p.add(new JLabel(" "), GBC.eol()); // space
    195194        if (!roles.isEmpty()) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Space.java

    r9665 r17609  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    33
    4 import java.util.Collection;
    54import java.util.List;
    65
     
    87import javax.swing.JPanel;
    98
    10 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    119import org.openstreetmap.josm.data.osm.Tag;
    1210import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem;
     11import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1312import org.openstreetmap.josm.tools.GBC;
    1413
     
    1918
    2019    @Override
    21     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     20    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    2221        p.add(new JLabel(" "), GBC.eol()); // space
    2322        return false;
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java

    r17605 r17609  
    2222import javax.swing.JToggleButton;
    2323
    24 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2524import org.openstreetmap.josm.data.osm.Tag;
    2625import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
    2726import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
     27import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    2828import org.openstreetmap.josm.gui.widgets.JosmComboBox;
    2929import org.openstreetmap.josm.gui.widgets.JosmTextField;
     
    6161
    6262    @Override
    63     public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
     63    public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) {
    6464
    6565        // find out if our key is already used in the selection.
    66         Usage usage = determineTextUsage(sel, key);
     66        Usage usage = determineTextUsage(support.getSelected(), key);
    6767        AutoCompletingTextField textField = new AutoCompletingTextField();
    6868        if (alternative_autocomplete_keys != null) {
     
    8888            } else if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) {
    8989                // selected osm primitives are untagged or filling default values feature is enabled
    90                 if (!presetInitiallyMatches && !"false".equals(use_last_as_default) && LAST_VALUES.containsKey(key)) {
     90                if (!support.isPresetInitiallyMatches() && !"false".equals(use_last_as_default) && LAST_VALUES.containsKey(key)) {
    9191                    textField.setText(LAST_VALUES.get(key));
    9292                } else {
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3634        JPanel p = new JPanel();
    3735        assertEquals(0, p.getComponentCount());
    38         assertFalse(cg.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     36        assertFalse(cg.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3937        assertTrue(p.getComponentCount() > 0);
    4038    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
    119import org.junit.jupiter.api.extension.RegisterExtension;
    1210import org.junit.jupiter.api.Test;
    13 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     11import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1412import org.openstreetmap.josm.testutils.JOSMTestRules;
    1513
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertTrue(new Check().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertTrue(new Check().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java

    r17275 r17609  
    66
    77import java.awt.Color;
    8 import java.util.Arrays;
    9 import java.util.Collections;
    108
    119import javax.swing.JPanel;
     
    1513import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1614import org.openstreetmap.josm.data.osm.OsmUtils;
     15import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1716import org.openstreetmap.josm.testutils.JOSMTestRules;
    1817
     
    3837        JPanel p = new JPanel();
    3938        assertEquals(0, p.getComponentCount());
    40         assertTrue(new Combo().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     39        assertTrue(new Combo().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4140        assertTrue(p.getComponentCount() > 0);
    4241    }
     
    5554        OsmPrimitive waySI = OsmUtils.createPrimitive("way addr:country=SI");
    5655
    57         combo.addToPanel(new JPanel(), Collections.singleton(way), false);
     56        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, way));
    5857        assertEquals("", combo.getSelectedValue());
    5958
    6059        combo.default_ = "SI";
    61         combo.addToPanel(new JPanel(), Collections.singleton(way), false);
     60        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, way));
    6261        assertEquals("SI", combo.getSelectedValue());
    63         combo.addToPanel(new JPanel(), Collections.singleton(wayAT), false);
     62        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, wayAT));
    6463        assertEquals("AT", combo.getSelectedValue());
    6564        combo.default_ = null;
     
    6766        KeyedItem.LAST_VALUES.clear();
    6867        KeyedItem.LAST_VALUES.put("addr:country", "AT");
    69         combo.addToPanel(new JPanel(), Collections.singleton(way), false);
     68        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, way));
    7069        assertEquals("AT", combo.getSelectedValue());
    71         combo.addToPanel(new JPanel(), Collections.singleton(wayAT), true);
     70        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true, wayAT));
    7271        assertEquals("AT", combo.getSelectedValue());
    73         combo.addToPanel(new JPanel(), Collections.singleton(way), true);
     72        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true));
    7473        assertEquals("", combo.getSelectedValue());
    7574        combo.use_last_as_default = 2; // "force"
    76         combo.addToPanel(new JPanel(), Collections.singleton(way), true);
     75        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true));
    7776        assertEquals("AT", combo.getSelectedValue());
    7877        KeyedItem.LAST_VALUES.clear();
    7978
    80         combo.addToPanel(new JPanel(), Arrays.asList(wayAT, waySI), true);
     79        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true, wayAT, waySI));
    8180        assertEquals(Combo.DIFFERENT, combo.getSelectedValue());
    8281    }
     
    8988        combo.values_context = "color";
    9089        combo.delimiter = ';';
    91         combo.addToPanel(new JPanel(), Collections.<OsmPrimitive>emptyList(), false);
     90        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false));
    9291        assertEquals(5, combo.combobox.getItemCount());
    9392        combo.presetListEntries.stream().filter(e -> "red".equals(e.value)).findFirst().ifPresent(combo.combobox::setSelectedItem);
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparatorTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertFalse(new ItemSeparator().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertFalse(new ItemSeparator().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertFalse;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
     
    1210import org.junit.jupiter.api.Test;
    1311import org.openstreetmap.josm.JOSMFixture;
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     12import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1513
    1614/**
     
    3432        JPanel p = new JPanel();
    3533        assertEquals(0, p.getComponentCount());
    36         assertFalse(new Key().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     34        assertFalse(new Key().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3735        assertEquals(0, p.getComponentCount());
    3836    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
     
    1210import org.junit.jupiter.api.Test;
    1311import org.openstreetmap.josm.JOSMFixture;
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     12import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1513
    1614/**
     
    3432        JPanel p = new JPanel();
    3533        assertEquals(0, p.getComponentCount());
    36         assertTrue(new Label().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     34        assertTrue(new Label().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3735        assertTrue(p.getComponentCount() > 0);
    3836    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614import org.openstreetmap.josm.spi.preferences.Config;
    1715
     
    3735        JPanel p = new JPanel();
    3836        assertEquals(0, p.getComponentCount());
    39         assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     37        assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4038        assertEquals(0, p.getComponentCount());
    4139
    4240        l.href = Config.getUrls().getJOSMWebsite();
    43         assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     41        assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4442        assertTrue(p.getComponentCount() > 0);
    4543
    4644        l.locale_href = Config.getUrls().getJOSMWebsite();
    47         assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     45        assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4846        assertTrue(p.getComponentCount() > 0);
    4947    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
     
    1210import org.junit.jupiter.api.Test;
    1311import org.openstreetmap.josm.JOSMFixture;
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     12import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1513
    1614/**
     
    3432        JPanel p = new JPanel();
    3533        assertEquals(0, p.getComponentCount());
    36         assertTrue(new MultiSelect().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     34        assertTrue(new MultiSelect().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3735        assertTrue(p.getComponentCount() > 0);
    3836    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertFalse(new Optional().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertFalse(new Optional().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
    1210import org.junit.jupiter.api.extension.RegisterExtension;
    1311import org.junit.jupiter.api.Test;
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     12import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1513import org.openstreetmap.josm.testutils.JOSMTestRules;
    1614
     
    3836        JPanel p = new JPanel();
    3937        assertEquals(0, p.getComponentCount());
    40         assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     38        assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4139        assertTrue(p.getComponentCount() > 0);
    4240    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertFalse(new Roles().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertFalse(new Roles().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertFalse(new Space().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertFalse(new Space().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
    119import org.junit.jupiter.api.extension.RegisterExtension;
    1210import org.junit.jupiter.api.Test;
    13 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     11import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1412import org.openstreetmap.josm.testutils.JOSMTestRules;
    1513
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertTrue(new Text().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertTrue(new Text().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
Note: See TracChangeset for help on using the changeset viewer.