root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / WFSSelectFieldsPanel.java @ 10778
History | View | Annotate | Download (9.65 KB)
1 | 9460 | ppiqueras | package com.iver.cit.gvsig.gui.panels; |
---|---|---|---|
2 | |||
3 | import java.beans.PropertyChangeEvent; |
||
4 | import java.beans.PropertyChangeListener; |
||
5 | import java.util.Vector; |
||
6 | |||
7 | import javax.swing.JPanel; |
||
8 | import javax.swing.JScrollPane; |
||
9 | 10392 | jorpiell | import javax.swing.JTree; |
10 | 9460 | ppiqueras | |
11 | 10392 | jorpiell | import org.gvsig.gui.beans.swing.treeTable.TreeTableModelAdapter; |
12 | 9460 | ppiqueras | import org.gvsig.remoteClient.gml.schemas.XMLElement; |
13 | 10392 | jorpiell | import org.gvsig.remoteClient.gml.types.IXMLType; |
14 | 9460 | ppiqueras | |
15 | import com.iver.andami.PluginServices; |
||
16 | import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
||
17 | 10392 | jorpiell | import com.iver.cit.gvsig.gui.panels.fieldsTree.CheckBoxNode; |
18 | 9460 | ppiqueras | import com.iver.cit.gvsig.gui.panels.fieldsTree.FieldsTreeTable; |
19 | import com.iver.cit.gvsig.gui.panels.fieldsTree.FieldsTreeTableModel; |
||
20 | import com.iver.cit.gvsig.gui.panels.fieldsTree.TreeTableModelWithCheckBoxes; |
||
21 | |||
22 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
23 | *
|
||
24 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
25 | *
|
||
26 | * This program is free software; you can redistribute it and/or
|
||
27 | * modify it under the terms of the GNU General Public License
|
||
28 | * as published by the Free Software Foundation; either version 2
|
||
29 | * of the License, or (at your option) any later version.
|
||
30 | *
|
||
31 | * This program is distributed in the hope that it will be useful,
|
||
32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
34 | * GNU General Public License for more details.
|
||
35 | *
|
||
36 | * You should have received a copy of the GNU General Public License
|
||
37 | * along with this program; if not, write to the Free Software
|
||
38 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
39 | *
|
||
40 | * For more information, contact:
|
||
41 | *
|
||
42 | * Generalitat Valenciana
|
||
43 | * Conselleria d'Infraestructures i Transport
|
||
44 | * Av. Blasco Ib??ez, 50
|
||
45 | * 46010 VALENCIA
|
||
46 | * SPAIN
|
||
47 | *
|
||
48 | * +34 963862235
|
||
49 | * gvsig@gva.es
|
||
50 | * www.gvsig.gva.es
|
||
51 | *
|
||
52 | * or
|
||
53 | *
|
||
54 | * IVER T.I. S.A
|
||
55 | * Salamanca 50
|
||
56 | * 46005 Valencia
|
||
57 | * Spain
|
||
58 | *
|
||
59 | * +34 963163400
|
||
60 | * dac@iver.es
|
||
61 | */
|
||
62 | /* CVS MESSAGES:
|
||
63 | *
|
||
64 | * $Id$
|
||
65 | * $Log$
|
||
66 | 10472 | ppiqueras | * Revision 1.7 2007-02-22 12:24:51 ppiqueras
|
67 | * A?adidas tool tip text.
|
||
68 | *
|
||
69 | * Revision 1.6 2007/02/19 11:44:42 jorpiell
|
||
70 | 10392 | jorpiell | * A?adidos los filtros por ?rea
|
71 | *
|
||
72 | * Revision 1.5 2006/12/26 09:19:52 ppiqueras
|
||
73 | 9460 | ppiqueras | * Cambiado "atttibutes" en todas las aparaciones en atributos, m?todos, clases, paquetes o comentarios por "fields". (S?lo a aquellas que afectan a clases dentro del proyecto extWFS2).
|
74 | *
|
||
75 | * Revision 1.17 2006/12/15 13:58:25 ppiqueras
|
||
76 | * Eliminado un import que sobraba, y reorganizado c?digo
|
||
77 | *
|
||
78 | * Revision 1.16 2006/12/04 08:59:47 ppiqueras
|
||
79 | * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todav?a no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
|
||
80 | *
|
||
81 | * Revision 1.15 2006/11/01 17:29:08 jorpiell
|
||
82 | * Se ha elimiado el nodo virtual de la raiz. Adem?s ya se cargan los valores de un campo complejo en la pesta?a del filtro
|
||
83 | *
|
||
84 | * Revision 1.14 2006/10/31 09:39:18 jorpiell
|
||
85 | * Cambiado el tama?o del panel
|
||
86 | *
|
||
87 | * Revision 1.13 2006/10/27 11:33:19 jorpiell
|
||
88 | * A?adida la treetable con los check box para seleccionar los atributos
|
||
89 | *
|
||
90 | * Revision 1.12 2006/10/24 07:58:14 jorpiell
|
||
91 | * Eliminado el parametro booleano que hac?a que apareciesen mas de una columna en el tree table
|
||
92 | *
|
||
93 | * Revision 1.11 2006/10/24 07:27:56 jorpiell
|
||
94 | * Algunos cambios en el modelo que usa la tabla
|
||
95 | *
|
||
96 | * Revision 1.10 2006/10/10 12:55:06 jorpiell
|
||
97 | * Se ha a?adido el soporte de features complejas
|
||
98 | *
|
||
99 | * Revision 1.9 2006/10/02 09:09:45 jorpiell
|
||
100 | * Cambios del 10 copiados al head
|
||
101 | *
|
||
102 | * Revision 1.7.2.1 2006/09/19 12:28:11 jorpiell
|
||
103 | * Ya no se depende de geotools
|
||
104 | *
|
||
105 | * Revision 1.8 2006/09/18 12:07:31 jorpiell
|
||
106 | * Se ha sustituido geotools por el driver de remoteservices
|
||
107 | *
|
||
108 | * Revision 1.7 2006/09/05 13:01:31 jorpiell
|
||
109 | * Reducido el tama?o de los botones
|
||
110 | *
|
||
111 | * Revision 1.6 2006/07/24 07:30:33 jorpiell
|
||
112 | * Se han eliminado las partes duplicadas y se est? usando el parser de GML de FMAP.
|
||
113 | *
|
||
114 | * Revision 1.5 2006/07/21 11:50:31 jaume
|
||
115 | * improved appearance
|
||
116 | *
|
||
117 | * Revision 1.4 2006/06/21 12:35:45 jorpiell
|
||
118 | * Se ha a?adido la ventana de propiedades. Esto implica a?adir listeners por todos los paneles. Adem?s no se muestra la geomatr?a en la lista de atributos y se muestran ?nicamnete los que se van a descargar
|
||
119 | *
|
||
120 | * Revision 1.3 2006/06/15 07:50:58 jorpiell
|
||
121 | * A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz
|
||
122 | *
|
||
123 | * Revision 1.2 2006/05/26 06:29:42 jorpiell
|
||
124 | * Se ha cambiado el tama?o de los botones. Adem?s, al seleccionar todos los atributos se seleccionan en orden.
|
||
125 | *
|
||
126 | * Revision 1.1 2006/05/25 10:30:13 jorpiell
|
||
127 | * Esta clase se ha renombrado. WFSFields era algo confusa
|
||
128 | *
|
||
129 | * Revision 1.3 2006/05/23 08:09:39 jorpiell
|
||
130 | * Se ha cambiado la forma en la que se leian los valores seleccionados en los paneles y se ha cambiado el comportamiento de los botones
|
||
131 | *
|
||
132 | * Revision 1.2 2006/05/19 12:57:08 jorpiell
|
||
133 | * Modificados algunos paneles
|
||
134 | *
|
||
135 | * Revision 1.1 2006/04/20 16:38:24 jorpiell
|
||
136 | * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
|
||
137 | *
|
||
138 | *
|
||
139 | */
|
||
140 | /**
|
||
141 | * This panel shows the feature fields list
|
||
142 | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
||
143 | * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
|
||
144 | */
|
||
145 | public class WFSSelectFieldsPanel extends JPanel { |
||
146 | private static final long serialVersionUID = 3073243334672620143L; |
||
147 | private JScrollPane fieldsScroll = null; |
||
148 | private FieldsTreeTable fieldsTreeTable = null; |
||
149 | private FieldsTreeTableModel model = null; |
||
150 | private WFSParamsPanel parent = null; |
||
151 | private JPanel treeTablePanel = null; |
||
152 | private boolean fieldsSelectedOfSameLayerHasChanged; |
||
153 | |||
154 | public WFSSelectFieldsPanel(WFSParamsPanel parent){
|
||
155 | super();
|
||
156 | this.parent = parent;
|
||
157 | initialize(); |
||
158 | } |
||
159 | |||
160 | public void initialize(){ |
||
161 | this.setLayout(null); |
||
162 | this.setBounds(10, 5, 481, 427); |
||
163 | this.add(getTreeTablePanel(), null); |
||
164 | fieldsSelectedOfSameLayerHasChanged = false;
|
||
165 | } |
||
166 | |||
167 | /**
|
||
168 | * This method initializes jScrollPane3
|
||
169 | *
|
||
170 | * @return javax.swing.JScrollPane
|
||
171 | */
|
||
172 | private JScrollPane getFieldsScroll() { |
||
173 | if (fieldsScroll == null) { |
||
174 | fieldsScroll = new JScrollPane(); |
||
175 | fieldsScroll.setLocation(new java.awt.Point(6,20)); |
||
176 | fieldsScroll.setSize(new java.awt.Dimension(470,349)); |
||
177 | fieldsScroll.setViewportView(getFieldsTreeTable()); |
||
178 | 10472 | ppiqueras | fieldsScroll.setToolTipText(PluginServices.getText(treeTablePanel, "fields_Selection_Info"));
|
179 | 9460 | ppiqueras | } |
180 | return fieldsScroll;
|
||
181 | } |
||
182 | |||
183 | /**
|
||
184 | * This method initializes lstTemps
|
||
185 | *
|
||
186 | * @return javax.swing.JList
|
||
187 | */
|
||
188 | public FieldsTreeTable getFieldsTreeTable() {
|
||
189 | if (fieldsTreeTable == null) { |
||
190 | model = new TreeTableModelWithCheckBoxes();
|
||
191 | fieldsTreeTable = new FieldsTreeTable(model,this); |
||
192 | fieldsTreeTable.setLocation(new java.awt.Point(7,4)); |
||
193 | fieldsTreeTable.setSize(new java.awt.Dimension(482,302)); |
||
194 | 10472 | ppiqueras | fieldsTreeTable.setToolTipText(PluginServices.getText(treeTablePanel, "fields_Selection_Info"));
|
195 | 9460 | ppiqueras | |
196 | // If user has changed the fields selection in the same layer
|
||
197 | fieldsTreeTable.addPropertyChangeListener(new PropertyChangeListener() { |
||
198 | /*
|
||
199 | * (non-Javadoc)
|
||
200 | * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
|
||
201 | */
|
||
202 | public void propertyChange(PropertyChangeEvent evt) { |
||
203 | // If the selection of the fields of the layer has changed
|
||
204 | if (evt.getPropertyName().compareTo("tableCellEditor") == 0) |
||
205 | { |
||
206 | fieldsSelectedOfSameLayerHasChanged = true;
|
||
207 | } |
||
208 | else if (evt.getPropertyName().compareTo("selectionModel") == 0) { // If the layer has changed |
||
209 | fieldsSelectedOfSameLayerHasChanged = false;
|
||
210 | } |
||
211 | } |
||
212 | }); |
||
213 | } |
||
214 | return fieldsTreeTable;
|
||
215 | } |
||
216 | |||
217 | public void refresh(WFSLayerNode feature){ |
||
218 | setFields(feature); |
||
219 | } |
||
220 | |||
221 | /**
|
||
222 | *
|
||
223 | * @param feature
|
||
224 | */
|
||
225 | private void setFields(WFSLayerNode feature){ |
||
226 | Vector fields = feature.getFields();
|
||
227 | model = new TreeTableModelWithCheckBoxes(fields.get(0)); |
||
228 | fieldsTreeTable.setModel(model); |
||
229 | } |
||
230 | |||
231 | public void setSelectedFields(WFSLayerNode feature){ |
||
232 | Vector selectedFields = feature.getSelectedFields();
|
||
233 | fieldsTreeTable.setSelectedFields(selectedFields); |
||
234 | 10392 | jorpiell | } |
235 | |||
236 | /**
|
||
237 | * Gets the Geometry field name
|
||
238 | * @return
|
||
239 | */
|
||
240 | public String getGeometryFieldName(){ |
||
241 | return getFieldsTreeTable().getGeometryField();
|
||
242 | } |
||
243 | 9460 | ppiqueras | |
244 | /**
|
||
245 | *
|
||
246 | * @return the selected fields.
|
||
247 | */
|
||
248 | public XMLElement[] getSelectedFields(){ |
||
249 | return fieldsTreeTable.getSelectedElements();
|
||
250 | } |
||
251 | |||
252 | /**
|
||
253 | * This method initializes treeTablePanel
|
||
254 | *
|
||
255 | * @return javax.swing.JPanel
|
||
256 | */
|
||
257 | private JPanel getTreeTablePanel() { |
||
258 | if (treeTablePanel == null) { |
||
259 | treeTablePanel = new JPanel(); |
||
260 | treeTablePanel.setLayout(null);
|
||
261 | treeTablePanel.setLocation(new java.awt.Point(7,4)); |
||
262 | treeTablePanel.setSize(new java.awt.Dimension(482,375)); |
||
263 | treeTablePanel.add(getFieldsScroll(), null);
|
||
264 | treeTablePanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
||
265 | null, PluginServices.getText(this, "select_fields"), |
||
266 | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
||
267 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
268 | } |
||
269 | return treeTablePanel;
|
||
270 | } |
||
271 | |||
272 | /**
|
||
273 | * Returns true if user has changed the selection of some field of the same layer; else returns false
|
||
274 | *
|
||
275 | * @return A boolean value
|
||
276 | */
|
||
277 | public boolean getFieldsSelectedOfSameLayerHasChanged() { |
||
278 | return this.fieldsSelectedOfSameLayerHasChanged; |
||
279 | } |
||
280 | |||
281 | /**
|
||
282 | * @param updated The updated to set.
|
||
283 | */
|
||
284 | public void setUpdated(boolean updated) { |
||
285 | parent.isApplicable(updated); |
||
286 | } |
||
287 | |||
288 | /**
|
||
289 | * Resets the value of the field 'fieldsSelectedOfSameLayerHasChanged'
|
||
290 | *
|
||
291 | * @return A boolean value
|
||
292 | */
|
||
293 | public void resetFieldsSelectedOfSameLayerHasChanged() { |
||
294 | this.fieldsSelectedOfSameLayerHasChanged = false; |
||
295 | } |
||
296 | } // @jve:decl-index=0:visual-constraint="10,22" |