View Javadoc

1   /*
2    * Copyright 2006 - 2012 Christina Bohk and Roland Ewald
3    *  
4    * Licensed under the Apache License, Version 2.0 (the "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at 
7    *  
8    *  http://www.apache.org/licenses/LICENSE-2.0
9    *  
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License. 
15   */
16  package p3j.misc;
17  
18  /**
19   * Interface for components that display the progress in one way or another.
20   * Used to decouple the GUI from the underlying implementation.
21   * 
22   * Created on 27.10.2012
23   * 
24   * @author Christina Bohk
25   * @author Roland Ewald
26   */
27  public interface IProgressObserver {
28  
29    /** Adds additional waypoints to the progress bar. */
30    void addWaypoints(int additionalWayPoints);
31  
32    /** Increments progress to next waypoint and shows new status. */
33    void incrementProgress(String status);
34  
35    /**
36     * Updates progress to given waypoint, displaying the given status.
37     * 
38     * @param waypoint
39     *          the current waypoint
40     * @param status
41     *          the status
42     */
43    void updateProgress(int waypoint, String status);
44  
45    /**
46     * Get the current waypoint
47     * 
48     * @return the current waypoint
49     */
50    int getCurrentWaypoint();
51  
52    /**
53     * Call this method to indicate that the task is finished.
54     */
55    void taskFinished();
56  
57    /**
58     * Can be used to preemptively abort a long-running task.
59     * 
60     * @return true if process has been cancelled by user
61     */
62    boolean isCancelled();
63  
64    /**
65     * Deal with progress display in case the task is cancelled.
66     */
67    void taskCanceled();
68  }