Package adams.flow.condition.bool
Class PromptUser
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<BooleanCondition>,SizeOfHandler,Stoppable,BooleanCondition,AutomatableInteraction,InteractionDisplayLocationSupporter,Serializable
public class PromptUser extends AbstractBooleanCondition implements AutomatableInteraction, InteractionDisplayLocationSupporter
Prompts the user to click on 'positive' or 'negative' button (negative button can be omitted).
The actor's name can be used in the message using the following placeholders:
{SHORT} - the short name
{FULL} - the full name (incl path)
Variables get expanded as well.
Can be used in a headless environment as well.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-message <java.lang.String> (property: message) The message to prompt the user with; variables get expanded automatically. default: Do you want to execute {SHORT}?-caption-positive <java.lang.String> (property: captionPositive) The caption for the 'positive' button. default: yes
-caption-negative <java.lang.String> (property: captionNegative) The caption for the 'negative' button, leave empty to only show the 'positive' button. default: no
-initial-selection <java.lang.String> (property: initialSelection) The initial selection to prompt the user with. default:
-non-interactive <boolean> (property: nonInteractive) If enabled, the condition automatically evaluates to the button that matches the initial selection or, if that is left empty, to 'true'. default: false
-display-location <DIALOG|NOTIFICATION_AREA> (property: displayLocation) Determines where the interaction is being displayed. default: DIALOG
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_CaptionNegativethe caption for the 'negative' button.protected Stringm_CaptionPositivethe caption for the 'positive' button.protected GUIHelper.DialogCommunicationm_Communicationfor cancellation.protected InteractionDisplayLocationm_DisplayLocationwhere to display the prompt.protected Stringm_InitialSelectionthe initial selection.protected Stringm_Messagethe message to prompt the user with.protected booleanm_NonInteractivewhether the prompt is non-interactive.static StringPLACEHOLDER_FULLthe placeholder for the full actor name.static StringPLACEHOLDER_SHORTthe placeholder for the short actor name.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description PromptUser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]accepts()Returns the class that the consumer accepts.StringcaptionNegativeTipText()Returns the tip text for this property.StringcaptionPositiveTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.StringdisplayLocationTipText()Returns the tip text for this property.protected booleandoEvaluate(Actor owner, Token token)Performs the actual evaluation.StringgetCaptionNegative()Returns the caption for the 'negative' button.StringgetCaptionPositive()Returns the caption for the 'negative' button.InteractionDisplayLocationgetDisplayLocation()Returns where the interaction is being displayed.StringgetInitialSelection()Returns the initial selection the user is prompted with.StringgetMessage()Returns the message to display.StringgetQuickInfo()Returns the quick info string to be displayed in the flow editor.StringglobalInfo()Returns a string describing the object.StringinitialSelectionTipText()Returns the tip text for this property.booleanisNonInteractive()Returns whether interactiveness is enabled/disabled.StringmessageTipText()Returns the tip text for this property.StringnonInteractiveTipText()Returns the tip text for this property.voidsetCaptionNegative(String value)Sets the caption for the 'negative' button.voidsetCaptionPositive(String value)Sets the caption for the 'positive' button.voidsetDisplayLocation(InteractionDisplayLocation value)Sets where the interaction is being displayed.voidsetInitialSelection(String value)Sets the initial selection to prompt the user with.voidsetMessage(String value)Sets the message to display.voidsetNonInteractive(boolean value)Sets whether to enable/disable interactiveness.voidstopExecution()Stops the execution.-
Methods inherited from class adams.flow.condition.bool.AbstractBooleanCondition
evaluate, preEvaluate, setUp, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
PLACEHOLDER_SHORT
public static final String PLACEHOLDER_SHORT
the placeholder for the short actor name.- See Also:
- Constant Field Values
-
PLACEHOLDER_FULL
public static final String PLACEHOLDER_FULL
the placeholder for the full actor name.- See Also:
- Constant Field Values
-
m_Message
protected String m_Message
the message to prompt the user with.
-
m_CaptionPositive
protected String m_CaptionPositive
the caption for the 'positive' button.
-
m_CaptionNegative
protected String m_CaptionNegative
the caption for the 'negative' button.
-
m_InitialSelection
protected String m_InitialSelection
the initial selection.
-
m_NonInteractive
protected boolean m_NonInteractive
whether the prompt is non-interactive.
-
m_DisplayLocation
protected InteractionDisplayLocation m_DisplayLocation
where to display the prompt.
-
m_Communication
protected GUIHelper.DialogCommunication m_Communication
for cancellation.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setMessage
public void setMessage(String value)
Sets the message to display.- Parameters:
value- the message
-
getMessage
public String getMessage()
Returns the message to display.- Returns:
- the message
-
messageTipText
public String messageTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCaptionPositive
public void setCaptionPositive(String value)
Sets the caption for the 'positive' button.- Parameters:
value- the caption
-
getCaptionPositive
public String getCaptionPositive()
Returns the caption for the 'negative' button.- Returns:
- the caption
-
captionPositiveTipText
public String captionPositiveTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCaptionNegative
public void setCaptionNegative(String value)
Sets the caption for the 'negative' button.- Parameters:
value- the caption
-
getCaptionNegative
public String getCaptionNegative()
Returns the caption for the 'negative' button.- Returns:
- the caption
-
captionNegativeTipText
public String captionNegativeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setInitialSelection
public void setInitialSelection(String value)
Sets the initial selection to prompt the user with.- Parameters:
value- the initial selection
-
getInitialSelection
public String getInitialSelection()
Returns the initial selection the user is prompted with.- Returns:
- the initial selection
-
initialSelectionTipText
public String initialSelectionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNonInteractive
public void setNonInteractive(boolean value)
Sets whether to enable/disable interactiveness.- Specified by:
setNonInteractivein interfaceAutomatableInteraction- Parameters:
value- if true actor is not interactive, but automated
-
isNonInteractive
public boolean isNonInteractive()
Returns whether interactiveness is enabled/disabled.- Specified by:
isNonInteractivein interfaceAutomatableInteraction- Returns:
- true if actor is not interactive i.e., automated
-
nonInteractiveTipText
public String nonInteractiveTipText()
Returns the tip text for this property.- Specified by:
nonInteractiveTipTextin interfaceAutomatableInteraction- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setDisplayLocation
public void setDisplayLocation(InteractionDisplayLocation value)
Sets where the interaction is being displayed.- Specified by:
setDisplayLocationin interfaceInteractionDisplayLocationSupporter- Parameters:
value- the location
-
getDisplayLocation
public InteractionDisplayLocation getDisplayLocation()
Returns where the interaction is being displayed.- Specified by:
getDisplayLocationin interfaceInteractionDisplayLocationSupporter- Returns:
- the location
-
displayLocationTipText
public String displayLocationTipText()
Returns the tip text for this property.- Specified by:
displayLocationTipTextin interfaceInteractionDisplayLocationSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns the quick info string to be displayed in the flow editor.- Specified by:
getQuickInfoin interfaceBooleanCondition- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Specified by:
getQuickInfoin classAbstractBooleanCondition- Returns:
- always 'true'
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
acceptsin interfaceBooleanCondition- Specified by:
acceptsin classAbstractBooleanCondition- Returns:
- Unknown
-
doEvaluate
protected boolean doEvaluate(Actor owner, Token token)
Performs the actual evaluation.- Specified by:
doEvaluatein classAbstractBooleanCondition- Parameters:
owner- the owning actortoken- the current token passing through- Returns:
- always true
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceBooleanCondition- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractBooleanCondition
-
-