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 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.
    • Constructor Detail

      • PromptUser

        public PromptUser()
    • Method Detail

      • 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 interface AutomatableInteraction
        Parameters:
        value - if true actor is not interactive, but automated
      • isNonInteractive

        public boolean isNonInteractive()
        Returns whether interactiveness is enabled/disabled.
        Specified by:
        isNonInteractive in interface AutomatableInteraction
        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 interface AutomatableInteraction
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doEvaluate

        protected boolean doEvaluate​(Actor owner,
                                     Token token)
        Performs the actual evaluation.
        Specified by:
        doEvaluate in class AbstractBooleanCondition
        Parameters:
        owner - the owning actor
        token - the current token passing through
        Returns:
        always true