Package docking.widgets.dialogs
Class StringChoices
- java.lang.Object
-
- docking.widgets.dialogs.StringChoices
-
public class StringChoices extends java.lang.ObjectStringEnum 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 booleancontains(java.lang.String value)Returns true if the given value is contained in this StringEnumbooleanequals(java.lang.Object obj)java.lang.StringgetSelectedValue()Returns the currently selected value.intgetSelectedValueIndex()Returns the index of the currently selected value;java.lang.String[]getValues()Returns a list of all allowed string values.inthashCode()intindexOf(java.lang.String value)Returns the index of the given value in this StringEnum; -1 if the value is not contained herein.voidsetSelectedValue(int index)Sets the current value to the object at the given position as if indexed into the array returned by getValues().voidsetSelectedValue(java.lang.String value)Sets the currentValue to the given value.java.lang.StringtoString()
-
-
-
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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
-