svn-gvsig-desktop / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / WFSInfoPanel.java @ 24753
History | View | Annotate | Download (13.9 KB)
1 | 4911 | jorpiell | package com.iver.cit.gvsig.gui.panels; |
---|---|---|---|
2 | |||
3 | 17593 | jpiera | import java.awt.Graphics; |
4 | 5438 | jorpiell | import java.util.Vector; |
5 | |||
6 | 4911 | jorpiell | import javax.swing.JEditorPane; |
7 | import javax.swing.JScrollPane; |
||
8 | |||
9 | 17736 | ppiqueras | import org.gvsig.gui.beans.panelGroup.IPanelGroup; |
10 | 8018 | jorpiell | import org.gvsig.remoteClient.gml.schemas.XMLElement; |
11 | 9461 | ppiqueras | import org.gvsig.remoteClient.gml.types.IXMLType; |
12 | 5438 | jorpiell | |
13 | 4911 | jorpiell | import com.iver.andami.PluginServices; |
14 | 7323 | jorpiell | import com.iver.cit.gvsig.fmap.drivers.wfs.WFSUtils; |
15 | 4911 | jorpiell | import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
16 | import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
||
17 | |||
18 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
19 | *
|
||
20 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
21 | *
|
||
22 | * This program is free software; you can redistribute it and/or
|
||
23 | * modify it under the terms of the GNU General Public License
|
||
24 | * as published by the Free Software Foundation; either version 2
|
||
25 | * of the License, or (at your option) any later version.
|
||
26 | *
|
||
27 | * This program is distributed in the hope that it will be useful,
|
||
28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
30 | * GNU General Public License for more details.
|
||
31 | *
|
||
32 | * You should have received a copy of the GNU General Public License
|
||
33 | * along with this program; if not, write to the Free Software
|
||
34 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
35 | *
|
||
36 | * For more information, contact:
|
||
37 | *
|
||
38 | * Generalitat Valenciana
|
||
39 | * Conselleria d'Infraestructures i Transport
|
||
40 | * Av. Blasco Ib??ez, 50
|
||
41 | * 46010 VALENCIA
|
||
42 | * SPAIN
|
||
43 | *
|
||
44 | * +34 963862235
|
||
45 | * gvsig@gva.es
|
||
46 | * www.gvsig.gva.es
|
||
47 | *
|
||
48 | * or
|
||
49 | *
|
||
50 | * IVER T.I. S.A
|
||
51 | * Salamanca 50
|
||
52 | * 46005 Valencia
|
||
53 | * Spain
|
||
54 | *
|
||
55 | * +34 963163400
|
||
56 | * dac@iver.es
|
||
57 | */
|
||
58 | /* CVS MESSAGES:
|
||
59 | *
|
||
60 | * $Id$
|
||
61 | * $Log$
|
||
62 | 9461 | ppiqueras | * Revision 1.16 2006-12-26 10:25:37 ppiqueras
|
63 | * Corregidas las dependencias con las nuevas ubicaciones de clases: IXMLType, XMLElement, IXMLComplexType, etc. (en libRemoteServices)
|
||
64 | *
|
||
65 | * Revision 1.15 2006/12/26 09:23:23 ppiqueras
|
||
66 | 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).
|
67 | 9453 | jorpiell | *
|
68 | * Revision 1.13 2006/10/10 12:55:06 jorpiell
|
||
69 | 8018 | jorpiell | * Se ha a?adido el soporte de features complejas
|
70 | *
|
||
71 | * Revision 1.12 2006/10/05 12:49:57 jorpiell
|
||
72 | 7917 | jorpiell | * Cambiada la cadena buffer por max_features
|
73 | *
|
||
74 | * Revision 1.11 2006/10/02 09:09:45 jorpiell
|
||
75 | 7721 | jorpiell | * Cambios del 10 copiados al head
|
76 | *
|
||
77 | * Revision 1.9.2.1 2006/09/19 12:28:11 jorpiell
|
||
78 | * Ya no se depende de geotools
|
||
79 | *
|
||
80 | * Revision 1.10 2006/09/18 12:07:31 jorpiell
|
||
81 | 7323 | jorpiell | * Se ha sustituido geotools por el driver de remoteservices
|
82 | *
|
||
83 | * Revision 1.9 2006/07/24 07:30:33 jorpiell
|
||
84 | 6506 | jorpiell | * Se han eliminado las partes duplicadas y se est? usando el parser de GML de FMAP.
|
85 | *
|
||
86 | * Revision 1.8 2006/07/21 11:50:31 jaume
|
||
87 | 6501 | jaume | * improved appearance
|
88 | *
|
||
89 | * Revision 1.7 2006/06/21 12:35:45 jorpiell
|
||
90 | 5948 | jorpiell | * 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
|
91 | *
|
||
92 | * Revision 1.6 2006/06/15 07:50:58 jorpiell
|
||
93 | 5856 | jorpiell | * A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz
|
94 | *
|
||
95 | * Revision 1.5 2006/05/25 16:22:23 jorpiell
|
||
96 | 5462 | jorpiell | * Cambio para eliminar el namespace de los atributos
|
97 | *
|
||
98 | * Revision 1.4 2006/05/25 16:01:43 jorpiell
|
||
99 | 5454 | jorpiell | * Se ha a?adido la funcionalidad para eliminar el namespace de los tipos de atributos
|
100 | *
|
||
101 | * Revision 1.3 2006/05/25 10:31:06 jorpiell
|
||
102 | 5438 | jorpiell | * Como ha cambiado la forma de mostrar las capas (una tabla, en lugar de una lista), los paneles han tenido que ser modificados
|
103 | *
|
||
104 | * Revision 1.2 2006/05/23 08:09:39 jorpiell
|
||
105 | 5339 | jorpiell | * 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
|
106 | *
|
||
107 | * Revision 1.1 2006/04/20 16:38:24 jorpiell
|
||
108 | 4911 | jorpiell | * 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().
|
109 | *
|
||
110 | * Revision 1.1 2006/04/19 12:50:16 jorpiell
|
||
111 | * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
|
||
112 | *
|
||
113 | *
|
||
114 | */
|
||
115 | 17736 | ppiqueras | |
116 | 4911 | jorpiell | /**
|
117 | 17736 | ppiqueras | * <p>Panel that provides information about the service offered by the WFS server connected.</p>
|
118 | *
|
||
119 | 4911 | jorpiell | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
120 | */
|
||
121 | 17736 | ppiqueras | public class WFSInfoPanel extends AbstractWFSPanel { |
122 | private static final long serialVersionUID = 2605168444543321684L; |
||
123 | |||
124 | 17593 | jpiera | private final String bgColor0 = "\"#FEEDD6\""; // light salmon |
125 | private final String bgColor1 = "\"#EAEAEA\""; // light grey |
||
126 | 17736 | ppiqueras | // private final String bgColor2 = "\"#F2FEFF\""; // light blue
|
127 | 17593 | jpiera | private final String bgColor3 = "\"#FBFFE1\""; // light yellow |
128 | 6501 | jaume | |
129 | 17593 | jpiera | private final String service_title = PluginServices.getText(this, "service_info"); |
130 | private final String server = PluginServices.getText(this, "server"); |
||
131 | private final String server_type = PluginServices.getText(this, "server_type"); |
||
132 | private final String server_abstract = PluginServices.getText(this, "server_abstract"); |
||
133 | private final String server_title = PluginServices.getText(this, "server_title"); |
||
134 | private final String layers_title = PluginServices.getText(this, "selected_layer"); |
||
135 | private final String layer_title = PluginServices.getText(this, "layer_title"); |
||
136 | private final String layer_abstract = PluginServices.getText(this, "layer_abstract"); |
||
137 | private final String options = PluginServices.getText(this, "properties"); |
||
138 | private final String layer_fields = PluginServices.getText(this, "fields"); |
||
139 | private final String layer_name = PluginServices.getText(this, "name"); |
||
140 | private final String timeout = PluginServices.getText(this, "timeout"); |
||
141 | private final String buffer = PluginServices.getText(this, "max_features"); |
||
142 | private final String layer_geometry = PluginServices.getText(this, "geometry"); |
||
143 | private final String layer_srs = PluginServices.getText(this, "srs"); |
||
144 | private JEditorPane editor = null; |
||
145 | 6501 | jaume | |
146 | |||
147 | 17593 | jpiera | /**
|
148 | * Creates a new instance of InfoPanel with double buffer and null layout
|
||
149 | */
|
||
150 | public WFSInfoPanel() {
|
||
151 | super();
|
||
152 | initialize(); |
||
153 | } |
||
154 | |||
155 | 17736 | ppiqueras | /*
|
156 | * (non-Javadoc)
|
||
157 | 17593 | jpiera | * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
|
158 | */
|
||
159 | protected void paintComponent(Graphics g) { |
||
160 | 17736 | ppiqueras | IPanelGroup panelGroup = getPanelGroup(); |
161 | |||
162 | if (panelGroup == null) |
||
163 | return;
|
||
164 | |||
165 | ((WFSParamsPanel)panelGroup).refreshCapabilitiesInfo(); |
||
166 | 17593 | jpiera | super.paintComponent(g);
|
167 | } |
||
168 | |||
169 | /**
|
||
170 | 17736 | ppiqueras | * This method initializes editor
|
171 | 17593 | jpiera | *
|
172 | 17736 | ppiqueras | * @return javax.swing.JEditorPane
|
173 | 17593 | jpiera | */
|
174 | private JEditorPane getEditor() { |
||
175 | if (editor == null) { |
||
176 | editor = new JEditorPane(); |
||
177 | editor.setEditable(false);
|
||
178 | 4911 | jorpiell | } |
179 | 17593 | jpiera | return editor;
|
180 | } |
||
181 | 4911 | jorpiell | |
182 | |||
183 | 17593 | jpiera | /**
|
184 | * Fills the text pane with a data table describing the
|
||
185 | * service and the selected settings.
|
||
186 | *
|
||
187 | * @param WFSWizardData dataSource: connection info
|
||
188 | * @param WFSLayer layer: the selected layer
|
||
189 | */
|
||
190 | public void refresh(WFSLayerNode layer) { |
||
191 | 17736 | ppiqueras | WFSWizardData wizardData = getWizardData(); |
192 | |||
193 | String server_text = wizardData.getHost();
|
||
194 | String server_type_text = wizardData.getServerType();
|
||
195 | String server_title_text = wizardData.getTitle();
|
||
196 | String server_abstract_text = wizardData.getAbstract();
|
||
197 | 17593 | jpiera | String font = "Arial"; |
198 | 6501 | jaume | |
199 | 17593 | jpiera | if (server_text == null) |
200 | server_text = "-";
|
||
201 | if (server_type_text == null) |
||
202 | server_type_text = "-";
|
||
203 | if (server_title_text == null) |
||
204 | server_title_text = "-";
|
||
205 | if (server_abstract_text == null) |
||
206 | server_abstract_text = "-";
|
||
207 | 6501 | jaume | |
208 | 17593 | jpiera | String layers_html = ""; |
209 | if (layer!=null) { |
||
210 | String layer_name_text = layer.getName();
|
||
211 | String layer_abstract_text = layer.getAbstract();
|
||
212 | String layer_title_text = layer.getTitle();
|
||
213 | String layer_fields_text = "-"; |
||
214 | String layer_geometry_text = "-"; |
||
215 | String layer_srs_text = "-"; |
||
216 | 6501 | jaume | |
217 | 17736 | ppiqueras | Vector<Object> fields = layer.getSelectedFields(); |
218 | 17593 | jpiera | layer_fields_text = "";
|
219 | 6501 | jaume | |
220 | 17593 | jpiera | for (int i=0 ; i<fields.size() ; i++){ |
221 | XMLElement field = (XMLElement)fields.get(i); |
||
222 | if (!((field.getEntityType() != null) && (field.getEntityType().getType() == IXMLType.GML_GEOMETRY))){ |
||
223 | layer_fields_text = layer_fields_text + field.getName() + |
||
224 | " (" +
|
||
225 | PluginServices.getText(this,WFSUtils.getFieldType(field.getEntityType())) + ")"; |
||
226 | }else{
|
||
227 | layer_fields_text = layer_fields_text + field.getName(); |
||
228 | } |
||
229 | if (i < fields.size() -1){ |
||
230 | layer_fields_text = layer_fields_text + ", ";
|
||
231 | } |
||
232 | } |
||
233 | 6501 | jaume | |
234 | 17593 | jpiera | layer_geometry_text = PluginServices.getText(this,WFSUtils.getGeometry(layer));
|
235 | if (layer_geometry_text.equals("")){ |
||
236 | layer_geometry_text = "-";
|
||
237 | } |
||
238 | 6501 | jaume | |
239 | 17593 | jpiera | if (layer.getSrs().size() > 0){ |
240 | layer_srs_text = (String)layer.getSrs().get(0); |
||
241 | } |
||
242 | 6501 | jaume | |
243 | 17593 | jpiera | if (layer_name_text ==null) |
244 | layer_name_text = "-";
|
||
245 | if (layer_abstract_text==null) |
||
246 | layer_abstract_text = "-";
|
||
247 | if (layer_title_text == null) |
||
248 | layer_title_text = "-";
|
||
249 | String layer_html =
|
||
250 | " <tr valign=\"top\">" +
|
||
251 | " <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_name+"</b></font></td>" + |
||
252 | " <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_name_text+"</font></td>" + |
||
253 | " </tr>" +
|
||
254 | " <tr valign=\"top\">" +
|
||
255 | " <td width=\"119\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\"><b>"+layer_title+"</b></font></td>" + |
||
256 | " <td width=\"322\" height=\"18\" bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+layer_title_text+"</font></td>" + |
||
257 | " </tr>" +
|
||
258 | " <tr valign=\"top\">" +
|
||
259 | " <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_abstract+"</b></font></td>" + |
||
260 | " <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_abstract_text+"</font></td>" + |
||
261 | " </tr>" +
|
||
262 | " <tr valign=\"top\">" +
|
||
263 | " <td width=\"119\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\"><b>"+layer_geometry+"</b></font></td>" + |
||
264 | " <td width=\"322\" height=\"18\" bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+layer_geometry_text+"</font></td>" + |
||
265 | " </tr>" +
|
||
266 | " <tr valign=\"top\">" +
|
||
267 | " <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_fields+"</b></font></td>" + |
||
268 | " <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_fields_text+"</font></td>" + |
||
269 | " </tr>" +
|
||
270 | " <tr valign=\"top\">" +
|
||
271 | " <td width=\"119\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\"><b>"+layer_srs+"</b></font></td>" + |
||
272 | " <td width=\"322\" height=\"18\" bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+layer_srs_text+"</font></td>" + |
||
273 | " </tr>" +
|
||
274 | " <tr>" +
|
||
275 | " </tr>";
|
||
276 | layers_html += layer_html; |
||
277 | } |
||
278 | if (!layers_html.equals("")) |
||
279 | layers_html = |
||
280 | " <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
||
281 | " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+layers_title+"</font></b></td>" + |
||
282 | " </tr>" + layers_html;
|
||
283 | 6501 | jaume | |
284 | 17736 | ppiqueras | String buffer_text = String.valueOf(wizardData.getBuffer()); |
285 | String timeout_text = String.valueOf(wizardData.getTimeOut()); |
||
286 | 6501 | jaume | |
287 | 17593 | jpiera | String options_html =
|
288 | " <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
||
289 | " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+options+"</font></b></td>" + |
||
290 | " </tr>" +
|
||
291 | " <tr valign=\"top\" bgcolor="+bgColor0+">" + |
||
292 | " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+timeout+"</b></font></td>" + |
||
293 | " <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+timeout_text+"</font></td>" + |
||
294 | " </tr>" +
|
||
295 | " <tr valign=\"top\" bgcolor="+bgColor1+">" + |
||
296 | " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+buffer+"</font></b></td>" + |
||
297 | " <td><font face=\""+font+"\" size=\"3\">"+buffer_text+"</font></td>" + |
||
298 | " </tr>";
|
||
299 | 6501 | jaume | |
300 | 17593 | jpiera | String html =
|
301 | "<html>" +
|
||
302 | "<body>" +
|
||
303 | "<table align=\"center\" width=\"437\" height=\"156\" border=\"0\" cellpadding=\"4\" cellspacing=\"4\">" +
|
||
304 | " <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
||
305 | " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+service_title+"</font></b></td>" + |
||
306 | " </tr>" +
|
||
307 | " <tr valign=\"top\" bgcolor="+bgColor0+">" + |
||
308 | " <td width=\"92\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server+"</font></b></td>" + |
||
309 | " <td width=\"268\"><font face=\""+font+"\" size=\"3\">"+server_text+"</font></td>" + |
||
310 | " </tr>" +
|
||
311 | " <tr valign=\"top\" bgcolor="+bgColor1+">" + |
||
312 | " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_type+"</b></font></td>" + |
||
313 | " <td><font face=\""+font+"\" size=\"3\">"+server_type_text+"</font></td>" + |
||
314 | " </tr>" +
|
||
315 | " <tr valign=\"top\" bgcolor="+bgColor0+">" + |
||
316 | " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_title+"</b></font></td>" + |
||
317 | " <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+server_title_text+"</font></td>" + |
||
318 | " </tr>" +
|
||
319 | " <tr valign=\"top\" bgcolor="+bgColor1+">" + |
||
320 | " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_abstract+"</font></b></td>" + |
||
321 | " <td><font face=\""+font+"\" size=\"3\">"+server_abstract_text+"</font></td>" + |
||
322 | " </tr>" +
|
||
323 | 6501 | jaume | |
324 | 17593 | jpiera | " <tr>" +
|
325 | " </tr>" +
|
||
326 | layers_html + |
||
327 | options_html + |
||
328 | "</table>" +
|
||
329 | "</body>" +
|
||
330 | "</html>";
|
||
331 | 6501 | jaume | |
332 | 17593 | jpiera | getEditor().setContentType("text/html");
|
333 | getEditor().setText(html); |
||
334 | } |
||
335 | 6501 | jaume | |
336 | 17736 | ppiqueras | /*
|
337 | * (non-Javadoc)
|
||
338 | * @see com.iver.cit.gvsig.gui.panels.AbstractWFSPanel#initialize()
|
||
339 | */
|
||
340 | 17593 | jpiera | protected void initialize() { |
341 | setLabel(PluginServices.getText(this, "info")); |
||
342 | setLabelGroup(PluginServices.getText(this, "wfs")); |
||
343 | setLayout(null);
|
||
344 | JScrollPane src = new JScrollPane(); |
||
345 | 17736 | ppiqueras | src.setBounds(5, 5, 487, 387); |
346 | 17593 | jpiera | add(src, null);
|
347 | src.setViewportView(getEditor()); |
||
348 | } |
||
349 | 4911 | jorpiell | } |