Statistics
| Revision:

gvsig-raster / org.gvsig.raster / tags / 2.0.0 / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / grid / filter / DefaultRegistrableFilterListener.java @ 1708

History | View | Annotate | Download (2.76 KB)

1 21 nbrodin
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22
package org.gvsig.raster.impl.grid.filter;
23
24
import java.util.ArrayList;
25
import java.util.EventObject;
26
import java.util.Iterator;
27
28
import javax.swing.JPanel;
29
30
import org.gvsig.fmap.dal.coverage.datastruct.Params;
31 149 nbrodin
import org.gvsig.fmap.dal.coverage.grid.FilterUIListener;
32 21 nbrodin
33
/**
34
 * Clase de la que deben heredar todos los paneles para filtros
35
 * definidos por el usuario. Tiene los m?todos para el registro de listeners
36
 *
37
 * 28/09/2007
38
 * @author Nacho Brodin nachobrodin@gmail.com
39
 */
40 149 nbrodin
public class DefaultRegistrableFilterListener extends JPanel {
41 30 nbrodin
        private static final long           serialVersionUID       = 5528469123516861351L;
42
        private ArrayList<FilterUIListener>
43
                                            actionCommandListeners = new ArrayList<FilterUIListener>();
44
        protected Params                    params                 = null;
45 21 nbrodin
46
        /**
47
         * Borrar el disparador de eventos de los botones.
48
         * @param listener
49
         */
50
        public void removeStateChangedListener(FilterUIListener listener) {
51
                actionCommandListeners.remove(listener);
52
        }
53
54
55
        /**
56
         *
57
         * Ejecuci?n del m?todo actionValuesCompleted en todos los filtros registrados
58
         */
59 149 nbrodin
        public void callStateChanged() {
60 30 nbrodin
                Iterator<FilterUIListener> acIterator = actionCommandListeners.iterator();
61 21 nbrodin
                while (acIterator.hasNext()) {
62
                        FilterUIListener listener = (FilterUIListener) acIterator.next();
63
                        listener.actionValuesCompleted(new EventObject(this));
64
                }
65
        }
66
67
        /**
68
         * A?adir el listener para los paneles definidos por el usuario
69
         * @param listener
70
         */
71
        public void addFilterUIListener(FilterUIListener listener) {
72
                if (!actionCommandListeners.contains(listener))
73
                        actionCommandListeners.add(listener);
74
        }
75
76
        /**
77
         * Obtiene los par?metros cargados por el panel
78
         * @return
79
         */
80
        public Params getParams() {
81
                return params;
82
        }
83 149 nbrodin
84
        /**
85
         * Sets the parameters
86
         * @param params
87
         */
88
        public void setParams(Params params) {
89
                this.params = params;
90
        }
91 21 nbrodin
}