source: josm/trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItem.java@ 6070

Last change on this file since 6070 was 6070, checked in by stoecker, 11 years ago

see #8853 remove tabs, trailing spaces, windows line ends, strange characters

File size: 1.6 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.gui.tagging;
3
4import java.util.Collection;
5import java.util.List;
6import java.util.Map;
7import javax.swing.JPanel;
8import org.openstreetmap.josm.Main;
9import org.openstreetmap.josm.data.osm.OsmPrimitive;
10import org.openstreetmap.josm.data.osm.Tag;
11import org.openstreetmap.josm.gui.layer.OsmDataLayer;
12import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
13import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList;
14
15/**
16 * This calss reperesentse single part of a preset - one field or text label that
17 * is shown to user
18 */
19public abstract class TaggingPresetItem {
20
21 protected void initAutoCompletionField(AutoCompletingTextField field, String key) {
22 OsmDataLayer layer = Main.main.getEditLayer();
23 if (layer == null) {
24 return;
25 }
26 AutoCompletionList list = new AutoCompletionList();
27 Main.main.getEditLayer().data.getAutoCompletionManager().populateWithTagValues(list, key);
28 field.setAutoCompletionList(list);
29 }
30
31 abstract boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel);
32
33 abstract void addCommands(List<Tag> changedTags);
34
35 boolean requestFocusInWindow() {
36 return false;
37 }
38
39 /**
40 * Tests whether the tags match this item.
41 * Note that for a match, at least one positive and no negative is required.
42 * @param tags the tags of an {@link OsmPrimitive}
43 * @return {@code true} if matches (positive), {@code null} if neutral, {@code false} if mismatches (negative).
44 */
45 Boolean matches(Map<String, String> tags) {
46 return null;
47 }
48
49}
Note: See TracBrowser for help on using the repository browser.