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