Class PresetListEntry
- java.lang.Object
-
- org.openstreetmap.josm.gui.tagging.presets.items.PresetListEntry
-
- All Implemented Interfaces:
Comparable<PresetListEntry>
public class PresetListEntry extends Object implements Comparable<PresetListEntry>
Preset list entry.Used for controls that offer a list of items to choose from like
Combo
andMultiSelect
.
-
-
Field Summary
Fields Modifier and Type Field Description private String
cachedDisplayValue
private ImageIcon
cachedIcon
private String
cachedShortDescription
ComboMultiSelect
cms
The ComboMultiSelect that displays the listString
display_value
Text displayed to the user instead ofvalue
.protected static PresetListEntry
ENTRY_DIFFERENT
Used to display an entry matching several different values.protected static PresetListEntry
ENTRY_EMPTY
Used to display an empty entry used to clear values.String
icon
The location of icon file to displayshort
icon_size
The size of displayed icon.String
locale_display_value
The localized version ofdisplay_value
.String
locale_short_description
The localized version ofshort_description
.String
short_description
Text to be displayed belowdisplay_value
in the combobox list.String
value
This is the value that is going to be written to the tag on the selected primitive(s).
-
Constructor Summary
Constructors Constructor Description PresetListEntry()
Constructs a newPresetListEntry
, uninitialized.PresetListEntry(String value, ComboMultiSelect cms)
Constructs a newPresetListEntry
, initialized with a value andComboMultiSelect
context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PresetListEntry o)
boolean
equals(Object o)
int
getCount()
Returns how many selected primitives had this value set.String
getDisplayValue()
Returns the contents displayed in the current item view.ImageIcon
getIcon()
Returns the entry icon, if any.String
getListDisplay(int width)
Returns the contents displayed in the dropdown list.String
getShortDescription()
Returns the short description to display.String
getToolTipText(String key)
Returns the tooltip for this entry.int
hashCode()
String
toString()
-
-
-
Field Detail
-
ENTRY_DIFFERENT
protected static final PresetListEntry ENTRY_DIFFERENT
Used to display an entry matching several different values.
-
ENTRY_EMPTY
protected static final PresetListEntry ENTRY_EMPTY
Used to display an empty entry used to clear values.
-
value
public String value
This is the value that is going to be written to the tag on the selected primitive(s). Except when the value is"<different>"
, which is never written, or the value is empty, which deletes the tag.value
is never translated.
-
cms
public ComboMultiSelect cms
The ComboMultiSelect that displays the list
-
display_value
public String display_value
Text displayed to the user instead ofvalue
.
-
short_description
public String short_description
Text to be displayed belowdisplay_value
in the combobox list.
-
icon_size
public short icon_size
The size of displayed icon. If not set, default is size from icon file
-
locale_display_value
public String locale_display_value
The localized version ofdisplay_value
.
-
locale_short_description
public String locale_short_description
The localized version ofshort_description
.
-
cachedDisplayValue
private String cachedDisplayValue
-
cachedShortDescription
private String cachedShortDescription
-
cachedIcon
private ImageIcon cachedIcon
-
-
Constructor Detail
-
PresetListEntry
public PresetListEntry()
Constructs a newPresetListEntry
, uninitialized. Public default constructor is needed byXmlObjectParser.Parser.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
-
PresetListEntry
public PresetListEntry(String value, ComboMultiSelect cms)
Constructs a newPresetListEntry
, initialized with a value andComboMultiSelect
context.- Parameters:
value
- valuecms
- the ComboMultiSelect
-
-
Method Detail
-
getListDisplay
public String getListDisplay(int width)
Returns the contents displayed in the dropdown list. This is the contents that would be displayed in the current view plus a short description to aid the user. The whole contents is wrapped towidth
.- Parameters:
width
- the width in px- Returns:
- HTML formatted contents
-
getDisplayValue
public String getDisplayValue()
Returns the contents displayed in the current item view.- Returns:
- the value to display
-
getShortDescription
public String getShortDescription()
Returns the short description to display.- Returns:
- the short description to display
-
getToolTipText
public String getToolTipText(String key)
Returns the tooltip for this entry.- Parameters:
key
- the tag key- Returns:
- the tooltip
-
getCount
public int getCount()
Returns how many selected primitives had this value set.- Returns:
- see above
-
compareTo
public int compareTo(PresetListEntry o)
- Specified by:
compareTo
in interfaceComparable<PresetListEntry>
-
-