Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / DefaultBean.java @ 40561

History | View | Annotate | Download (3.09 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program 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 this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/* CVS MESSAGES:
25
*
26
* $Id: DefaultBean.java 17327 2007-12-12 07:45:23Z bsanchez $
27
* $Log$
28
* Revision 1.2  2007-08-21 08:38:21  bsanchez
29
* - Quitados warnings en imports innecesarios
30
*
31
* Revision 1.1  2007/08/20 08:34:45  evercher
32
* He fusionado LibUI con LibUIComponents
33
*
34
* Revision 1.4  2006/09/14 08:30:11  cesar
35
* Remove static initialization of gvsig-i18n; it's done in the Messages class now
36
*
37
* Revision 1.3.2.1  2006/09/14 07:55:48  cesar
38
* Remove static initialization of gvsig-i18n; it's done in the Messages class now
39
*
40
* Revision 1.3  2006/08/10 07:33:12  cesar
41
* *** empty log message ***
42
*
43
* Revision 1.2  2006/07/11 12:42:10  cesar
44
* Load properties for libUI
45
*
46
* Revision 1.1  2006/03/22 11:18:29  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.4  2006/02/28 15:25:14  jaume
50
* *** empty log message ***
51
*
52
* Revision 1.2.2.3  2006/01/31 16:25:24  jaume
53
* correcciones de bugs
54
*
55
* Revision 1.3  2006/01/26 16:07:14  jaume
56
* *** empty log message ***
57
*
58
* Revision 1.2.2.1  2006/01/26 12:59:32  jaume
59
* 0.5
60
*
61
* Revision 1.2  2006/01/24 14:36:33  jaume
62
* This is the new version
63
*
64
* Revision 1.1.2.3  2006/01/10 13:11:38  jaume
65
* *** empty log message ***
66
*
67
* Revision 1.1.2.2  2006/01/10 11:33:31  jaume
68
* Time dimension working against Jet Propulsion Laboratory's WMS server
69
*
70
* Revision 1.1.2.1  2005/12/30 08:56:19  jaume
71
* *** empty log message ***
72
*
73
*
74
*/
75
/**
76
 *
77
 */
78
package org.gvsig.gui.beans;
79

    
80
import java.util.ArrayList;
81
import java.util.Iterator;
82

    
83
import javax.swing.JPanel;
84

    
85
import org.gvsig.gui.beans.listeners.BeanListener;
86
/**
87
 * A JPanel with addListener(BeanListener l), removeListener(BeanListener l),
88
 * and callValueChange(Object value) methods for adding and removing listeners,
89
 * and firing BeanValueChange events.
90
 *
91
 * @author jaume
92
 */
93
public abstract class DefaultBean extends JPanel {
94
        ArrayList<BeanListener> listeners = new ArrayList<BeanListener>();
95

    
96
        public void addListener(BeanListener l) {
97
                listeners.add(l);
98
        }
99

    
100
        public void removeListener(BeanListener l) {
101
                listeners.remove(l);
102
        }
103

    
104
        public void callValueChanged(Object value) {
105
                Iterator<BeanListener> i = listeners.iterator();
106

    
107
                while (i.hasNext()) {
108
                        i.next().beanValueChanged(value);
109
                }
110
        }
111
}