Class ProgressTracker


  • public abstract class ProgressTracker
    extends java.lang.Object
    A callback to provide progress and cancel tracking mechanism for lengthy operation.
    • Constructor Summary

      Constructors 
      Constructor Description
      ProgressTracker()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static void checkAndThrow​(ProgressTracker tracker)
      Checks the tracker and throws UserCancelException if tracker is not null and progress returns false
      abstract boolean progress​(int step, int totalExpectedSteps)
      Periodically called by a lengthy operation to check if the caller requested to cancel.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProgressTracker

        public ProgressTracker()
    • Method Detail

      • progress

        public abstract boolean progress​(int step,
                                         int totalExpectedSteps)
        Periodically called by a lengthy operation to check if the caller requested to cancel.
        Parameters:
        step - The current step of the operation.
        totalExpectedSteps - is the number of steps the operation is expects to complete its task.
        Returns:
        true, if the operation can continue. Returns False, when the operation has to terminate due to a user cancelation.
      • checkAndThrow

        public static void checkAndThrow​(ProgressTracker tracker)
        Checks the tracker and throws UserCancelException if tracker is not null and progress returns false
        Parameters:
        tracker - can be null, then the method does nothing.