public class LoggerLevelOption extends AbstractOption
| Modifier and Type | Field and Description |
|---|---|
private JComboBox<String> |
comboBox
JComboBox that will eventually contain logging levels to
select. |
private String |
currentChoice
String representation of the user's selection, or the default
value provided to the constructor. |
private static String |
DEBUG
String representation of Logback's "DEBUG" logging
level. |
private static String |
ERROR
String representation of Logback's "ERROR" logging
level. |
private static String |
INFO
String representation of Logback's "INFO" logging
level. |
private static String |
OFF
String representation of Logback's "OFF" logging
level. |
private static String |
TRACE
String representation of Logback's "TRACE" logging
level. |
private static String |
WARN
String representation of Logback's "WARN" logging
level. |
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
JComboBox<String> |
getComponent()
Builds a
JComboBox containing the logging levels to select. |
String |
getValue()
Returns the user's current selection (or the default value).
|
private static boolean |
isValidValue(String value)
Tests a
String value to see if it has a corresponding logging
level. |
void |
setValue(String value)
Stores the user's selected logging level.
|
private static ch.qos.logback.classic.Level |
stringToLogback(String value)
Converts a
String value to the corresponding logging level. |
String |
toString()
String representation of the user's logging level selection. |
fromPrefsFormat, getLabel, getOptionId, getOptionPlatform, getOptionType, getOptionVisibility, isValidPrefFormat, onValidPlatform, toPrefsFormatprivate JComboBox<String> comboBox
JComboBox that will eventually contain logging levels to
select. May be null.private String currentChoice
String representation of the user's selection, or the default
value provided to the constructor.public LoggerLevelOption(String id, String label, String defaultValue, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility)
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.IllegalArgumentException - if defaultValue failed isValidValue(String).public JComboBox<String> getComponent()
JComboBox containing the logging levels to select.
Defaults to the String specified in the constructor.getComponent in interface OptiongetComponent in class AbstractOptionJComboBox to present to the user.public String getValue()
getValue in interface OptiongetValue in class AbstractOptionpublic void setValue(String value)
JComboBox.setSelectedItem(Object)
behavior that does not generate ItemEvents if
the selection did not actually change.setValue in interface OptionsetValue in class AbstractOptionvalue - String representation of the desired logging
level. Should not be null.IllegalArgumentException - if value failed
isValidValue(String).private static ch.qos.logback.classic.Level stringToLogback(String value)
String 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 invalid value was provided.
value - Value to convert.IllegalArgumentException - if value did not have a
corresponding logging level.private static boolean isValidValue(String value)
String value to see if it has a corresponding logging
level.public String toString()
String representation of the user's logging level selection.toString in interface OptiontoString in class AbstractOptionString that looks something like
"[LoggerLevel@7825114a: currentChoice=INFO]".TextOption.toString(),
BooleanOption.toString()