Class AutoCompletionItem
- java.lang.Object
-
- org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem
-
- All Implemented Interfaces:
Comparable<AutoCompletionItem>
public class AutoCompletionItem extends Object implements Comparable<AutoCompletionItem>
Represents an entry in the set of auto completion values. An AutoCompletionItem has a priority and a value. The priority helps to sort the auto completion items according to their importance. For instance, in an auto completion set for tag names, standard tag names would be assigned a higher priority than arbitrary tag names present in the current data set. There are three priority levels,AutoCompletionPriority
. The value is a string which will be displayed in the auto completion list.- Since:
- 12859 (copied from
gui.tagging.ac.AutoCompletionListItem
)
-
-
Field Summary
Fields Modifier and Type Field Description private AutoCompletionPriority
priority
the priority of this itemprivate String
value
the value of this item
-
Constructor Summary
Constructors Constructor Description AutoCompletionItem()
Constructs a newAutoCompletionItem
.AutoCompletionItem(String value)
Constructs a newAutoCompletionItem
with the given value and unknown priority.AutoCompletionItem(String value, AutoCompletionPriority priority)
Constructs a newAutoCompletionItem
with the given value and priority.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(AutoCompletionItem other)
boolean
equals(Object obj)
AutoCompletionPriority
getPriority()
Returns the priority.String
getValue()
Returns the value.int
hashCode()
void
setPriority(AutoCompletionPriority priority)
Sets the priority.String
toString()
Here we return the value instead of a representation of the inner object state because bothBasicComboBoxEditor.setItem(Object)
andDefaultListCellRenderer.getListCellRendererComponent(javax.swing.JList<?>, java.lang.Object, int, boolean, boolean)
expect it, thus making derived Editor and CellRenderer classes superfluous.
-
-
-
Field Detail
-
priority
private AutoCompletionPriority priority
the priority of this item
-
-
Constructor Detail
-
AutoCompletionItem
public AutoCompletionItem(String value, AutoCompletionPriority priority)
Constructs a newAutoCompletionItem
with the given value and priority.- Parameters:
value
- The valuepriority
- The priority
-
AutoCompletionItem
public AutoCompletionItem(String value)
Constructs a newAutoCompletionItem
with the given value and unknown priority.- Parameters:
value
- The value
-
AutoCompletionItem
public AutoCompletionItem()
Constructs a newAutoCompletionItem
.
-
-
Method Detail
-
getPriority
public AutoCompletionPriority getPriority()
Returns the priority.- Returns:
- the priority
-
setPriority
public void setPriority(AutoCompletionPriority priority)
Sets the priority.- Parameters:
priority
- the priority
-
toString
public String toString()
Here we return the value instead of a representation of the inner object state because bothBasicComboBoxEditor.setItem(Object)
andDefaultListCellRenderer.getListCellRendererComponent(javax.swing.JList<?>, java.lang.Object, int, boolean, boolean)
expect it, thus making derived Editor and CellRenderer classes superfluous.
-
compareTo
public int compareTo(AutoCompletionItem other)
- Specified by:
compareTo
in interfaceComparable<AutoCompletionItem>
-
-