public class TextOption extends AbstractOption
| Constructor and Description |
|---|
TextOption(String id,
String label,
String defaultValue,
OptionMaster.OptionPlatform optionPlatform,
OptionMaster.Visibility optionVisibility)
Create a startup option that allows the user to supply arbitrary text.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fromPrefsFormat(String text)
Initializes the current option using a relevant variable from the
startup script.
|
JTextField |
getComponent()
Builds a
JTextField containing the text value specified in the
constructor. |
String |
getValue()
Returns the user's input (or the default value).
|
static String |
removeOutermostQuotes(String value)
If the given
String begins and ends with
OptionMaster.QUOTE_STRING, this method will return the given
String without the "outermost" quote pair. |
void |
setValue(String newValue)
Stores the user's input.
|
String |
toString()
String representation of this TextOption. |
getLabel, getOptionId, getOptionPlatform, getOptionType, getOptionVisibility, isValidPrefFormat, onValidPlatform, toPrefsFormatpublic TextOption(String id, String label, String defaultValue, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility)
NOTE: null is not a permitted value for any of this
constructor's parameters.
id - Identifier for this startup option.label - Brief description suitable for a GUI label.defaultValue - Default value for this startup option.optionPlatform - Platforms where this option may be applied.optionVisibility - Whether or not the option is presented via the GUI.public JTextField getComponent()
JTextField containing the text value specified in the
constructor.getComponent in interface OptiongetComponent in class AbstractOptionJTextField to present to the user.public String getValue()
getValue in interface OptiongetValue in class AbstractOptionpublic void setValue(String newValue)
setValue in interface OptionsetValue in class AbstractOptionnewValue - User input. Should not be null; use a zero
length String to specify an empty value.public void fromPrefsFormat(String text)
fromPrefsFormat in interface OptionfromPrefsFormat in class AbstractOptiontext - Line from the startup script that represents the current
option. null is not allowed.IllegalArgumentException - if text is not in the proper
format for the current platform.public String toString()
String representation of this TextOption.toString in interface OptiontoString in class AbstractOptionString that looks something like
"[TextOption@7825114a: optionId=BLAH value=USER INPUT]".toString(),
BooleanOption.toString()public static String removeOutermostQuotes(String value)
String begins and ends with
OptionMaster.QUOTE_STRING, this method will return the given
String without the "outermost" quote pair. Otherwise
the String is returned without modification.value - String from which the outermost pair of quotes
should be removed. Cannot be null.value with the outermost pair of quotes removed,
or value, unmodified.