Changeset 9514 in josm for trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
- Timestamp:
- 2016-01-17T22:38:38+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
r9246 r9514 3 3 4 4 import java.awt.BorderLayout; 5 import java.util. HashMap;5 import java.util.Collections; 6 6 import java.util.Map; 7 7 import java.util.Observable; … … 13 13 14 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.data.Version;16 15 import org.openstreetmap.josm.data.osm.Changeset; 16 import org.openstreetmap.josm.data.osm.DataSet; 17 17 import org.openstreetmap.josm.gui.tagging.TagEditorPanel; 18 18 import org.openstreetmap.josm.gui.tagging.TagModel; … … 26 26 private final transient ChangesetCommentModel changesetCommentModel; 27 27 private final transient ChangesetCommentModel changesetSourceModel; 28 /** tags that applied to uploaded changesets by default*/29 private final transient Map<String, String> defaultTags = new HashMap<>();30 28 31 29 protected void build() { … … 81 79 82 80 /** 83 * Initialize panel from changeset.84 * @param cs changeset81 * Initialize panel from the given tags. 82 * @param tags the tags used to initialize the panel 85 83 */ 86 public void initFromChangeset(Changeset cs) { 87 Map<String, String> tags = getDefaultTags(); 88 if (cs != null) { 89 tags.putAll(cs.getKeys()); 90 } 91 if (tags.get("comment") == null) { 92 tags.put("comment", getTagEditorValue("comment")); 93 } 94 if (tags.get("source") == null) { 95 tags.put("source", getTagEditorValue("source")); 96 } 97 String agent = Version.getInstance().getAgentString(false); 98 String created_by = tags.get("created_by"); 99 if (created_by == null || created_by.isEmpty()) { 100 tags.put("created_by", agent); 101 } else if (!created_by.contains(agent)) { 102 tags.put("created_by", created_by + ';' + agent); 103 } 84 public void initFromTags(Map<String, String> tags) { 104 85 pnlTagEditor.getModel().initFromTags(tags); 105 86 } … … 115 96 116 97 /** 117 * Replies the map with the default tags.118 * @ return the map with the default tags98 * @return an empty map 99 * @deprecated No longer supported, returns an empty map 119 100 */ 101 @Deprecated 120 102 public Map<String, String> getDefaultTags() { 121 Map<String, String> tags = new HashMap<>(); 122 tags.putAll(defaultTags); 123 return tags; 103 return Collections.emptyMap(); 124 104 } 125 105 126 106 /** 127 * Sets the map with the default tags.128 * @ param tags the map with the default tags107 * @param tags ignored 108 * @deprecated No longer supported, does nothing; use {@link UploadDialog#setChangesetTags(DataSet)} instead! 129 109 */ 110 @Deprecated 130 111 public void setDefaultTags(Map<String, String> tags) { 131 defaultTags.clear();132 defaultTags.putAll(tags);133 tableChanged(null);134 112 } 135 113
Note:
See TracChangeset
for help on using the changeset viewer.