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 String
m_CaptionNegative
the caption for the 'negative' button.protected String
m_CaptionPositive
the caption for the 'positive' button.protected GUIHelper.DialogCommunication
m_Communication
for cancellation.protected InteractionDisplayLocation
m_DisplayLocation
where to display the prompt.protected String
m_InitialSelection
the initial selection.protected String
m_Message
the message to prompt the user with.protected boolean
m_NonInteractive
whether the prompt is non-interactive.static String
PLACEHOLDER_FULL
the placeholder for the full actor name.static String
PLACEHOLDER_SHORT
the 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.String
captionNegativeTipText()
Returns the tip text for this property.String
captionPositiveTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.String
displayLocationTipText()
Returns the tip text for this property.protected boolean
doEvaluate(Actor owner, Token token)
Performs the actual evaluation.String
getCaptionNegative()
Returns the caption for the 'negative' button.String
getCaptionPositive()
Returns the caption for the 'negative' button.InteractionDisplayLocation
getDisplayLocation()
Returns where the interaction is being displayed.String
getInitialSelection()
Returns the initial selection the user is prompted with.String
getMessage()
Returns the message to display.String
getQuickInfo()
Returns the quick info string to be displayed in the flow editor.String
globalInfo()
Returns a string describing the object.String
initialSelectionTipText()
Returns the tip text for this property.boolean
isNonInteractive()
Returns whether interactiveness is enabled/disabled.String
messageTipText()
Returns the tip text for this property.String
nonInteractiveTipText()
Returns the tip text for this property.void
setCaptionNegative(String value)
Sets the caption for the 'negative' button.void
setCaptionPositive(String value)
Sets the caption for the 'positive' button.void
setDisplayLocation(InteractionDisplayLocation value)
Sets where the interaction is being displayed.void
setInitialSelection(String value)
Sets the initial selection to prompt the user with.void
setMessage(String value)
Sets the message to display.void
setNonInteractive(boolean value)
Sets whether to enable/disable interactiveness.void
stopExecution()
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:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in 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:
setNonInteractive
in interfaceAutomatableInteraction
- Parameters:
value
- if true actor is not interactive, but automated
-
isNonInteractive
public boolean isNonInteractive()
Returns whether interactiveness is enabled/disabled.- Specified by:
isNonInteractive
in interfaceAutomatableInteraction
- Returns:
- true if actor is not interactive i.e., automated
-
nonInteractiveTipText
public String nonInteractiveTipText()
Returns the tip text for this property.- Specified by:
nonInteractiveTipText
in 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:
setDisplayLocation
in interfaceInteractionDisplayLocationSupporter
- Parameters:
value
- the location
-
getDisplayLocation
public InteractionDisplayLocation getDisplayLocation()
Returns where the interaction is being displayed.- Specified by:
getDisplayLocation
in interfaceInteractionDisplayLocationSupporter
- Returns:
- the location
-
displayLocationTipText
public String displayLocationTipText()
Returns the tip text for this property.- Specified by:
displayLocationTipText
in 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:
getQuickInfo
in interfaceBooleanCondition
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Specified by:
getQuickInfo
in classAbstractBooleanCondition
- Returns:
- always 'true'
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
accepts
in interfaceBooleanCondition
- Specified by:
accepts
in classAbstractBooleanCondition
- Returns:
- Unknown
-
doEvaluate
protected boolean doEvaluate(Actor owner, Token token)
Performs the actual evaluation.- Specified by:
doEvaluate
in classAbstractBooleanCondition
- Parameters:
owner
- the owning actortoken
- the current token passing through- Returns:
- always true
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceBooleanCondition
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractBooleanCondition
-
-