1 /* 2 * Copyright (c) 2003-2008 by Cosylab d. d. 3 * 4 * This file is part of CosyBeans-Common. 5 * 6 * CosyBeans-Common is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * CosyBeans-Common is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with CosyBeans-Common. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 package com.cosylab.gui.components; 21 22 /** 23 * Interface defining progress monitoring for long running tasks. This 24 * interface defines listeners to be notified on progress of long running tasks.<br> 25 * Progress is defined as an integer value without any predefined scale. 26 * Implementor will provide maximum ammount (<code>getTotal()</code>) and 27 * periodically update current value. When <code>getCurrent()</code> equals 28 * <code>getTotal()</code> the task is expected to end. 29 * 30 * @author <a href="mailto:ales.pucelj@cosylab.com">Ales Pucelj</a> 31 * @version $Revision: 1.3 $ 32 */ 33 public interface ProgressMonitor 34 { 35 /** 36 * Add progress listener to this object. Listener will be notified about 37 * task start and end and also itermediate progress or interruptions. 38 * 39 * @param listener to add. 40 */ 41 void addProgressListener(ProgressListener listener); 42 43 /** 44 * Returns current progress, value will be between 0 and 45 * <code>getStatus()</code>. 46 * 47 * @return current value of progress. 48 */ 49 int getCurrent(); 50 51 /** 52 * Returns total progress, that is value when this task will be complete. 53 * 54 * @return Total progress. 55 */ 56 int getTotal(); 57 58 /** 59 * Returns description of current task. This text may change at any time to 60 * indicate different phases. 61 * 62 * @return Textual description. 63 */ 64 String getStatus(); 65 66 /** 67 * Removes listener. 68 * 69 * @param listener to remove. 70 */ 71 void removeProgressListener(ProgressListener listener); 72 } 73 74 /* __oOo__ */