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