View Javadoc

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  import java.util.EventObject;
23  
24  
25  /**
26   * Event for describing task progress change.
27   *
28   * @author <a href="mailto:ales.pucelj@cosylab.com">Ales Pucelj</a>
29   * @version $id$
30   */
31  public class ProgressEvent extends EventObject
32  {
33  	private static final long serialVersionUID = 1L;
34  	private String status;
35  	private int current;
36  	private int total;
37  
38  	/**
39  	 * Creates new instance of progress change event.
40  	 *
41  	 * @param source ProgressMonitor that has triggered this event.
42  	 * @param status Text description of progress.
43  	 * @param current New progress value.
44  	 * @param total Progress value when completed.
45  	 */
46  	public ProgressEvent(Object source, String status, int current, int total)
47  	{
48  		super(source);
49  		this.status = status;
50  		this.current = current;
51  		this.total = total;
52  	}
53  
54  	/**
55  	 * Returns current value of progress.
56  	 *
57  	 * @return current value of progress.
58  	 */
59  	public int getCurrent()
60  	{
61  		return current;
62  	}
63  
64  	/**
65  	 * Returns status description.
66  	 *
67  	 * @return Textual description of current status.
68  	 */
69  	public String getStatus()
70  	{
71  		return status;
72  	}
73  
74  	/**
75  	 * Returns total ammount.
76  	 *
77  	 * @return total ammount for progress.
78  	 */
79  	public int getTotal()
80  	{
81  		return total;
82  	}
83  }
84  
85  /* __oOo__ */