Class AbstractAction<T>

    • Constructor Detail

      • AbstractAction

        public AbstractAction()
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: Action
        Returns the name of the action.
        Specified by:
        getName in interface Action<T>
        Returns:
        Name of the action
      • setName

        public void setName​(java.lang.String name)
        Description copied from interface: Action
        Changes the name of the action.
        Specified by:
        setName in interface Action<T>
        Parameters:
        name - The new name
      • addNameListener

        public Listener<Action<T>> addNameListener​(Listener<Action<T>> listener)
        Description copied from interface: Action
        Adds a listener to this action that is triggered any time its name is changed.
        Specified by:
        addNameListener in interface Action<T>
        Parameters:
        listener - Listener to add
        Returns:
        The added listener
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String key)
        Description copied from interface: Action
        Returns the value of the specified attribute for this action. Returns null if it doesn't exist.
        Specified by:
        getAttribute in interface Action<T>
        Parameters:
        key - Attribute key
        Returns:
        Attribute value
      • setAttribute

        public void setAttribute​(java.lang.String key,
                                 java.lang.String value)
        Description copied from interface: Action
        Sets the value of the specified attribute for this action.
        Specified by:
        setAttribute in interface Action<T>
        Parameters:
        key - Attribute key
        value - Attribute value
      • hasAttribute

        public boolean hasAttribute​(java.lang.String key)
        Description copied from interface: Action
        Returns whether this action has an attribute with the given name.
        Specified by:
        hasAttribute in interface Action<T>
        Parameters:
        key - Attribute key to check
        Returns:
        Does it exist?
      • removeAttribute

        public void removeAttribute​(java.lang.String key)
        Description copied from interface: Action
        Removes the attribute with the given name from this action - if it exists.
        Specified by:
        removeAttribute in interface Action<T>
        Parameters:
        key - Key of attribute to remove
      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.String> getAttributes()
        Description copied from interface: Action
        Returns an unmodifiable mapping of all attributes.
        Specified by:
        getAttributes in interface Action<T>
        Returns:
        Attribtues
      • addAttributeListener

        public Listener<Action<T>> addAttributeListener​(Listener<Action<T>> listener)
        Description copied from interface: Action
        Adds a listener that is triggered any time the attributes of the action are updated.
        Specified by:
        addAttributeListener in interface Action<T>
        Parameters:
        listener - Listener to add
        Returns:
        The added listener
      • addTag

        public void addTag​(java.lang.String tag)
        Specified by:
        addTag in interface Action<T>
      • removeTag

        public void removeTag​(java.lang.String tag)
        Specified by:
        removeTag in interface Action<T>
      • clearTags

        public void clearTags()
        Specified by:
        clearTags in interface Action<T>
      • getTags

        public java.util.List<java.lang.String> getTags()
        Specified by:
        getTags in interface Action<T>
      • reset

        public abstract void reset()
        Description copied from interface: Action
        Resets the action to the state it was in before being run.
        Specified by:
        reset in interface Action<T>
      • onStart

        protected void onStart()
      • onFinish

        protected void onFinish()
      • start

        public abstract void start()
        Description copied from interface: Action
        Runs the action. Should only return once the action is complete/interrupted/failed.
        Specified by:
        start in interface Action<T>
      • stop

        public abstract void stop()
        Description copied from interface: Action
        Interrupts and stops the action.
        Specified by:
        stop in interface Action<T>
      • skip

        public abstract void skip()
        Description copied from interface: Action
        Marks the action to be skipped next time it is run, or immediately if it is currently running.
        Specified by:
        skip in interface Action<T>
      • getStatus

        public Action.Status getStatus()
        Description copied from interface: Action
        Returns the current status of this action.
        Specified by:
        getStatus in interface Action<T>
        Returns:
        Status of action
      • setStatus

        public void setStatus​(Action.Status status)
        Description copied from interface: Action
        Sets the current status of this action.
        Specified by:
        setStatus in interface Action<T>
        Parameters:
        status - The status to set
      • addStatusListener

        public Listener<Action<T>> addStatusListener​(Listener<Action<T>> listener)
        Description copied from interface: Action
        Adds a listener that is triggered any time the status of the action is changed.
        Specified by:
        addStatusListener in interface Action<T>
        Parameters:
        listener - Listener to add
        Returns:
        The added listener
      • removeListener

        public void removeListener​(Listener<Action<T>> listener)
        Description copied from interface: Action
        Removes the specified listener for the action - if it has it.
        Specified by:
        removeListener in interface Action<T>
        Parameters:
        listener - The listener to remove
      • isRunning

        public abstract boolean isRunning()
        Description copied from interface: Action
        Returns whether the action is currently running or not.
        Specified by:
        isRunning in interface Action<T>
        Returns:
        Is it running?
      • isCritical

        public boolean isCritical()
        Description copied from interface: Action
        Returns whether this action is critical - critical actions require the entire action queue to abort if they fail.
        Specified by:
        isCritical in interface Action<T>
        Returns:
        Is it critical?
      • setCritical

        public void setCritical​(boolean critical)
        Description copied from interface: Action
        Sets whether this action is critical - critical actions require the entire action queue to abort if they fail.
        Specified by:
        setCritical in interface Action<T>
        Parameters:
        critical - Should it be critical
      • getData

        public abstract T getData()
        Description copied from interface: Action
        Returns whatever data this action generates.
        Specified by:
        getData in interface Action<T>
        Returns:
        Generated data
      • getChildren

        public abstract java.util.List<Action> getChildren()
        Description copied from interface: Action
        Returns an unmodifiable list of sub-actions that this action contains. The exact meaning of a sub-action and how it relates to the running of this action depends on the type of action this is.
        Specified by:
        getChildren in interface Action<T>
        Returns:
        List of sub-actions
      • addChildrenListener

        public Listener<Action<T>> addChildrenListener​(Listener<Action<T>> listener)
        Description copied from interface: Action
        Adds a listener that is triggered any time child actions are added/removed.
        Specified by:
        addChildrenListener in interface Action<T>
        Parameters:
        listener - Listener to add
        Returns:
        The added listener
      • userEdit

        public void userEdit()
        Description copied from interface: Action
        Performs whatever routine is necessary to allow the user to edit this action.
        Specified by:
        userEdit in interface Action<T>
      • childrenChanged

        protected void childrenChanged()
      • copyBasicParametersTo

        protected void copyBasicParametersTo​(AbstractAction<T> copy)