Class SimpleMenu

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, ShallowCopySupporter<AbstractActorTemplate>, SizeOfHandler, Serializable

    public class SimpleMenu
    extends AbstractActorTemplate
    Generates a sub-flow that displays a dialog with the choice strings as buttons.
    If custom values are used, then these strings get stored in the variable rather than the choice strings.
    When enabling looping, ensure you have an exit option in the menu that sets the loop_state variable to 'false' to avoid an endless loop menu.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The new name for the actor; leave empty to use current.
        default:
     
    -message <java.lang.String> (property: message)
        The message to prompt the user with.
        default: Please select
     
    -choice <adams.core.base.BaseString> [-choice ...] (property: choices)
        The strings that get displayed as buttons.
        default:
     
    -use-custom-values <boolean> (property: useCustomValues)
        If enabled, the associated custom value gets stored in the variable rather
        than the choice string.
        default: false
     
    -value <adams.core.base.BaseString> [-value ...] (property: values)
        The values associated with the choice strings.
        default:
     
    -choice-variable <adams.core.VariableName> (property: choiceVariable)
        The name of the variable to use for storing the choice.
        default: choice
     
    -cancelled-variable <adams.core.VariableName> (property: cancelledVariable)
        The name of the variable to use for storing the cancelled state.
        default: cancelled
     
    -loop-menu <boolean> (property: loopMenu)
        If enabled, the menu gets wrapped in a while loop.
        default: false
     
    -loop-variable <adams.core.VariableName> (property: loopVariable)
        The name of the variable for storing the loop state; this variable needs
        to get initialized with 'true' before the while loop.
        default: loop_state
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Message

        protected String m_Message
        the message for the user.
      • m_Choices

        protected BaseString[] m_Choices
        the choices.
      • m_UseCustomValues

        protected boolean m_UseCustomValues
        whether to use custom values.
      • m_Values

        protected BaseString[] m_Values
        the values associated with the choice strings.
      • m_ChoiceVariable

        protected VariableName m_ChoiceVariable
        the variable to store the choice in.
      • m_CancelledVariable

        protected VariableName m_CancelledVariable
        the variable to store the cancelled state in.
      • m_LoopMenu

        protected boolean m_LoopMenu
        whether to loop the menu.
      • m_LoopVariable

        protected VariableName m_LoopVariable
        the variable for storing the loop state.
    • Constructor Detail

      • SimpleMenu

        public SimpleMenu()
    • Method Detail

      • setMessage

        public void setMessage​(String value)
        Sets the message to prompt the user with.
        Parameters:
        value - the message
      • getMessage

        public String getMessage()
        Returns the message the user is prompted with.
        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.
      • setChoices

        public void setChoices​(BaseString[] value)
        Sets the choices, which get displayed as buttons.
        Parameters:
        value - the choices
      • getChoices

        public BaseString[] getChoices()
        Returns the choices, which get displayed as buttons.
        Returns:
        the choices
      • choicesTipText

        public String choicesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUseCustomValues

        public void setUseCustomValues​(boolean value)
        Sets whether to store the associate value in the variable rather than the choice string.
        Parameters:
        value - true if to use custom values
      • getUseCustomValues

        public boolean getUseCustomValues()
        Returns whether to store the associate value in the variable rather than the choice string.
        Returns:
        true if to use custom values
      • useCustomValuesTipText

        public String useCustomValuesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setChoiceVariable

        public void setChoiceVariable​(VariableName value)
        Sets the variable name to use for storing the choice.
        Parameters:
        value - the variable name
      • getChoiceVariable

        public VariableName getChoiceVariable()
        Returns the variable name to use for storing the choice.
        Returns:
        the variable name
      • choiceVariableTipText

        public String choiceVariableTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setValues

        public void setValues​(BaseString[] value)
        Sets the associated value strings.
        Parameters:
        value - the values
      • getValues

        public BaseString[] getValues()
        Returns the associated value strings.
        Returns:
        the values
      • valuesTipText

        public String valuesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setCancelledVariable

        public void setCancelledVariable​(VariableName value)
        Sets the variable name to use for storing the cancelled state.
        Parameters:
        value - the variable name
      • getCancelledVariable

        public VariableName getCancelledVariable()
        Returns the variable name to use for storing the cancelled state.
        Returns:
        the variable name
      • cancelledVariableTipText

        public String cancelledVariableTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLoopMenu

        public void setLoopMenu​(boolean value)
        Sets whether to wrap the menu in a while loop.
        Parameters:
        value - true if to loop
      • getLoopMenu

        public boolean getLoopMenu()
        Returns whether to wrap the menu in a while loop.
        Returns:
        true if to loop
      • loopMenuTipText

        public String loopMenuTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLoopVariable

        public void setLoopVariable​(VariableName value)
        Sets the variable name to use for storing the cancelled state.
        Parameters:
        value - the variable name
      • getLoopVariable

        public VariableName getLoopVariable()
        Returns the variable name to use for storing the cancelled state.
        Returns:
        the variable name
      • loopVariableTipText

        public String loopVariableTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • isInteractive

        public boolean isInteractive()
        Whether the flow generated is an interactive one.
        Specified by:
        isInteractive in class AbstractActorTemplate
        Returns:
        true if interactive