root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / WFSInfoPanel.java @ 4911
History | View | Annotate | Download (11.1 KB)
1 | 4911 | jorpiell | package com.iver.cit.gvsig.gui.panels; |
---|---|---|---|
2 | |||
3 | import javax.swing.JEditorPane; |
||
4 | import javax.swing.JPanel; |
||
5 | import javax.swing.JScrollPane; |
||
6 | |||
7 | import com.iver.andami.PluginServices; |
||
8 | import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
||
9 | import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
||
10 | |||
11 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
12 | *
|
||
13 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
14 | *
|
||
15 | * This program is free software; you can redistribute it and/or
|
||
16 | * modify it under the terms of the GNU General Public License
|
||
17 | * as published by the Free Software Foundation; either version 2
|
||
18 | * of the License, or (at your option) any later version.
|
||
19 | *
|
||
20 | * This program is distributed in the hope that it will be useful,
|
||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
23 | * GNU General Public License for more details.
|
||
24 | *
|
||
25 | * You should have received a copy of the GNU General Public License
|
||
26 | * along with this program; if not, write to the Free Software
|
||
27 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
28 | *
|
||
29 | * For more information, contact:
|
||
30 | *
|
||
31 | * Generalitat Valenciana
|
||
32 | * Conselleria d'Infraestructures i Transport
|
||
33 | * Av. Blasco Ib??ez, 50
|
||
34 | * 46010 VALENCIA
|
||
35 | * SPAIN
|
||
36 | *
|
||
37 | * +34 963862235
|
||
38 | * gvsig@gva.es
|
||
39 | * www.gvsig.gva.es
|
||
40 | *
|
||
41 | * or
|
||
42 | *
|
||
43 | * IVER T.I. S.A
|
||
44 | * Salamanca 50
|
||
45 | * 46005 Valencia
|
||
46 | * Spain
|
||
47 | *
|
||
48 | * +34 963163400
|
||
49 | * dac@iver.es
|
||
50 | */
|
||
51 | /* CVS MESSAGES:
|
||
52 | *
|
||
53 | * $Id$
|
||
54 | * $Log$
|
||
55 | * Revision 1.1 2006-04-20 16:38:24 jorpiell
|
||
56 | * 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().
|
||
57 | *
|
||
58 | * Revision 1.1 2006/04/19 12:50:16 jorpiell
|
||
59 | * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
|
||
60 | *
|
||
61 | *
|
||
62 | */
|
||
63 | /**
|
||
64 | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
||
65 | */
|
||
66 | public class WFSInfoPanel extends JPanel { |
||
67 | private final String bgColor0 = "\"#FEEDD6\""; // light salmon |
||
68 | private final String bgColor1 = "\"#EAEAEA\""; // light grey |
||
69 | private final String bgColor2 = "\"#F2FEFF\""; // light blue |
||
70 | private final String bgColor3 = "\"#FBFFE1\""; // light yellow |
||
71 | |||
72 | private final String service_title = PluginServices.getText(this, "service_info"); |
||
73 | private final String server = PluginServices.getText(this, "server"); |
||
74 | private final String server_type = PluginServices.getText(this, "server_type"); |
||
75 | private final String server_abstract = PluginServices.getText(this, "server_abstract"); |
||
76 | private final String server_title = PluginServices.getText(this, "server_title"); |
||
77 | private final String layers_title = PluginServices.getText(this, "selected_layers"); |
||
78 | private final String layer_title = PluginServices.getText(this, "layer_title"); |
||
79 | private final String layer_abstract = PluginServices.getText(this, "layer_abstract"); |
||
80 | private final String selected_parameters = PluginServices.getText(this, "selected_parameters"); |
||
81 | private final String time_title = PluginServices.getText(this, "time"); |
||
82 | private final String format_title = PluginServices.getText(this, "format"); |
||
83 | private final String srs_title = "CRS"; |
||
84 | private final String properties = PluginServices.getText(this, "properties"); |
||
85 | private final String layer_name = PluginServices.getText(this, "name"); |
||
86 | private JEditorPane editor = null; |
||
87 | |||
88 | |||
89 | /**
|
||
90 | * Creates a new instance of InfoPanel with double buffer and null layout
|
||
91 | *
|
||
92 | */
|
||
93 | public WFSInfoPanel() {
|
||
94 | super();
|
||
95 | setLayout(null);
|
||
96 | JScrollPane src = new JScrollPane(); |
||
97 | src.setBounds(5, 5, 455, 375); |
||
98 | add(src, null);
|
||
99 | src.setViewportView(getEditor()); |
||
100 | } |
||
101 | |||
102 | /**
|
||
103 | * This method initializes tblInfo
|
||
104 | *
|
||
105 | * @return javax.swing.JTable
|
||
106 | */
|
||
107 | private JEditorPane getEditor() { |
||
108 | if (editor == null) { |
||
109 | editor = new JEditorPane(); |
||
110 | editor.setEditable(false);
|
||
111 | } |
||
112 | return editor;
|
||
113 | } |
||
114 | |||
115 | |||
116 | /**
|
||
117 | * Fills the text pane with a data table describing the
|
||
118 | * service and the selected settings.
|
||
119 | *
|
||
120 | * @param WFSWizardData dataSource: connection info
|
||
121 | * @param WFSLayer layer: the selected layer
|
||
122 | */
|
||
123 | |||
124 | public void refresh(WFSWizardData dataSource,WFSLayerNode layer) { |
||
125 | |||
126 | String server_text = dataSource.getHost();
|
||
127 | String server_type_text = dataSource.getServerType();
|
||
128 | String server_title_text = dataSource.getTitle();
|
||
129 | String server_abstract_text = dataSource.getAbstract();
|
||
130 | String font = "Arial"; |
||
131 | |||
132 | if (server_text == null) |
||
133 | server_text = "-";
|
||
134 | if (server_type_text == null) |
||
135 | server_type_text = "-";
|
||
136 | if (server_title_text == null) |
||
137 | server_title_text = "-";
|
||
138 | if (server_abstract_text == null) |
||
139 | server_abstract_text = "-";
|
||
140 | |||
141 | String layers_html = ""; |
||
142 | if (layer!=null) { |
||
143 | String layer_name_text = layer.getName();
|
||
144 | String layer_abstract_text = layer.getAbstract();
|
||
145 | String layer_title_text = layer.getTitle();
|
||
146 | |||
147 | if (layer_name_text ==null) |
||
148 | layer_name_text = "-";
|
||
149 | if (layer_abstract_text==null) |
||
150 | layer_abstract_text = "-";
|
||
151 | if (layer_title_text == null) |
||
152 | layer_title_text = "-";
|
||
153 | String layer_html =
|
||
154 | " <tr valign=\"top\">" +
|
||
155 | " <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_name+"</b></font></td>" + |
||
156 | " <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_name_text+"</font></td>" + |
||
157 | " </tr>" +
|
||
158 | " <tr valign=\"top\">" +
|
||
159 | " <td width=\"119\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\"><b>"+layer_title+"</b></font></td>" + |
||
160 | " <td width=\"322\" height=\"18\" bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+layer_title_text+"</font></td>" + |
||
161 | " </tr>" +
|
||
162 | " <tr valign=\"top\">" +
|
||
163 | " <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_abstract+"</b></font></td>" + |
||
164 | " <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_abstract_text+"</font></td>" + |
||
165 | " </tr>" +
|
||
166 | " <tr>" +
|
||
167 | " </tr>";
|
||
168 | layers_html += layer_html; |
||
169 | } |
||
170 | if (!layers_html.equals("")) |
||
171 | layers_html = |
||
172 | " <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
||
173 | " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+layers_title+"</font></b></td>" + |
||
174 | " </tr>" + layers_html;
|
||
175 | // String parameter_html = "";
|
||
176 | // if (parameters!=null) {
|
||
177 | // boolean swap = false;
|
||
178 | // String[] myParameters = parameters.split("&");
|
||
179 | // for (int i = 0; i < myParameters.length; i++) {
|
||
180 | // String color = swap ? bgColor0 : bgColor1;
|
||
181 | // String[] parameter = myParameters[i].split("=");
|
||
182 | // parameter_html +=
|
||
183 | // " <tr valign=\"top\" bgcolor="+color+">" +
|
||
184 | // " <td width=\"120\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><b>"+parameter[0]+"</b></td>" +
|
||
185 | // " <td width=\"322\" height=\"18\">"+parameter[1]+"</td>" +
|
||
186 | // " </tr>";
|
||
187 | // swap = !swap;
|
||
188 | // }
|
||
189 | // parameter_html +=
|
||
190 | // " <tr>" +
|
||
191 | // " </tr>";
|
||
192 | // }
|
||
193 | // if (!parameter_html.equals(""))
|
||
194 | // parameter_html =
|
||
195 | // " <tr valign=\"top\">" +
|
||
196 | // " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+selected_parameters+"</font></b></td>" +
|
||
197 | // " </tr>" + parameter_html;
|
||
198 | //
|
||
199 | // String format_html =
|
||
200 | // " <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
||
201 | // " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+properties+"</font></b></td>" +
|
||
202 | // " </tr>" +
|
||
203 | // " <tr valign=\"top\" bgcolor="+bgColor0+">" +
|
||
204 | // " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+format_title+"</b></font></td>" +
|
||
205 | // " <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+format+"</font></td>" +
|
||
206 | // " </tr>" +
|
||
207 | // " <tr valign=\"top\" bgcolor="+bgColor1+">" +
|
||
208 | // " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+srs_title+"</font></b></td>" +
|
||
209 | // " <td><font face=\""+font+"\" size=\"3\">"+crs+"</font></td>" +
|
||
210 | // " </tr>";
|
||
211 | //
|
||
212 | String html =
|
||
213 | "<html>" +
|
||
214 | "<body>" +
|
||
215 | "<table align=\"center\" width=\"437\" height=\"156\" border=\"0\" cellpadding=\"4\" cellspacing=\"4\">" +
|
||
216 | " <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
||
217 | " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+service_title+"</font></b></td>" + |
||
218 | " </tr>" +
|
||
219 | " <tr valign=\"top\" bgcolor="+bgColor0+">" + |
||
220 | " <td width=\"92\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server+"</font></b></td>" + |
||
221 | " <td width=\"268\"><font face=\""+font+"\" size=\"3\">"+server_text+"</font></td>" + |
||
222 | " </tr>" +
|
||
223 | " <tr valign=\"top\" bgcolor="+bgColor1+">" + |
||
224 | " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_type+"</b></font></td>" + |
||
225 | " <td><font face=\""+font+"\" size=\"3\">"+server_type_text+"</font></td>" + |
||
226 | " </tr>" +
|
||
227 | " <tr valign=\"top\" bgcolor="+bgColor0+">" + |
||
228 | " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_title+"</b></font></td>" + |
||
229 | " <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+server_title_text+"</font></td>" + |
||
230 | " </tr>" +
|
||
231 | " <tr valign=\"top\" bgcolor="+bgColor1+">" + |
||
232 | " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_abstract+"</font></b></td>" + |
||
233 | " <td><font face=\""+font+"\" size=\"3\">"+server_abstract_text+"</font></td>" + |
||
234 | " </tr>" +
|
||
235 | |||
236 | " <tr>" +
|
||
237 | " </tr>" +
|
||
238 | layers_html + |
||
239 | // parameter_html +
|
||
240 | // format_html +
|
||
241 | "</table>" +
|
||
242 | "</body>" +
|
||
243 | "</html>";
|
||
244 | |||
245 | getEditor().setContentType("text/html");
|
||
246 | getEditor().setText(html); |
||
247 | } |
||
248 | } |