Changeset 16280 in josm for trunk/src/org
- Timestamp:
- 2020-04-12T22:31:32+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/tagging/presets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r16060 r16280 20 20 import java.util.List; 21 21 import java.util.Map; 22 import java.util.Objects; 22 23 import java.util.Set; 23 24 import java.util.concurrent.CompletableFuture; … … 307 308 PresetPanel p = new PresetPanel(); 308 309 List<Link> l = new LinkedList<>(); 309 List<PresetLink> presetLink = new LinkedList<>();310 310 311 311 final JPanel pp = new JPanel(); … … 336 336 boolean presetInitiallyMatches = !selected.isEmpty() && selected.stream().allMatch(this); 337 337 JPanel items = new JPanel(new GridBagLayout()); 338 TaggingPresetItem previous = null; 338 339 for (TaggingPresetItem i : data) { 339 340 if (i instanceof Link) { 340 341 l.add((Link) i); 341 342 p.hasElements = true; 342 } else if (i instanceof PresetLink) {343 presetLink.add((PresetLink) i);344 343 } else { 344 if (i instanceof PresetLink) { 345 PresetLink link = (PresetLink) i; 346 if (!(previous instanceof PresetLink && Objects.equals(((PresetLink) previous).text, link.text))) { 347 items.add(link.createLabel(), GBC.eol().insets(0, 8, 0, 0)); 348 } 349 } 345 350 if (i.addToPanel(items, selected, presetInitiallyMatches)) { 346 351 p.hasElements = true; 347 352 } 348 353 } 354 previous = i; 349 355 } 350 356 p.add(items, GBC.eol().fill()); 351 357 if (selected.isEmpty() && !supportsRelation()) { 352 358 GuiHelper.setEnabledRec(items, false); 353 }354 355 // add PresetLink356 if (!presetLink.isEmpty()) {357 p.add(new JLabel(tr("Edit also …")), GBC.eol().insets(0, 8, 0, 0));358 for (PresetLink link : presetLink) {359 link.addToPanel(p, selected, presetInitiallyMatches);360 }361 359 } 362 360 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetLink.java
r13332 r16280 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import java.awt.event.MouseAdapter; … … 14 16 import org.openstreetmap.josm.data.osm.Tag; 15 17 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 16 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem;17 18 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetLabel; 18 19 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; … … 23 24 * @since 8863 24 25 */ 25 public class PresetLink extends T aggingPresetItem {26 public class PresetLink extends TextItem { 26 27 27 28 static final class TaggingPresetMouseAdapter extends MouseAdapter { … … 40 41 /** The exact name of the preset to link to. Required. */ 41 42 public String preset_name = ""; // NOSONAR 43 44 /** 45 * Creates a label to be inserted aboive this link 46 * @return a label 47 */ 48 public JLabel createLabel() { 49 initializeLocaleText(tr("Edit also …")); 50 return new JLabel(locale_text); 51 } 42 52 43 53 @Override
Note:
See TracChangeset
for help on using the changeset viewer.