Class ProgressObserver

    • Field Detail

      • NO_OBSERVER

        public static final ProgressObserver NO_OBSERVER
        Defines an observer which does nothing. Avoids a lot of if-then-else constructs.
    • Constructor Detail

      • ProgressObserver

        public ProgressObserver()
    • Method Detail

      • registerTask

        public abstract ProgressObserver.ITask registerTask​(java.lang.String task)
        Registers a task for notify about processing progress.
        Parameters:
        task - the name of the task
        Returns:
        the task identification
      • registerSubtask

        public abstract ProgressObserver.ISubtask registerSubtask​(java.lang.String subtask)
        Registers a subtask to notify about processing progress.
        Parameters:
        subtask - the name of the sub task
        Returns:
        the task identification
      • notifyStart

        public void notifyStart​(ProgressObserver.ITask task,
                                int max)
        Notifies about starting a task.
        Parameters:
        task - the identification of task to notify about (initially use registerTask(String) for registering a task)
        max - the intended maximum steps of the subtask
      • notifyStart

        public abstract void notifyStart​(ProgressObserver.ITask task,
                                         ProgressObserver.ISubtask subtask,
                                         int max)
        Notifies about starting a (sub)task. Subtask notifications shall occur after task notifications, i.e. nested.
        Parameters:
        task - the identification of task to notify about (initially use registerTask(String) for registering a task)
        subtask - the subtask (may be NO_SUBTASK) (initially use registerSubtask(String) for registering a sub task)
        max - the intended maximum steps of the subtask
      • notifyProgress

        public void notifyProgress​(ProgressObserver.ITask task,
                                   int step,
                                   int max)
        Notifies about processing a task or a subtask.
        Parameters:
        task - the identification of the task to notify about (initially use registerTask(String) for registering a task)
        step - the current step in 0<=step<=max
        max - the maximum number of steps, ignored if negative and value from start notification is used instead
      • notifyProgress

        public void notifyProgress​(ProgressObserver.ITask task,
                                   int step)
        Notifies about processing a task or a subtask.
        Parameters:
        task - the identification of the task to notify about (initially use registerTask(String) for registering a task)
        step - the current step in 0<=step<=max
      • notifyProgress

        public abstract void notifyProgress​(ProgressObserver.ITask task,
                                            ProgressObserver.ISubtask subtask,
                                            int step,
                                            int max)
        Notifies about processing a task or a subtask.
        Parameters:
        task - the identification of the task to notify about (initially use registerTask(String) for registering a task)
        subtask - the identification of the subtask (may be NO_SUBTASK, initially use registerSubtask(String) for registering a sub task)
        step - the current step in 0<=step<=max
        max - the maximum number of steps, ignored if negative and value from start notification is used instead
      • notifyEnd

        public void notifyEnd​(ProgressObserver.ITask task)
        Notifies about ending a (sub)task. Subtask notifications shall occur before task notifications, i.e. correctly nested. Use the identifications returned by registerTask(String) and registerSubtask(String). This method shall implicitly unregister the given task and/or subtask.
        Parameters:
        task - the identification of the task which ends (initially use registerTask(String) for registering a task)