Changeset 9467 in josm
- Timestamp:
- 2016-01-15T18:44:48+01:00 (9 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
r9266 r9467 97 97 */ 98 98 public Set<TaggingPresetType> types; 99 public transientList<TaggingPresetItem> data = new LinkedList<>();99 public final List<TaggingPresetItem> data = new LinkedList<>(); 100 100 public transient Roles roles; 101 101 public transient TemplateEntry nameTemplate; … … 238 238 } 239 239 240 /** 241 * Returns the tags being directly applied (without UI element) by {@link Key} items 242 * 243 * @return a list of tags 244 */ 245 private List<Tag> getDirectlyAppliedTags() { 246 List<Tag> tags = new ArrayList<>(); 247 for (TaggingPresetItem item : data) { 248 if (item instanceof Key) { 249 tags.add(((Key) item).asTag()); 250 } 251 } 252 return tags; 253 } 254 255 /** 256 * Creates a panel for this preset. This includes general information such as name and supported {@link TaggingPresetType types}. 257 * This includes the elements from the individual {@link TaggingPresetItem items}. 258 * 259 * @param selected the selected primitives 260 * @return the newly created panel 261 */ 240 262 public PresetPanel createPanel(Collection<OsmPrimitive> selected) { 241 if (data == null)242 return null;243 263 PresetPanel p = new PresetPanel(); 244 264 List<Link> l = new LinkedList<>(); 245 265 List<PresetLink> presetLink = new LinkedList<>(); 266 267 final JPanel pp = new JPanel(); 246 268 if (types != null) { 247 JPanel pp = new JPanel();248 269 for (TaggingPresetType t : types) { 249 270 JLabel la = new JLabel(ImageProvider.get(t.getIconName())); … … 251 272 pp.add(la); 252 273 } 274 } 275 final List<Tag> directlyAppliedTags = getDirectlyAppliedTags(); 276 if (!directlyAppliedTags.isEmpty()) { 277 final JLabel label = new JLabel(ImageProvider.get("pastetags")); 278 label.setToolTipText("<html>" + tr("This preset also sets: {0}", Utils.joinAsHtmlUnorderedList(directlyAppliedTags))); 279 pp.add(label); 280 } 281 if (pp.getComponentCount() > 0) { 253 282 p.add(pp, GBC.eol()); 254 283 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Key.java
r8863 r9467 26 26 @Override 27 27 public void addCommands(List<Tag> changedTags) { 28 changedTags.add(new Tag(key, value)); 28 changedTags.add(asTag()); 29 } 30 31 /** 32 * Returns the {@link Tag} set by this item 33 * @return the tag 34 */ 35 public Tag asTag() { 36 return new Tag(key, value); 29 37 } 30 38
Note:
See TracChangeset
for help on using the changeset viewer.