root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / InfoPanel.java @ 4886
History | View | Annotate | Download (11.9 KB)
1 |
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: InfoPanel.java 4886 2006-04-19 12:50:16Z jorpiell $
|
54 |
* $Log$
|
55 |
* Revision 1.1 2006-04-19 12:50:16 jorpiell
|
56 |
* Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
|
57 |
*
|
58 |
*
|
59 |
*/
|
60 |
/**
|
61 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
62 |
*/
|
63 |
public class InfoPanel extends JPanel { |
64 |
private final String bgColor0 = "\"#FEEDD6\""; // light salmon |
65 |
private final String bgColor1 = "\"#EAEAEA\""; // light grey |
66 |
private final String bgColor2 = "\"#F2FEFF\""; // light blue |
67 |
private final String bgColor3 = "\"#FBFFE1\""; // light yellow |
68 |
|
69 |
private final String service_title = PluginServices.getText(this, "service_info"); |
70 |
private final String server = PluginServices.getText(this, "server"); |
71 |
private final String server_type = PluginServices.getText(this, "server_type"); |
72 |
private final String server_abstract = PluginServices.getText(this, "server_abstract"); |
73 |
private final String server_title = PluginServices.getText(this, "server_title"); |
74 |
private final String layers_title = PluginServices.getText(this, "selected_layers"); |
75 |
private final String layer_title = PluginServices.getText(this, "layer_title"); |
76 |
private final String layer_abstract = PluginServices.getText(this, "layer_abstract"); |
77 |
private final String selected_parameters = PluginServices.getText(this, "selected_parameters"); |
78 |
private final String time_title = PluginServices.getText(this, "time"); |
79 |
private final String format_title = PluginServices.getText(this, "format"); |
80 |
private final String srs_title = "CRS"; |
81 |
private final String properties = PluginServices.getText(this, "properties"); |
82 |
private final String layer_name = PluginServices.getText(this, "name"); |
83 |
private JEditorPane editor = null; |
84 |
|
85 |
|
86 |
/**
|
87 |
* Creates a new instance of InfoPanel with double buffer and null layout
|
88 |
*
|
89 |
*/
|
90 |
public InfoPanel() {
|
91 |
super();
|
92 |
setLayout(null);
|
93 |
JScrollPane src = new JScrollPane(); |
94 |
src.setBounds(5, 5, 455, 375); |
95 |
add(src, null);
|
96 |
src.setViewportView(getEditor()); |
97 |
} |
98 |
|
99 |
/**
|
100 |
* This method initializes tblInfo
|
101 |
*
|
102 |
* @return javax.swing.JTable
|
103 |
*/
|
104 |
private JEditorPane getEditor() { |
105 |
if (editor == null) { |
106 |
editor = new JEditorPane(); |
107 |
editor.setEditable(false);
|
108 |
} |
109 |
return editor;
|
110 |
} |
111 |
|
112 |
|
113 |
/**
|
114 |
* Fills the text pane with a data table describing the service and the
|
115 |
* selected settings.
|
116 |
*
|
117 |
* @param WCSWizardData dataSource: connection info
|
118 |
* @param WCSLayer layer: the selected layer
|
119 |
* @param String time: the time value.
|
120 |
* @param String format: the format value
|
121 |
* @param String crs: the CRS value
|
122 |
* @param String parameters: comma-separated key-value string containing the values for the parameters
|
123 |
*/
|
124 |
|
125 |
public void refresh(WFSWizardData dataSource) { |
126 |
|
127 |
String server_text = dataSource.getHost();
|
128 |
String server_type_text = dataSource.getServerType();
|
129 |
String server_title_text = dataSource.getTitle();
|
130 |
String server_abstract_text = dataSource.getAbstract();
|
131 |
String font = "Arial"; |
132 |
|
133 |
if (server_text == null) |
134 |
server_text = "-";
|
135 |
if (server_type_text == null) |
136 |
server_type_text = "-";
|
137 |
if (server_title_text == null) |
138 |
server_title_text = "-";
|
139 |
if (server_abstract_text == null) |
140 |
server_abstract_text = "-";
|
141 |
//
|
142 |
// if (format == null)
|
143 |
// format = PluginServices.getText(this, "none_selected");
|
144 |
// if (crs == null)
|
145 |
// crs = PluginServices.getText(this, "none_selected");
|
146 |
//
|
147 |
String layers_html = ""; |
148 |
// if (layer!=null) {
|
149 |
// String layer_name_text = layer.getName();
|
150 |
//// String time_text = (time==null) ? PluginServices.getText(this, "not_available") : time;//((FMapWMSStyle) selectedStyles.get(i)).title;
|
151 |
// String layer_abstract_text = layer.getDescription();
|
152 |
//String layer_title_text = layer.getTitle();
|
153 |
|
154 |
// if (layer_name_text ==null)
|
155 |
// layer_name_text = "-";
|
156 |
//// if (time_text==null)
|
157 |
//// time_text = "-";
|
158 |
// if (layer_abstract_text==null)
|
159 |
// layer_abstract_text = "-";
|
160 |
// if (layer_title_text == null)
|
161 |
// layer_title_text = "-";
|
162 |
// String layer_html =
|
163 |
// " <tr valign=\"top\">" +
|
164 |
// " <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_name+"</b></font></td>" +
|
165 |
// " <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_name_text+"</font></td>" +
|
166 |
// " </tr>" +
|
167 |
//// " <tr valign=\"top\">" +
|
168 |
//// " <td width=\"119\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\"><b>"+layer_title+"</b></font></td>" +
|
169 |
//// " <td width=\"322\" height=\"18\" bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+layer_title_text+"</font></td>" +
|
170 |
//// " </tr>" +
|
171 |
// " <tr valign=\"top\">" +
|
172 |
// " <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_abstract+"</b></font></td>" +
|
173 |
// " <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_abstract_text+"</font></td>" +
|
174 |
// " </tr>" +
|
175 |
//// " <tr valign=\"top\">" +
|
176 |
//// " <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+time_title+"</b></font></td>" +
|
177 |
//// " <td bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+time_text+"</font></td>" +
|
178 |
//// " </tr>" +
|
179 |
// " <tr>" +
|
180 |
// " </tr>";
|
181 |
// layers_html += layer_html;
|
182 |
// }
|
183 |
// if (!layers_html.equals(""))
|
184 |
// layers_html =
|
185 |
// " <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
186 |
// " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+layers_title+"</font></b></td>" +
|
187 |
// " </tr>" + layers_html;
|
188 |
// String parameter_html = "";
|
189 |
// if (parameters!=null) {
|
190 |
// boolean swap = false;
|
191 |
// String[] myParameters = parameters.split("&");
|
192 |
// for (int i = 0; i < myParameters.length; i++) {
|
193 |
// String color = swap ? bgColor0 : bgColor1;
|
194 |
// String[] parameter = myParameters[i].split("=");
|
195 |
// parameter_html +=
|
196 |
// " <tr valign=\"top\" bgcolor="+color+">" +
|
197 |
// " <td width=\"120\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><b>"+parameter[0]+"</b></td>" +
|
198 |
// " <td width=\"322\" height=\"18\">"+parameter[1]+"</td>" +
|
199 |
// " </tr>";
|
200 |
// swap = !swap;
|
201 |
// }
|
202 |
// parameter_html +=
|
203 |
// " <tr>" +
|
204 |
// " </tr>";
|
205 |
// }
|
206 |
// if (!parameter_html.equals(""))
|
207 |
// parameter_html =
|
208 |
// " <tr valign=\"top\">" +
|
209 |
// " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+selected_parameters+"</font></b></td>" +
|
210 |
// " </tr>" + parameter_html;
|
211 |
//
|
212 |
// String format_html =
|
213 |
// " <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
214 |
// " <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+properties+"</font></b></td>" +
|
215 |
// " </tr>" +
|
216 |
// " <tr valign=\"top\" bgcolor="+bgColor0+">" +
|
217 |
// " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+format_title+"</b></font></td>" +
|
218 |
// " <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+format+"</font></td>" +
|
219 |
// " </tr>" +
|
220 |
// " <tr valign=\"top\" bgcolor="+bgColor1+">" +
|
221 |
// " <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+srs_title+"</font></b></td>" +
|
222 |
// " <td><font face=\""+font+"\" size=\"3\">"+crs+"</font></td>" +
|
223 |
// " </tr>";
|
224 |
//
|
225 |
String html =
|
226 |
"<html>" +
|
227 |
"<body>" +
|
228 |
"<table align=\"center\" width=\"437\" height=\"156\" border=\"0\" cellpadding=\"4\" cellspacing=\"4\">" +
|
229 |
" <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
|
230 |
" <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+service_title+"</font></b></td>" + |
231 |
" </tr>" +
|
232 |
" <tr valign=\"top\" bgcolor="+bgColor0+">" + |
233 |
" <td width=\"92\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server+"</font></b></td>" + |
234 |
" <td width=\"268\"><font face=\""+font+"\" size=\"3\">"+server_text+"</font></td>" + |
235 |
" </tr>" +
|
236 |
" <tr valign=\"top\" bgcolor="+bgColor1+">" + |
237 |
" <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_type+"</b></font></td>" + |
238 |
" <td><font face=\""+font+"\" size=\"3\">"+server_type_text+"</font></td>" + |
239 |
" </tr>" +
|
240 |
" <tr valign=\"top\" bgcolor="+bgColor0+">" + |
241 |
" <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_title+"</b></font></td>" + |
242 |
" <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+server_title_text+"</font></td>" + |
243 |
" </tr>" +
|
244 |
" <tr valign=\"top\" bgcolor="+bgColor1+">" + |
245 |
" <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_abstract+"</font></b></td>" + |
246 |
" <td><font face=\""+font+"\" size=\"3\">"+server_abstract_text+"</font></td>" + |
247 |
" </tr>" +
|
248 |
|
249 |
" <tr>" +
|
250 |
" </tr>" +
|
251 |
// layers_html +
|
252 |
// parameter_html +
|
253 |
// format_html +
|
254 |
"</table>" +
|
255 |
"</body>" +
|
256 |
"</html>";
|
257 |
|
258 |
getEditor().setContentType("text/html");
|
259 |
getEditor().setText(html); |
260 |
} |
261 |
} |