Package docking.widgets.dialogs
Class StringChoices
java.lang.Object
docking.widgets.dialogs.StringChoices
StringEnum objects represent a choice from a limited set of options.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionStringChoices
(StringChoices strEnum) Construct from another StringEnum instance.StringChoices
(String[] values) Construct from an array of Strings. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the given value is contained in this StringEnumboolean
Returns the currently selected value.int
Returns the index of the currently selected value;String[]
Returns a list of all allowed string values.int
hashCode()
int
Returns the index of the given value in this StringEnum; -1 if the value is not contained herein.void
setSelectedValue
(int index) Sets the current value to the object at the given position as if indexed into the array returned by getValues().void
setSelectedValue
(String value) Sets the currentValue to the given value.toString()
-
Field Details
-
values
-
selected
protected int selected
-
-
Constructor Details
-
StringChoices
Construct from an array of Strings. The order of Strings is preserved. -
StringChoices
Construct from another StringEnum instance.
-
-
Method Details
-
getValues
Returns a list of all allowed string values. -
getSelectedValue
Returns the currently selected value. -
getSelectedValueIndex
public int getSelectedValueIndex()Returns the index of the currently selected value; -
contains
Returns true if the given value is contained in this StringEnum- Parameters:
value
- The value for which to search- Returns:
- true if the given value is contained in this StringEnum
-
indexOf
Returns the index of the given value in this StringEnum; -1 if the value is not contained herein.- Parameters:
value
- The value for which to search- Returns:
- the index of the given value in this StringEnum; -1 if the value is not contained herein.
-
setSelectedValue
Sets the currentValue to the given value.- Throws:
IllegalArgumentException
- thrown if the given value is not one of the set of allowed values.
-
setSelectedValue
public void setSelectedValue(int index) Sets the current value to the object at the given position as if indexed into the array returned by getValues(). -
hashCode
public int hashCode() -
equals
-
toString
-