Changeset 17609 in josm
- Timestamp:
- 2021-03-20T23:07:02+01:00 (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r17606 r17609 329 329 330 330 boolean presetInitiallyMatches = !selected.isEmpty() && selected.stream().allMatch(this); 331 final TaggingPresetItemGuiSupport itemGuiSupport = TaggingPresetItemGuiSupport.create(presetInitiallyMatches, selected); 331 332 JPanel items = new JPanel(new GridBagLayout()); 332 333 TaggingPresetItem previous = null; … … 342 343 } 343 344 } 344 if (i.addToPanel(items, selected, presetInitiallyMatches)) {345 if (i.addToPanel(items, itemGuiSupport)) { 345 346 p.hasElements = true; 346 347 } … … 355 356 // add Link 356 357 for (Link link : l) { 357 link.addToPanel(p, selected, presetInitiallyMatches);358 link.addToPanel(p, itemGuiSupport); 358 359 } 359 360 … … 674 675 return iconFuture; 675 676 } 677 676 678 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java
r16690 r17609 57 57 * 58 58 * @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 62 60 * @return {@code true} if this item adds semantic tagging elements, {@code false} otherwise. 63 61 */ 64 protected abstract boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches);62 protected abstract boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support); 65 63 66 64 /** -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Check.java
r17607 r17609 16 16 import org.openstreetmap.josm.data.osm.OsmUtils; 17 17 import org.openstreetmap.josm.data.osm.Tag; 18 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 18 19 import org.openstreetmap.josm.gui.widgets.QuadStateCheckBox; 19 20 import org.openstreetmap.josm.tools.GBC; … … 38 39 39 40 @Override 40 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {41 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 41 42 42 43 // find out if our key is already used in the selection. 43 final Usage usage = determineBooleanUsage(s el, key);44 final Usage usage = determineBooleanUsage(support.getSelected(), key); 44 45 final String oneValue = usage.values.isEmpty() ? null : usage.values.last(); 45 46 def = "on".equals(default_) ? Boolean.TRUE : "off".equals(default_) ? Boolean.FALSE : null; … … 50 51 if (def != null && !PROP_FILL_DEFAULT.get()) { 51 52 // default is set and filling default values feature is disabled - check if all primitives are untagged 52 for (OsmPrimitive s : s el) {53 for (OsmPrimitive s : support.getSelected()) { 53 54 if (s.hasKeys()) { 54 55 def = null; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroup.java
r16042 r17609 3 3 4 4 import java.awt.GridLayout; 5 import java.util.Collection;6 5 import java.util.LinkedList; 7 6 import java.util.List; … … 10 9 import javax.swing.JPanel; 11 10 12 import org.openstreetmap.josm.data.osm.OsmPrimitive;13 11 import org.openstreetmap.josm.data.osm.Tag; 14 12 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem; 13 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 15 14 import org.openstreetmap.josm.tools.GBC; 16 15 … … 32 31 33 32 @Override 34 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {33 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 35 34 int rows = (int) Math.ceil(checks.size() / ((double) columns)); 36 35 JPanel panel = new JPanel(new GridLayout(rows, columns)); 37 36 38 37 for (Check check : checks) { 39 check.addToPanel(panel, s el, presetInitiallyMatches);38 check.addToPanel(panel, support); 40 39 } 41 40 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r17605 r17609 28 28 import javax.swing.ListCellRenderer; 29 29 30 import org.openstreetmap.josm.data.osm.OsmPrimitive;31 30 import org.openstreetmap.josm.data.osm.Tag; 31 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 32 32 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector; 33 33 import org.openstreetmap.josm.spi.preferences.Config; … … 206 206 207 207 @Override 208 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {208 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 209 209 initListEntries(true); 210 210 211 211 // find out if our key is already used in the selection. 212 usage = determineTextUsage(s el, key);212 usage = determineTextUsage(support.getSelected(), key); 213 213 if (!usage.hasUniqueValue() && !usage.unused()) { 214 214 presetListEntries.add(new PresetListEntry(DIFFERENT)); … … 220 220 label.setComponentPopupMenu(getPopupMenu()); 221 221 p.add(label, GBC.std().insets(0, 0, 10, 0)); 222 addToPanelAnchor(p, default_, presetInitiallyMatches);222 addToPanelAnchor(p, default_, support.isPresetInitiallyMatches()); 223 223 label.setLabelFor(component); 224 224 component.setToolTipText(getKeyTooltipText()); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparator.java
r9665 r17609 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 3 3 4 import java.util.Collection;5 4 import java.util.List; 6 5 … … 8 7 import javax.swing.JSeparator; 9 8 10 import org.openstreetmap.josm.data.osm.OsmPrimitive;11 9 import org.openstreetmap.josm.data.osm.Tag; 12 10 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem; 11 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 13 12 import org.openstreetmap.josm.tools.GBC; 14 13 … … 20 19 21 20 @Override 22 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {21 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 23 22 p.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(0, 5, 0, 5)); 24 23 return false; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Key.java
r9665 r17609 8 8 import javax.swing.JPanel; 9 9 10 import org.openstreetmap.josm.data.osm.OsmPrimitive;11 10 import org.openstreetmap.josm.data.osm.Tag; 11 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 12 12 13 13 /** … … 20 20 21 21 @Override 22 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {22 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 23 23 return false; 24 24 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Label.java
r17605 r17609 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 3 4 import java.util.Collection;5 3 6 4 import javax.swing.JLabel; 7 5 import javax.swing.JPanel; 8 6 9 import org.openstreetmap.josm. data.osm.OsmPrimitive;7 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 10 8 import org.openstreetmap.josm.tools.GBC; 11 9 … … 16 14 17 15 @Override 18 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {16 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 19 17 initializeLocaleText(null); 20 18 JLabel label = new JLabel(locale_text); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Link.java
r17605 r17609 6 6 import java.awt.event.MouseEvent; 7 7 import java.util.Arrays; 8 import java.util.Collection;9 8 import java.util.Optional; 10 9 … … 12 11 import javax.swing.SwingUtilities; 13 12 14 import org.openstreetmap.josm.data.osm.OsmPrimitive;15 13 import org.openstreetmap.josm.gui.dialogs.properties.HelpAction; 14 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 16 15 import org.openstreetmap.josm.gui.widgets.UrlLabel; 17 16 import org.openstreetmap.josm.spi.preferences.Config; … … 35 34 36 35 @Override 37 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {36 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 38 37 initializeLocaleText(tr("More information about this feature")); 39 38 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 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util.Collection;7 8 6 import javax.swing.JLabel; 9 7 import javax.swing.JPanel; 10 8 11 import org.openstreetmap.josm. data.osm.OsmPrimitive;9 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 12 10 import org.openstreetmap.josm.tools.GBC; 13 11 … … 20 18 // TODO: Draw a box around optional stuff 21 19 @Override 22 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {20 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 23 21 initializeLocaleText(tr("Optional Attributes:")); 24 22 p.add(new JLabel(" "), GBC.eol()); // space -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetLink.java
r16699 r17609 16 16 import org.openstreetmap.josm.data.osm.Tag; 17 17 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 18 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 18 19 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetLabel; 19 20 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; … … 54 55 55 56 @Override 56 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {57 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 57 58 final String presetName = preset_name; 58 59 Optional<TaggingPreset> found = TaggingPresets.getTaggingPresets().stream().filter(preset -> presetName.equals(preset.name)).findFirst(); … … 60 61 TaggingPreset t = found.get(); 61 62 JLabel lbl = new TaggingPresetLabel(t); 62 lbl.addMouseListener(new TaggingPresetMouseAdapter(t, s el));63 lbl.addMouseListener(new TaggingPresetMouseAdapter(t, support.getSelected())); 63 64 p.add(lbl, GBC.eol().fill(GBC.HORIZONTAL)); 64 65 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Roles.java
r17333 r17609 6 6 import java.awt.GridBagLayout; 7 7 import java.util.ArrayList; 8 import java.util.Collection;9 8 import java.util.List; 10 9 import java.util.Set; … … 13 12 import javax.swing.JPanel; 14 13 15 import org.openstreetmap.josm.data.osm.OsmPrimitive;16 14 import org.openstreetmap.josm.data.osm.Tag; 17 15 import org.openstreetmap.josm.data.osm.search.SearchCompiler; … … 19 17 import org.openstreetmap.josm.data.osm.search.SearchSetting; 20 18 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem; 19 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 21 20 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetType; 22 21 import org.openstreetmap.josm.tools.GBC; … … 191 190 192 191 @Override 193 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {192 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 194 193 p.add(new JLabel(" "), GBC.eol()); // space 195 194 if (!roles.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Space.java
r9665 r17609 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 3 3 4 import java.util.Collection;5 4 import java.util.List; 6 5 … … 8 7 import javax.swing.JPanel; 9 8 10 import org.openstreetmap.josm.data.osm.OsmPrimitive;11 9 import org.openstreetmap.josm.data.osm.Tag; 12 10 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem; 11 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 13 12 import org.openstreetmap.josm.tools.GBC; 14 13 … … 19 18 20 19 @Override 21 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {20 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 22 21 p.add(new JLabel(" "), GBC.eol()); // space 23 22 return false; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
r17605 r17609 22 22 import javax.swing.JToggleButton; 23 23 24 import org.openstreetmap.josm.data.osm.OsmPrimitive;25 24 import org.openstreetmap.josm.data.osm.Tag; 26 25 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 27 26 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 27 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 28 28 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 29 29 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 61 61 62 62 @Override 63 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {63 public boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support) { 64 64 65 65 // find out if our key is already used in the selection. 66 Usage usage = determineTextUsage(s el, key);66 Usage usage = determineTextUsage(support.getSelected(), key); 67 67 AutoCompletingTextField textField = new AutoCompletingTextField(); 68 68 if (alternative_autocomplete_keys != null) { … … 88 88 } else if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) { 89 89 // 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)) { 91 91 textField.setText(LAST_VALUES.get(key)); 92 92 } else { -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java
r17275 r17609 6 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import java.util.Collections;9 10 8 import javax.swing.JPanel; 11 9 … … 13 11 import org.junit.jupiter.api.Test; 14 12 import org.openstreetmap.josm.JOSMFixture; 15 import org.openstreetmap.josm. data.osm.OsmPrimitive;13 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 16 14 17 15 /** … … 36 34 JPanel p = new JPanel(); 37 35 assertEquals(0, p.getComponentCount()); 38 assertFalse(cg.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));36 assertFalse(cg.addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 39 37 assertTrue(p.getComponentCount() > 0); 40 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java
r17275 r17609 5 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import java.util.Collections;8 9 7 import javax.swing.JPanel; 10 8 11 9 import org.junit.jupiter.api.extension.RegisterExtension; 12 10 import org.junit.jupiter.api.Test; 13 import org.openstreetmap.josm. data.osm.OsmPrimitive;11 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 14 12 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 13 … … 35 33 JPanel p = new JPanel(); 36 34 assertEquals(0, p.getComponentCount()); 37 assertTrue(new Check().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));35 assertTrue(new Check().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 38 36 assertTrue(p.getComponentCount() > 0); 39 37 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java
r17275 r17609 6 6 7 7 import java.awt.Color; 8 import java.util.Arrays;9 import java.util.Collections;10 8 11 9 import javax.swing.JPanel; … … 15 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 14 import org.openstreetmap.josm.data.osm.OsmUtils; 15 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 17 16 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 17 … … 38 37 JPanel p = new JPanel(); 39 38 assertEquals(0, p.getComponentCount()); 40 assertTrue(new Combo().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));39 assertTrue(new Combo().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 41 40 assertTrue(p.getComponentCount() > 0); 42 41 } … … 55 54 OsmPrimitive waySI = OsmUtils.createPrimitive("way addr:country=SI"); 56 55 57 combo.addToPanel(new JPanel(), Collections.singleton(way), false);56 combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, way)); 58 57 assertEquals("", combo.getSelectedValue()); 59 58 60 59 combo.default_ = "SI"; 61 combo.addToPanel(new JPanel(), Collections.singleton(way), false);60 combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, way)); 62 61 assertEquals("SI", combo.getSelectedValue()); 63 combo.addToPanel(new JPanel(), Collections.singleton(wayAT), false);62 combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, wayAT)); 64 63 assertEquals("AT", combo.getSelectedValue()); 65 64 combo.default_ = null; … … 67 66 KeyedItem.LAST_VALUES.clear(); 68 67 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)); 70 69 assertEquals("AT", combo.getSelectedValue()); 71 combo.addToPanel(new JPanel(), Collections.singleton(wayAT), true);70 combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true, wayAT)); 72 71 assertEquals("AT", combo.getSelectedValue()); 73 combo.addToPanel(new JPanel(), Collections.singleton(way), true);72 combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true)); 74 73 assertEquals("", combo.getSelectedValue()); 75 74 combo.use_last_as_default = 2; // "force" 76 combo.addToPanel(new JPanel(), Collections.singleton(way), true);75 combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true)); 77 76 assertEquals("AT", combo.getSelectedValue()); 78 77 KeyedItem.LAST_VALUES.clear(); 79 78 80 combo.addToPanel(new JPanel(), Arrays.asList(wayAT, waySI), true);79 combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true, wayAT, waySI)); 81 80 assertEquals(Combo.DIFFERENT, combo.getSelectedValue()); 82 81 } … … 89 88 combo.values_context = "color"; 90 89 combo.delimiter = ';'; 91 combo.addToPanel(new JPanel(), Collections.<OsmPrimitive>emptyList(), false);90 combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false)); 92 91 assertEquals(5, combo.combobox.getItemCount()); 93 92 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 6 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import java.util.Collections;9 10 8 import javax.swing.JPanel; 11 9 … … 13 11 import org.junit.jupiter.api.Test; 14 12 import org.openstreetmap.josm.JOSMFixture; 15 import org.openstreetmap.josm. data.osm.OsmPrimitive;13 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 16 14 17 15 /** … … 35 33 JPanel p = new JPanel(); 36 34 assertEquals(0, p.getComponentCount()); 37 assertFalse(new ItemSeparator().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));35 assertFalse(new ItemSeparator().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 38 36 assertTrue(p.getComponentCount() > 0); 39 37 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java
r17275 r17609 5 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 6 7 import java.util.Collections;8 9 7 import javax.swing.JPanel; 10 8 … … 12 10 import org.junit.jupiter.api.Test; 13 11 import org.openstreetmap.josm.JOSMFixture; 14 import org.openstreetmap.josm. data.osm.OsmPrimitive;12 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 15 13 16 14 /** … … 34 32 JPanel p = new JPanel(); 35 33 assertEquals(0, p.getComponentCount()); 36 assertFalse(new Key().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));34 assertFalse(new Key().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 37 35 assertEquals(0, p.getComponentCount()); 38 36 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java
r17275 r17609 5 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import java.util.Collections;8 9 7 import javax.swing.JPanel; 10 8 … … 12 10 import org.junit.jupiter.api.Test; 13 11 import org.openstreetmap.josm.JOSMFixture; 14 import org.openstreetmap.josm. data.osm.OsmPrimitive;12 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 15 13 16 14 /** … … 34 32 JPanel p = new JPanel(); 35 33 assertEquals(0, p.getComponentCount()); 36 assertTrue(new Label().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));34 assertTrue(new Label().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 37 35 assertTrue(p.getComponentCount() > 0); 38 36 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java
r17275 r17609 6 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import java.util.Collections;9 10 8 import javax.swing.JPanel; 11 9 … … 13 11 import org.junit.jupiter.api.Test; 14 12 import org.openstreetmap.josm.JOSMFixture; 15 import org.openstreetmap.josm. data.osm.OsmPrimitive;13 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 16 14 import org.openstreetmap.josm.spi.preferences.Config; 17 15 … … 37 35 JPanel p = new JPanel(); 38 36 assertEquals(0, p.getComponentCount()); 39 assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));37 assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 40 38 assertEquals(0, p.getComponentCount()); 41 39 42 40 l.href = Config.getUrls().getJOSMWebsite(); 43 assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));41 assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 44 42 assertTrue(p.getComponentCount() > 0); 45 43 46 44 l.locale_href = Config.getUrls().getJOSMWebsite(); 47 assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));45 assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 48 46 assertTrue(p.getComponentCount() > 0); 49 47 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java
r17275 r17609 5 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import java.util.Collections;8 9 7 import javax.swing.JPanel; 10 8 … … 12 10 import org.junit.jupiter.api.Test; 13 11 import org.openstreetmap.josm.JOSMFixture; 14 import org.openstreetmap.josm. data.osm.OsmPrimitive;12 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 15 13 16 14 /** … … 34 32 JPanel p = new JPanel(); 35 33 assertEquals(0, p.getComponentCount()); 36 assertTrue(new MultiSelect().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));34 assertTrue(new MultiSelect().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 37 35 assertTrue(p.getComponentCount() > 0); 38 36 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java
r17275 r17609 6 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import java.util.Collections;9 10 8 import javax.swing.JPanel; 11 9 … … 13 11 import org.junit.jupiter.api.Test; 14 12 import org.openstreetmap.josm.JOSMFixture; 15 import org.openstreetmap.josm. data.osm.OsmPrimitive;13 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 16 14 17 15 /** … … 35 33 JPanel p = new JPanel(); 36 34 assertEquals(0, p.getComponentCount()); 37 assertFalse(new Optional().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));35 assertFalse(new Optional().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 38 36 assertTrue(p.getComponentCount() > 0); 39 37 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java
r17275 r17609 6 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import java.util.Collections;9 10 8 import javax.swing.JPanel; 11 9 12 10 import org.junit.jupiter.api.extension.RegisterExtension; 13 11 import org.junit.jupiter.api.Test; 14 import org.openstreetmap.josm. data.osm.OsmPrimitive;12 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 15 13 import org.openstreetmap.josm.testutils.JOSMTestRules; 16 14 … … 38 36 JPanel p = new JPanel(); 39 37 assertEquals(0, p.getComponentCount()); 40 assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));38 assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 41 39 assertTrue(p.getComponentCount() > 0); 42 40 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java
r17275 r17609 6 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import java.util.Collections;9 10 8 import javax.swing.JPanel; 11 9 … … 13 11 import org.junit.jupiter.api.Test; 14 12 import org.openstreetmap.josm.JOSMFixture; 15 import org.openstreetmap.josm. data.osm.OsmPrimitive;13 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 16 14 17 15 /** … … 35 33 JPanel p = new JPanel(); 36 34 assertEquals(0, p.getComponentCount()); 37 assertFalse(new Roles().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));35 assertFalse(new Roles().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 38 36 assertTrue(p.getComponentCount() > 0); 39 37 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java
r17275 r17609 6 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import java.util.Collections;9 10 8 import javax.swing.JPanel; 11 9 … … 13 11 import org.junit.jupiter.api.Test; 14 12 import org.openstreetmap.josm.JOSMFixture; 15 import org.openstreetmap.josm. data.osm.OsmPrimitive;13 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 16 14 17 15 /** … … 35 33 JPanel p = new JPanel(); 36 34 assertEquals(0, p.getComponentCount()); 37 assertFalse(new Space().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));35 assertFalse(new Space().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 38 36 assertTrue(p.getComponentCount() > 0); 39 37 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java
r17275 r17609 5 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import java.util.Collections;8 9 7 import javax.swing.JPanel; 10 8 11 9 import org.junit.jupiter.api.extension.RegisterExtension; 12 10 import org.junit.jupiter.api.Test; 13 import org.openstreetmap.josm. data.osm.OsmPrimitive;11 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 14 12 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 13 … … 35 33 JPanel p = new JPanel(); 36 34 assertEquals(0, p.getComponentCount()); 37 assertTrue(new Text().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));35 assertTrue(new Text().addToPanel(p, TaggingPresetItemGuiSupport.create(false))); 38 36 assertTrue(p.getComponentCount() > 0); 39 37 }
Note:
See TracChangeset
for help on using the changeset viewer.