Class AbstractOption
java.lang.Object
edu.wisc.ssec.mcidasv.startupmanager.options.AbstractOption
- All Implemented Interfaces:
Option
- Direct Known Subclasses:
BooleanOption,DirectoryOption,FileOption,LoggerLevelOption,MemoryOption,SliderOption,TextOption
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBrief description of the option.private final StringA unique identifier for an option.private final OptionMaster.OptionPlatformprivate final OptionMaster.Typeprivate final OptionMaster.Visibility -
Constructor Summary
ConstructorsConstructorDescriptionAbstractOption(String id, String label, OptionMaster.Type optionType, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility) Creates an option that can hold a specified sort of data and that applies to a given platform. -
Method Summary
Modifier and TypeMethodDescriptionvoidfromPrefsFormat(String text) Initializes the current option using a relevant variable from the startup script.abstract JComponentReturns the GUI component that represents the option.getLabel()Returns a brief description of this option.Returns the ID used when referring to this option.Returns the platform(s) to which this option applies.Returns this option's type.Returns whether or not this option represents a visible UI element.abstract StringgetValue()Returns the value of the option.protected booleanisValidPrefFormat(String text) Tests the specified string to see if it's valid for the current platform.protected booleanDetermines if the option applies to the current platform.abstract voidForces the value of the option to the data specified.Returns a string representation of the current option that is suitable for use in the startup script.abstract StringtoString()Friendly string representation of the option.
-
Field Details
-
optionId
A unique identifier for an option. Should be the same as the startup variable name found in the startup preference file. -
label
Brief description of the option. It will appear as the option's label in the GUI. -
optionType
- See Also:
-
optionPlatform
- See Also:
-
optionVisibility
- See Also:
-
-
Constructor Details
-
AbstractOption
public AbstractOption(String id, String label, OptionMaster.Type optionType, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility) Creates an option that can hold a specified sort of data and that applies to a given platform.- Parameters:
id- ID used to refer to this option.label- Text that'll be used as the GUI label for this optionoptionType- Type of data this option will represent.optionPlatform- Platform(s) where this option is applicable.optionVisibility- Visibility behavior of this option.
-
-
Method Details
-
onValidPlatform
Determines if the option applies to the current platform.- Returns:
trueif this option is applicable,falseotherwise.
-
isValidPrefFormat
Tests the specified string to see if it's valid for the current platform. Currently strings that contain "SET " [ note the space ] are considered to be Windows-only, while strings lacking "SET " are considered Unix-like.- Parameters:
text- The string to test.- Returns:
- Whether or not the string is valid.
-
getOptionType
Returns this option's type.- Specified by:
getOptionTypein interfaceOption- Returns:
- Option's type.
- See Also:
-
getOptionPlatform
Returns the platform(s) to which this option applies.- Specified by:
getOptionPlatformin interfaceOption- Returns:
- Option's platform.
- See Also:
-
getOptionVisibility
Returns whether or not this option represents a visible UI element.- Specified by:
getOptionVisibilityin interfaceOption- Returns:
- The option's visibility.
- See Also:
-
getOptionId
Returns the ID used when referring to this option.- Specified by:
getOptionIdin interfaceOption- Returns:
- Option's ID.
-
getLabel
Returns a brief description of this option. Mostly useful for providing a GUI label. -
fromPrefsFormat
Initializes the current option using a relevant variable from the startup script.- Specified by:
fromPrefsFormatin interfaceOption- Parameters:
text- Line from the startup script that represents the current option.- Throws:
IllegalArgumentException- iftextis not in the proper format for the current platform.
-
toPrefsFormat
Returns a string representation of the current option that is suitable for use in the startup script.- Specified by:
toPrefsFormatin interfaceOption- Returns:
- Current value of this option as a startup script variable. The formatting changes slightly between "Unix-like" platforms and Windows.
- See Also:
-
getComponent
Returns the GUI component that represents the option.BooleanOptionsare represented by aJCheckBox, whileTextOptionsappear as aJTextField.- Specified by:
getComponentin interfaceOption- Returns:
- The GUI representation of this option.
-
getValue
Returns the value of the option. Note thatBooleanOptionsreturn either "0" or "1". -
setValue
Forces the value of the option to the data specified. Note thatBooleanOptionsaccept either "0", or "1". -
toString
Friendly string representation of the option.
-