Package docking.widgets.dialogs
Class StringChoices
- java.lang.Object
-
- docking.widgets.dialogs.StringChoices
-
public class StringChoices extends java.lang.Object
StringEnum objects represent a choice from a limited set of options.
-
-
Constructor Summary
Constructors Constructor Description StringChoices(StringChoices strEnum)
Construct from another StringEnum instance.StringChoices(java.lang.String[] values)
Construct from an array of Strings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.lang.String value)
Returns true if the given value is contained in this StringEnumboolean
equals(java.lang.Object obj)
java.lang.String
getSelectedValue()
Returns the currently selected value.int
getSelectedValueIndex()
Returns the index of the currently selected value;java.lang.String[]
getValues()
Returns a list of all allowed string values.int
hashCode()
int
indexOf(java.lang.String value)
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(java.lang.String value)
Sets the currentValue to the given value.java.lang.String
toString()
-
-
-
Constructor Detail
-
StringChoices
public StringChoices(java.lang.String[] values)
Construct from an array of Strings. The order of Strings is preserved.
-
StringChoices
public StringChoices(StringChoices strEnum)
Construct from another StringEnum instance.
-
-
Method Detail
-
getValues
public java.lang.String[] getValues()
Returns a list of all allowed string values.
-
getSelectedValue
public java.lang.String getSelectedValue()
Returns the currently selected value.
-
getSelectedValueIndex
public int getSelectedValueIndex()
Returns the index of the currently selected value;
-
contains
public boolean contains(java.lang.String value)
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
public int indexOf(java.lang.String value)
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
public void setSelectedValue(java.lang.String value)
Sets the currentValue to the given value.- Throws:
java.lang.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()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-