Class TextOption
java.lang.Object
edu.wisc.ssec.mcidasv.startupmanager.options.AbstractOption
edu.wisc.ssec.mcidasv.startupmanager.options.TextOption
- All Implemented Interfaces:
Option
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTextOption(String id, String label, String defaultValue, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility) Create a startup option that allows the user to supply arbitrary text. -
Method Summary
Modifier and TypeMethodDescriptionvoidfromPrefsFormat(String text) Initializes the current option using a relevant variable from the startup script.Builds aJTextFieldcontaining the text value specified in the constructor.getValue()Returns the user's input (or the default value).static StringremoveOutermostQuotes(String value) If the givenStringbegins and ends withOptionMaster.QUOTE_STRING, this method will return the givenStringwithout the "outermost" quote pair.voidStores the user's input.toString()Stringrepresentation of thisTextOption.Methods inherited from class edu.wisc.ssec.mcidasv.startupmanager.options.AbstractOption
getLabel, getOptionId, getOptionPlatform, getOptionType, getOptionVisibility, isValidPrefFormat, onValidPlatform, toPrefsFormat
-
Field Details
-
value
Text field value.
-
-
Constructor Details
-
TextOption
public 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.NOTE:
nullis not a permitted value for any of this constructor's parameters.- 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.
-
-
Method Details
-
getComponent
Builds aJTextFieldcontaining the text value specified in the constructor.- Specified by:
getComponentin interfaceOption- Specified by:
getComponentin classAbstractOption- Returns:
JTextFieldto present to the user.
-
getValue
Returns the user's input (or the default value).- Specified by:
getValuein interfaceOption- Specified by:
getValuein classAbstractOption- Returns:
- Input or default value.
-
setValue
Stores the user's input.- Specified by:
setValuein interfaceOption- Specified by:
setValuein classAbstractOption- Parameters:
newValue- User input. Should not benull; use a zero lengthStringto specify an empty value.
-
fromPrefsFormat
Initializes the current option using a relevant variable from the startup script.- Specified by:
fromPrefsFormatin interfaceOption- Overrides:
fromPrefsFormatin classAbstractOption- Parameters:
text- Line from the startup script that represents the current option.nullis not allowed.- Throws:
IllegalArgumentException- iftextis not in the proper format for the current platform.
-
toString
Stringrepresentation of thisTextOption.- Specified by:
toStringin interfaceOption- Specified by:
toStringin classAbstractOption- Returns:
Stringthat looks something like "[TextOption@7825114a: optionId=BLAH value=USER INPUT]".- See Also:
-
removeOutermostQuotes
If the givenStringbegins and ends withOptionMaster.QUOTE_STRING, this method will return the givenStringwithout the "outermost" quote pair. Otherwise theStringis returned without modification.- Parameters:
value-Stringfrom which the outermost pair of quotes should be removed. Cannot benull.- Returns:
- Either
valuewith the outermost pair of quotes removed, orvalue, unmodified.
-