Class LoggerLevelOption
java.lang.Object
edu.wisc.ssec.mcidasv.startupmanager.options.AbstractOption
edu.wisc.ssec.mcidasv.startupmanager.options.LoggerLevelOption
- All Implemented Interfaces:
Option
Representation of a choice allowing the user to select the global McIDAS-V
logging level.
-
Field Summary
FieldsModifier and TypeFieldDescriptionJComboBoxthat will eventually contain logging levels to select.private StringStringrepresentation of the user's selection, or the default value provided to the constructor.private static final StringStringrepresentation of Logback's "DEBUG" logging level.private static final StringStringrepresentation of Logback's "ERROR" logging level.private static final StringStringrepresentation of Logback's "INFO" logging level.private static final StringStringrepresentation of Logback's "OFF" logging level.private static final StringStringrepresentation of Logback's "TRACE" logging level.private static final StringStringrepresentation of Logback's "WARN" logging level. -
Constructor Summary
ConstructorsConstructorDescriptionLoggerLevelOption(String id, String label, String defaultValue, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility) Create a startup option that allows the user to manipulate the global McIDAS-V logging level. -
Method Summary
Modifier and TypeMethodDescriptionBuilds aJComboBoxcontaining the logging levels to select.getValue()Returns the user's current selection (or the default value).private static booleanisValidValue(String value) Tests aStringvalue to see if it has a corresponding logging level.voidStores the user's selected logging level.private static ch.qos.logback.classic.LevelstringToLogback(String value) Converts aStringvalue to the corresponding logging level.toString()Stringrepresentation of the user's logging level selection.Methods inherited from class edu.wisc.ssec.mcidasv.startupmanager.options.AbstractOption
fromPrefsFormat, getLabel, getOptionId, getOptionPlatform, getOptionType, getOptionVisibility, isValidPrefFormat, onValidPlatform, toPrefsFormat
-
Field Details
-
TRACE
Stringrepresentation of Logback's "TRACE" logging level. -
DEBUG
Stringrepresentation of Logback's "DEBUG" logging level. -
INFO
Stringrepresentation of Logback's "INFO" logging level. -
WARN
Stringrepresentation of Logback's "WARN" logging level. -
ERROR
Stringrepresentation of Logback's "ERROR" logging level. -
OFF
Stringrepresentation of Logback's "OFF" logging level. -
comboBox
JComboBoxthat will eventually contain logging levels to select. May benull. -
currentChoice
Stringrepresentation of the user's selection, or the default value provided to the constructor.
-
-
Constructor Details
-
LoggerLevelOption
public LoggerLevelOption(String id, String label, String defaultValue, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility) Create a startup option that allows the user to manipulate the global McIDAS-V logging level. 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.- Throws:
IllegalArgumentException- ifdefaultValuefailedisValidValue(String).
-
-
Method Details
-
getComponent
Builds aJComboBoxcontaining the logging levels to select. Defaults to theStringspecified in the constructor.- Specified by:
getComponentin interfaceOption- Specified by:
getComponentin classAbstractOption- Returns:
JComboBoxto present to the user.
-
getValue
Returns the user's current selection (or the default value).- Specified by:
getValuein interfaceOption- Specified by:
getValuein classAbstractOption- Returns:
- Current selection or default value.
-
setValue
Stores the user's selected logging level. Note that this can be called from third-party or the GUI! If the call originates from the GUI, an infinite loop is avoided by using theJComboBox.setSelectedItem(Object)behavior that does not generateItemEventsif the selection did not actually change.- Specified by:
setValuein interfaceOption- Specified by:
setValuein classAbstractOption- Parameters:
value-Stringrepresentation of the desired logging level. Should not benull.- Throws:
IllegalArgumentException- ifvaluefailedisValidValue(String).
-
stringToLogback
Converts aStringvalue to the corresponding logging level.This functionality is similar to
Level.toLevel(String, Level), but for this use case it is preferable to know if an invalidvaluewas provided.- Parameters:
value- Value to convert.- Returns:
- Logging level.
- Throws:
IllegalArgumentException- ifvaluedid not have a corresponding logging level.
-
isValidValue
Tests aStringvalue to see if it has a corresponding logging level. -
toString
Stringrepresentation of the user's logging level selection.- Specified by:
toStringin interfaceOption- Specified by:
toStringin classAbstractOption- Returns:
Stringthat looks something like "[LoggerLevel@7825114a: currentChoice=INFO]".- See Also:
-