Class Operation

    • Field Detail

      • abort

        private boolean abort
      • progressListeners

        private Vector progressListeners
    • Constructor Detail

      • Operation

        public Operation()
        This constructor creates two internal empty lists for progress listeners and parameters.
    • Method Detail

      • addProgressListener

        public void addProgressListener​(ProgressListener progressListener)
        Adds the argument progress listener to the internal list of progress listeners. Does not check if the argument already exists in that list, so you have to check for duplicates yourself.
        Parameters:
        progressListener - the progress listener to be added
      • addProgressListeners

        public void addProgressListeners​(Vector progressListeners)
        Adds several progress listeners to this operation object.
        Parameters:
        progressListeners - contains zero or more objects implementing ProgressListener; each will be added by calling addProgressListener(net.sourceforge.jiu.ops.ProgressListener) on it
      • getAbort

        public boolean getAbort()
        Returns the current abort status. If true, a running operation should terminate what it is doing (return from process()).
        Returns:
        abort status
        See Also:
        setAbort(boolean)
      • removeProgressListener

        public void removeProgressListener​(ProgressListener progressListener)
        Removes the argument progress listener from the internal list of progress listeners.
        Parameters:
        progressListener - the progress listener to be removed
      • setAbort

        public void setAbort​(boolean newAbortStatus)
        Sets a new abort status.
        Parameters:
        newAbortStatus - the new status
        See Also:
        getAbort()
      • setProgress

        public void setProgress​(float progress)
        This method will notify all registered progress listeners about a new progress level. The argument must be from 0.0f to 1.0f where 0.0f marks the beginning and 1.0f completion. The progress value should not be smaller than any value that was previously set.
        Parameters:
        progress - new progress value, from 0.0 to 1.0
      • setProgress

        public void setProgress​(int zeroBasedIndex,
                                int totalItems)
        This method will notify all registered progress listeners about a new progress level. Simply checks the arguments and calls setProgress((float)zeroBasedIndex / (float)totalItems);.
        Parameters:
        zeroBasedIndex - the index of the item that was just processed, zero-based
        totalItems - the number of items that will be processed