source: josm/trunk/src/org/openstreetmap/josm/gui/datatransfer/data/TagTransferData.java@ 10604

Last change on this file since 10604 was 10604, checked in by Don-vip, 8 years ago

fix #12478, fix #12565, fix #11114 - Use ​Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer (patch by michael2402, modified) - gsoc-core

File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.datatransfer.data;
3
4import java.awt.datatransfer.DataFlavor;
5import java.io.Serializable;
6import java.util.Collection;
7import java.util.Collections;
8import java.util.Map;
9
10import org.openstreetmap.josm.data.osm.TagMap;
11import org.openstreetmap.josm.data.osm.Tagged;
12
13/**
14 * This is a special transfer type that only transfers tag data.
15 * <p>
16 * It currently contains all tags contained in the selection that was copied.
17 * @author Michael Zangl
18 * @since 10604
19 */
20public class TagTransferData implements Serializable {
21
22 private static final long serialVersionUID = 1;
23
24 /**
25 * This is a data flavor added
26 */
27 public static final DataFlavor FLAVOR = new DataFlavor(TagTransferData.class, "OSM Tags");
28
29 private final TagMap tags = new TagMap();
30
31 /**
32 * Creates a new {@link TagTransferData} object for the given objects.
33 * @param tagged The tags to transfer.
34 */
35 public TagTransferData(Collection<? extends Tagged> tagged) {
36 for (Tagged t : tagged) {
37 tags.putAll(t.getKeys());
38 }
39 }
40
41 /**
42 * Gets all tags contained in this data.
43 * @return The tags.
44 */
45 public Map<String, String> getTags() {
46 return Collections.unmodifiableMap(tags);
47 }
48}
Note: See TracBrowser for help on using the repository browser.