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 TypeFieldDescriptionJComboBox
that will eventually contain logging levels to select.private String
String
representation of the user's selection, or the default value provided to the constructor.private static final String
String
representation of Logback's "DEBUG" logging level.private static final String
String
representation of Logback's "ERROR" logging level.private static final String
String
representation of Logback's "INFO" logging level.private static final String
String
representation of Logback's "OFF" logging level.private static final String
String
representation of Logback's "TRACE" logging level.private static final String
String
representation 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 aJComboBox
containing the logging levels to select.getValue()
Returns the user's current selection (or the default value).private static boolean
isValidValue
(String value) Tests aString
value to see if it has a corresponding logging level.void
Stores the user's selected logging level.private static ch.qos.logback.classic.Level
stringToLogback
(String value) Converts aString
value to the corresponding logging level.toString()
String
representation 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
String
representation of Logback's "TRACE" logging level. -
DEBUG
String
representation of Logback's "DEBUG" logging level. -
INFO
String
representation of Logback's "INFO" logging level. -
WARN
String
representation of Logback's "WARN" logging level. -
ERROR
String
representation of Logback's "ERROR" logging level. -
OFF
String
representation of Logback's "OFF" logging level. -
comboBox
JComboBox
that will eventually contain logging levels to select. May benull
. -
currentChoice
String
representation 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:null
is 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
- ifdefaultValue
failedisValidValue(String)
.
-
-
Method Details
-
getComponent
Builds aJComboBox
containing the logging levels to select. Defaults to theString
specified in the constructor.- Specified by:
getComponent
in interfaceOption
- Specified by:
getComponent
in classAbstractOption
- Returns:
JComboBox
to present to the user.
-
getValue
Returns the user's current selection (or the default value).- Specified by:
getValue
in interfaceOption
- Specified by:
getValue
in 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 generateItemEvents
if the selection did not actually change.- Specified by:
setValue
in interfaceOption
- Specified by:
setValue
in classAbstractOption
- Parameters:
value
-String
representation of the desired logging level. Should not benull
.- Throws:
IllegalArgumentException
- ifvalue
failedisValidValue(String)
.
-
stringToLogback
Converts aString
value 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 invalidvalue
was provided.- Parameters:
value
- Value to convert.- Returns:
- Logging level.
- Throws:
IllegalArgumentException
- ifvalue
did not have a corresponding logging level.
-
isValidValue
Tests aString
value to see if it has a corresponding logging level. -
toString
String
representation of the user's logging level selection.- Specified by:
toString
in interfaceOption
- Specified by:
toString
in classAbstractOption
- Returns:
String
that looks something like "[LoggerLevel@7825114a: currentChoice=INFO]".- See Also:
-