public class PromptIfEnabledSetupInstruction extends DefaultSetupInstruction
true, then this
instruction will leave the prompt message as-is thus prompting the user for a new value. If that enablement
preference is false, then the prompt message will be set to null forcing this instruction's
new preference value to be the default value.
Use this when there are a set of preferences that are configuration settings for a particular feature that can be enabled or disabled. If that feature is disabled (via the enablement preference), then the user should not be asked to configure that feature any further. If that feature is enabled, then it makes sense to ask the user to configure the rest of that feature's settings.
This class derives from DefaultSetupInstruction so it will default to the existing preference value if one
exists; otherwise, the original SetupInstruction.getDefaultValue() is used.
| Constructor and Description |
|---|
PromptIfEnabledSetupInstruction(String preference_name,
String default_value,
SetupValidityChecker validity_checker,
String prompt_message,
String help_message,
String enablement_preference,
boolean enablement_preference_default)
The
enablement_preference is the name of the boolean preference that will determine if this
instruction will or will not prompt the user. |
| Modifier and Type | Method and Description |
|---|---|
void |
preProcess()
If the enablement preference's value is
true, then this method does nothing, but if it is
false, this method will set the prompt to null so the user
isn't bothered to ask to configure this setting. |
getDefaultValue, getHelpMessage, getPreferenceName, getPreferences, getPromptMessage, getValidityChecker, isUsingNoEchoPrompt, postProcess, setDefaultValue, setHelpMessage, setPreferences, setPromptMessage, setUsingNoEchoPrompt, setValidityChecker, toStringpublic PromptIfEnabledSetupInstruction(String preference_name, String default_value, SetupValidityChecker validity_checker, String prompt_message, String help_message, String enablement_preference, boolean enablement_preference_default) throws IllegalArgumentException
enablement_preference is the name of the boolean preference that will determine if this
instruction will or will not prompt the user. The enablement_preference_default is the default value
of the enablement preference if it is not defined (that is, if it is not set in the set of preferences given to
this instruction via SetupInstruction.setPreferences(java.util.prefs.Preferences)).IllegalArgumentExceptionSetupInstruction#SetupInstruction(String, String, SetupValidityChecker, String, String)public void preProcess()
true, then this method does nothing, but if it is
false, this method will set the prompt to null so the user
isn't bothered to ask to configure this setting.preProcess in class DefaultSetupInstructionSetupInstruction.preProcess()Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.