source: josm/trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/TextItem.java@ 12042

Last change on this file since 12042 was 9665, checked in by stoecker, 8 years ago

fix eol-style issues and similar formating stuff, see #12410

File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.tagging.presets.items;
3
4import java.util.List;
5
6import org.openstreetmap.josm.data.osm.Tag;
7import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem;
8
9/**
10 * A tagging preset item displaying a localizable text.
11 * @since 6190
12 */
13public abstract class TextItem extends TaggingPresetItem {
14
15 /** The text to display */
16 public String text; // NOSONAR
17
18 /** The context used for translating {@link #text} */
19 public String text_context; // NOSONAR
20
21 /** The localized version of {@link #text} */
22 public String locale_text; // NOSONAR
23
24 protected final void initializeLocaleText(String defaultText) {
25 if (locale_text == null) {
26 locale_text = getLocaleText(text, text_context, defaultText);
27 }
28 }
29
30 @Override
31 public void addCommands(List<Tag> changedTags) {
32 // Do nothing
33 }
34
35 protected String fieldsToString() {
36 return (text != null ? "text=" + text + ", " : "")
37 + (text_context != null ? "text_context=" + text_context + ", " : "")
38 + (locale_text != null ? "locale_text=" + locale_text : "");
39 }
40
41 @Override
42 public String toString() {
43 return getClass().getSimpleName() + " [" + fieldsToString() + ']';
44 }
45}
Note: See TracBrowser for help on using the repository browser.