root / org.gvsig.wfs.app / trunk / org.gvsig.wfs.app / org.gvsig.wfs.app.mainplugin / src / main / java / org / gvsig / wfs / gui / panels / WFSOptionsPanel.java @ 10
History | View | Annotate | Download (20.1 KB)
1 |
package org.gvsig.wfs.gui.panels; |
---|---|
2 |
|
3 |
import java.awt.Component; |
4 |
import java.awt.Dimension; |
5 |
import java.awt.Rectangle; |
6 |
import java.util.Iterator; |
7 |
import java.util.List; |
8 |
import java.util.Vector; |
9 |
|
10 |
import javax.swing.BorderFactory; |
11 |
import javax.swing.JCheckBox; |
12 |
import javax.swing.JComboBox; |
13 |
import javax.swing.JLabel; |
14 |
import javax.swing.JOptionPane; |
15 |
import javax.swing.JPanel; |
16 |
import javax.swing.JPasswordField; |
17 |
import javax.swing.JSpinner; |
18 |
import javax.swing.JTextField; |
19 |
import javax.swing.SpinnerModel; |
20 |
import javax.swing.SpinnerNumberModel; |
21 |
import javax.swing.border.TitledBorder; |
22 |
|
23 |
import org.cresques.cts.IProjection; |
24 |
|
25 |
import org.gvsig.andami.PluginServices; |
26 |
import org.gvsig.app.ApplicationLocator; |
27 |
import org.gvsig.fmap.crs.CRSFactory; |
28 |
import org.gvsig.gui.beans.panelGroup.IPanelGroup; |
29 |
import org.gvsig.i18n.Messages; |
30 |
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeature; |
31 |
|
32 |
|
33 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
34 |
*
|
35 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
36 |
*
|
37 |
* This program is free software; you can redistribute it and/or
|
38 |
* modify it under the terms of the GNU General Public License
|
39 |
* as published by the Free Software Foundation; either version 2
|
40 |
* of the License, or (at your option) any later version.
|
41 |
*
|
42 |
* This program is distributed in the hope that it will be useful,
|
43 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
44 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
45 |
* GNU General Public License for more details.
|
46 |
*
|
47 |
* You should have received a copy of the GNU General Public License
|
48 |
* along with this program; if not, write to the Free Software
|
49 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
50 |
*
|
51 |
* For more information, contact:
|
52 |
*
|
53 |
* Generalitat Valenciana
|
54 |
* Conselleria d'Infraestructures i Transport
|
55 |
* Av. Blasco Ib??ez, 50
|
56 |
* 46010 VALENCIA
|
57 |
* SPAIN
|
58 |
*
|
59 |
* +34 963862235
|
60 |
* gvsig@gva.es
|
61 |
* www.gvsig.gva.es
|
62 |
*
|
63 |
* or
|
64 |
*
|
65 |
* IVER T.I. S.A
|
66 |
* Salamanca 50
|
67 |
* 46005 Valencia
|
68 |
* Spain
|
69 |
*
|
70 |
* +34 963163400
|
71 |
* dac@iver.es
|
72 |
*/
|
73 |
/* CVS MESSAGES:
|
74 |
*
|
75 |
* $Id: WFSOptionsPanel.java 17736 2008-01-02 16:53:48Z ppiqueras $
|
76 |
* $Log$
|
77 |
* Revision 1.12 2007-02-22 12:25:39 ppiqueras
|
78 |
* A?adidas tool tip text y etiqueta para de milisegundos.
|
79 |
*
|
80 |
* Revision 1.11 2006/10/05 12:49:57 jorpiell
|
81 |
* Cambiada la cadena buffer por max_features
|
82 |
*
|
83 |
* Revision 1.10 2006/10/02 09:09:45 jorpiell
|
84 |
* Cambios del 10 copiados al head
|
85 |
*
|
86 |
* Revision 1.9.2.1 2006/09/26 07:36:24 jorpiell
|
87 |
* El WFS no reproyectaba porque no se le asignaba a la capa un sistema de referencia. Ahora ya se hace.
|
88 |
*
|
89 |
* Revision 1.9 2006/09/05 14:25:05 jorpiell
|
90 |
* Eliminado el nombre de usuario y la contrase?a del panel de opciones
|
91 |
*
|
92 |
* Revision 1.8 2006/07/21 11:50:31 jaume
|
93 |
* improved appearance
|
94 |
*
|
95 |
* Revision 1.7 2006/06/22 06:54:14 jorpiell
|
96 |
* Se ha desabilitado el cuadro de di?logo del sistema de referencia
|
97 |
*
|
98 |
* Revision 1.6 2006/06/21 12:35:45 jorpiell
|
99 |
* 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
|
100 |
*
|
101 |
* Revision 1.5 2006/06/15 07:50:58 jorpiell
|
102 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz
|
103 |
*
|
104 |
* Revision 1.4 2006/06/01 15:40:50 jorpiell
|
105 |
* Se ha capturado una excepci?n que saltaba al ejecutar la extensi?n en igl?s provocada por el signo "," que aparece en lo n?meros (en castellano ".").
|
106 |
*
|
107 |
* Revision 1.3 2006/05/23 08:09:39 jorpiell
|
108 |
* 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
|
109 |
*
|
110 |
* Revision 1.2 2006/05/19 12:57:08 jorpiell
|
111 |
* Modificados algunos paneles
|
112 |
*
|
113 |
* Revision 1.1 2006/04/20 16:38:24 jorpiell
|
114 |
* 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().
|
115 |
*
|
116 |
*
|
117 |
*/
|
118 |
|
119 |
/**
|
120 |
* <p>Panel with options about the timeout, maximum number of features, the projection reference system, and
|
121 |
* if it's implemented, user and password.</p>
|
122 |
*
|
123 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
124 |
* @author Pablo Piqueras Bartolom?
|
125 |
*/
|
126 |
public class WFSOptionsPanel extends AbstractWFSPanel { |
127 |
private static final long serialVersionUID = -769956995699452173L; |
128 |
|
129 |
public static final int DEFAULT_TIMEOUT_MILLISECONDS = 20000; |
130 |
|
131 |
private JPanel credentialsPanel = null; |
132 |
private JLabel usernameLabel = null; |
133 |
private JTextField usernameText = null; |
134 |
private JLabel passwordLabel = null; |
135 |
private JPasswordField passwordText = null; |
136 |
private JPanel connectionParamsPanel = null; |
137 |
private JLabel timeoutLabel = null; |
138 |
|
139 |
private JSpinner maxFeaturesSpinner = null; |
140 |
|
141 |
private JLabel bufferLabel = null; |
142 |
private JComboBox timeoutCombo = null; |
143 |
private JPanel formatPanel = null; |
144 |
private JLabel srsLabel = null; |
145 |
private JLabel verLabel = null; |
146 |
// private JTextField srsText = null;
|
147 |
private JComboBox ver_Combo = null; |
148 |
private JPanel versionPanel = null; |
149 |
|
150 |
private JComboBox srsCombo = null; |
151 |
// private JLabel jLabelMiliSeconds = null;
|
152 |
private JPanel bufferPanel = null; |
153 |
private JPanel timeOutPanel = null; |
154 |
private JPanel northPanel = null; |
155 |
//Cache panel
|
156 |
private JPanel cachePanel = null; |
157 |
private JCheckBox enableCacheCheckBox = null; |
158 |
|
159 |
/**
|
160 |
* Creates a new WFS options panel.
|
161 |
*/
|
162 |
public WFSOptionsPanel() {
|
163 |
super();
|
164 |
initialize(); |
165 |
} |
166 |
|
167 |
/**
|
168 |
* This method initializes usernameText
|
169 |
*
|
170 |
* @return javax.swing.JTextField
|
171 |
*/
|
172 |
private JTextField getUsernameText() { |
173 |
if (usernameText == null) { |
174 |
usernameText = new JTextField(); |
175 |
usernameText.setBounds(new java.awt.Rectangle(100,25,200,20)); |
176 |
usernameText.addKeyListener(new java.awt.event.KeyAdapter() {
|
177 |
public void keyTyped(java.awt.event.KeyEvent e) { |
178 |
IPanelGroup panelGroup = getPanelGroup(); |
179 |
|
180 |
if (panelGroup == null) |
181 |
return;
|
182 |
|
183 |
((WFSParamsPanel)panelGroup).setApplicable(true);
|
184 |
} |
185 |
}); |
186 |
} |
187 |
return usernameText;
|
188 |
} |
189 |
|
190 |
/**
|
191 |
* This method initializes passwordText
|
192 |
*
|
193 |
* @return javax.swing.JTextField
|
194 |
*/
|
195 |
private JPasswordField getPasswordText() { |
196 |
if (passwordText == null) { |
197 |
passwordText = new JPasswordField(); |
198 |
passwordText.setBounds(new java.awt.Rectangle(100,50,200,20)); |
199 |
passwordText.addKeyListener(new java.awt.event.KeyAdapter() {
|
200 |
public void keyTyped(java.awt.event.KeyEvent e) { |
201 |
IPanelGroup panelGroup = getPanelGroup(); |
202 |
|
203 |
if (panelGroup == null) |
204 |
return;
|
205 |
|
206 |
((WFSParamsPanel)panelGroup).setApplicable(true);
|
207 |
} |
208 |
}); |
209 |
} |
210 |
return passwordText;
|
211 |
} |
212 |
|
213 |
/**
|
214 |
* This method initializes jPanel
|
215 |
*
|
216 |
* @return javax.swing.JPanel
|
217 |
*/
|
218 |
private JPanel getConnectionParamsPanel() { |
219 |
if (connectionParamsPanel == null) { |
220 |
java.awt.GridBagConstraints gridBagConstraints; |
221 |
|
222 |
bufferPanel = new JPanel(); |
223 |
bufferLabel = new JLabel(); |
224 |
bufferLabel.setText(PluginServices.getText(this, "max_features")); |
225 |
bufferLabel.setPreferredSize(new Dimension(90, 20)); |
226 |
bufferPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
227 |
bufferPanel.add(bufferLabel); |
228 |
bufferPanel.add(getMaxFeatSpinner()); |
229 |
|
230 |
timeOutPanel = new JPanel(); |
231 |
timeoutLabel = new JLabel(); |
232 |
timeoutLabel.setText(PluginServices.getText(this, "timeout")); |
233 |
timeoutLabel.setPreferredSize(new Dimension(90, 20)); |
234 |
timeOutPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
235 |
timeOutPanel.add(timeoutLabel); |
236 |
timeOutPanel.add(getTimeoutCombo()); |
237 |
// timeOutPanel.add(getJLabelMiliSeconds());
|
238 |
|
239 |
connectionParamsPanel = new JPanel(); |
240 |
connectionParamsPanel.setLayout(new java.awt.GridBagLayout());
|
241 |
connectionParamsPanel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "conection"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); |
242 |
|
243 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
244 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
245 |
gridBagConstraints.weightx = 1.0;
|
246 |
connectionParamsPanel.add(bufferPanel, gridBagConstraints); |
247 |
|
248 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
249 |
gridBagConstraints.gridx = 0;
|
250 |
gridBagConstraints.gridy = 1;
|
251 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
252 |
gridBagConstraints.weightx = 1.0;
|
253 |
connectionParamsPanel.add(timeOutPanel, gridBagConstraints); |
254 |
} |
255 |
|
256 |
return connectionParamsPanel;
|
257 |
} |
258 |
|
259 |
private JSpinner getMaxFeatSpinner() { |
260 |
|
261 |
if (maxFeaturesSpinner == null) { |
262 |
SpinnerModel model = new SpinnerNumberModel(10000, 1, 1000000, 1); |
263 |
maxFeaturesSpinner = new JSpinner(model); |
264 |
// maxFeaturesSpinner.setBounds(new Rectangle(100, 25, 100, 20));
|
265 |
} |
266 |
return maxFeaturesSpinner;
|
267 |
} |
268 |
|
269 |
/**
|
270 |
* This method initializes jTextField1
|
271 |
*
|
272 |
* @return javax.swing.JTextField
|
273 |
*/
|
274 |
private JComboBox getTimeoutCombo() { |
275 |
if (timeoutCombo == null) { |
276 |
timeoutCombo = new JComboBox(); |
277 |
timeoutCombo.setEditable(false);
|
278 |
timeoutCombo.addItem("5 sec");
|
279 |
timeoutCombo.addItem("20 sec");
|
280 |
timeoutCombo.addItem("2 min");
|
281 |
timeoutCombo.addItem("10 min");
|
282 |
// timeoutCombo.setBounds(new Rectangle(100, 50, 100, 20));
|
283 |
timeoutCombo.setToolTipText(PluginServices.getText(timeoutCombo, "set_TimeOut_Explanation"));
|
284 |
} |
285 |
return timeoutCombo;
|
286 |
} |
287 |
|
288 |
/**
|
289 |
* Gets the name of the user.
|
290 |
*
|
291 |
* @return name of the user
|
292 |
*/
|
293 |
public String getUserName(){ |
294 |
return getUsernameText().getText();
|
295 |
} |
296 |
|
297 |
public void setUserName(String userName){ |
298 |
getUsernameText().setText(userName); |
299 |
} |
300 |
|
301 |
/**
|
302 |
* Gets the password of the user.
|
303 |
*
|
304 |
* @return password of the user
|
305 |
*/
|
306 |
public String getPassword(){ |
307 |
return getPasswordText().getText();
|
308 |
} |
309 |
|
310 |
public void setPassword(String password){ |
311 |
getPasswordText().setText(password); |
312 |
} |
313 |
|
314 |
/**
|
315 |
* Gets the maximum number of values that can load.
|
316 |
*
|
317 |
* @return the maximum number of values that can load
|
318 |
*/
|
319 |
public int getBuffer(){ |
320 |
try {
|
321 |
Object val = getMaxFeatSpinner().getValue();
|
322 |
return Integer.parseInt(val.toString()); |
323 |
} catch (Exception e) { |
324 |
return 10000; |
325 |
} |
326 |
} |
327 |
|
328 |
public void setBuffer(int buffer){ |
329 |
try {
|
330 |
getMaxFeatSpinner().setValue(buffer); |
331 |
} catch (Exception exc) { |
332 |
ApplicationLocator.getManager().messageDialog( |
333 |
Messages.getText("_Unable_to_show_max_featcount"),
|
334 |
Messages.getText("error"),
|
335 |
JOptionPane.ERROR_MESSAGE);
|
336 |
} |
337 |
} |
338 |
|
339 |
/**
|
340 |
* Gets the timeout used during the loading process.
|
341 |
*
|
342 |
* @return the timeout used during the loading process
|
343 |
*/
|
344 |
public int getTimeout() { |
345 |
|
346 |
String tou = this.getTimeoutCombo().getSelectedItem().toString(); |
347 |
return toMilliseconds(tou);
|
348 |
|
349 |
} |
350 |
|
351 |
public void setTimeOut(int timeOut){ |
352 |
int cnt = this.getTimeoutCombo().getItemCount(); |
353 |
for (int i=0; i<cnt; i++) { |
354 |
String aux = this.getTimeoutCombo().getItemAt(i).toString(); |
355 |
if (timeOut == toMilliseconds(aux)) {
|
356 |
this.getTimeoutCombo().setSelectedIndex(i);
|
357 |
return;
|
358 |
} |
359 |
} |
360 |
this.getTimeoutCombo().setSelectedIndex(1); |
361 |
} |
362 |
|
363 |
|
364 |
private int toMilliseconds(String txt) { |
365 |
|
366 |
try {
|
367 |
String[] tt = txt.split(" "); |
368 |
int aux = Integer.parseInt(tt[0]); |
369 |
if (tt[1].compareToIgnoreCase("min") == 0) { |
370 |
aux = aux * 60;
|
371 |
} |
372 |
return aux * 1000; |
373 |
} catch (Exception ex) { |
374 |
logger.info("Did not parse item. Timeout = " + DEFAULT_TIMEOUT_MILLISECONDS);
|
375 |
return DEFAULT_TIMEOUT_MILLISECONDS;
|
376 |
} |
377 |
} |
378 |
|
379 |
/**
|
380 |
* Gets the reference system of the layer.
|
381 |
*
|
382 |
* @return the reference system of the layer
|
383 |
*/
|
384 |
public String getSRS(){ |
385 |
Object sel = getSrsCombo().getSelectedItem();
|
386 |
if (sel == null) { |
387 |
String msg = Messages.getText("error") |
388 |
+ " (" + Messages.getText("srs") + ")"; |
389 |
ApplicationLocator.getManager().message( |
390 |
msg, |
391 |
JOptionPane.ERROR_MESSAGE);
|
392 |
return ""; |
393 |
} else {
|
394 |
return sel.toString();
|
395 |
} |
396 |
} |
397 |
|
398 |
public void setSRS(String srs){ |
399 |
getSrsCombo().setSelectedItem(srs); |
400 |
} |
401 |
|
402 |
|
403 |
public void setVersion(String str_ver){ |
404 |
getVersionCombo().setSelectedItem(str_ver); |
405 |
} |
406 |
|
407 |
|
408 |
/**
|
409 |
* This method initializes formatPanel
|
410 |
*
|
411 |
* @return javax.swing.JPanel
|
412 |
*/
|
413 |
private JPanel getFormatPanel() { |
414 |
if (formatPanel == null) { |
415 |
formatPanel = new JPanel(); |
416 |
formatPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
417 |
formatPanel.setBorder(BorderFactory.createTitledBorder(null, |
418 |
PluginServices.getText(this, "srs"), |
419 |
TitledBorder.DEFAULT_JUSTIFICATION,
|
420 |
TitledBorder.DEFAULT_POSITION, null, null)); |
421 |
formatPanel.add(getSRSLabel()); |
422 |
formatPanel.add(getSrsCombo()); |
423 |
} |
424 |
return formatPanel;
|
425 |
} |
426 |
|
427 |
/**
|
428 |
* This method initializes srsLabel
|
429 |
*
|
430 |
* @return javax.swing.JLabel
|
431 |
*/
|
432 |
private JLabel getSRSLabel() { |
433 |
if (srsLabel == null) { |
434 |
srsLabel = new JLabel(); |
435 |
srsLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); |
436 |
srsLabel.setText(PluginServices.getText(this, "srs")); |
437 |
srsLabel.setPreferredSize(new Dimension(90, 20)); |
438 |
} |
439 |
|
440 |
return srsLabel;
|
441 |
} |
442 |
|
443 |
private JLabel getVersionLabel() { |
444 |
if (verLabel == null) { |
445 |
verLabel = new JLabel(); |
446 |
verLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); |
447 |
verLabel.setText(PluginServices.getText(this, "_Version")); |
448 |
verLabel.setPreferredSize(new Dimension(90, 20)); |
449 |
} |
450 |
return verLabel;
|
451 |
} |
452 |
|
453 |
|
454 |
/**
|
455 |
* This method initializes srsText
|
456 |
*
|
457 |
* @return javax.swing.JTextField
|
458 |
*/
|
459 |
private JComboBox getSrsCombo() { |
460 |
if (srsCombo == null) { |
461 |
srsCombo = new JComboBox(); |
462 |
// srsCombo.setBounds(new java.awt.Rectangle(110, 25, 100, 20));
|
463 |
srsCombo.setEnabled(true);
|
464 |
srsCombo.setEditable(false);
|
465 |
srsCombo.setToolTipText( |
466 |
PluginServices.getText(srsCombo, "select_Feature_Reference_System"));
|
467 |
} |
468 |
return srsCombo;
|
469 |
} |
470 |
|
471 |
|
472 |
private JComboBox getVersionCombo() { |
473 |
|
474 |
if (ver_Combo == null) { |
475 |
ver_Combo = new JComboBox(); |
476 |
ver_Combo.setEnabled(true);
|
477 |
ver_Combo.setEditable(false);
|
478 |
} |
479 |
return ver_Combo;
|
480 |
} |
481 |
|
482 |
|
483 |
/**
|
484 |
* Refresh the panel
|
485 |
*
|
486 |
* @param feature
|
487 |
*/
|
488 |
public void refresh(WFSSelectedFeature layer) { |
489 |
Vector srs = layer.getSrs();
|
490 |
Iterator iter = srs.iterator();
|
491 |
JComboBox bx = this.getSrsCombo(); |
492 |
bx.removeAllItems(); |
493 |
while (iter.hasNext()) {
|
494 |
bx.addItem(iter.next()); |
495 |
} |
496 |
} |
497 |
|
498 |
public void refreshVersions(List vers) { |
499 |
Iterator iter = vers.iterator();
|
500 |
JComboBox bx = this.getVersionCombo(); |
501 |
bx.removeAllItems(); |
502 |
while (iter.hasNext()) {
|
503 |
bx.addItem(iter.next()); |
504 |
} |
505 |
} |
506 |
|
507 |
|
508 |
/**
|
509 |
* This method initializes jLabelMiliSeconds
|
510 |
*
|
511 |
* @return javax.swing.JLabel
|
512 |
*/
|
513 |
/*
|
514 |
public JLabel getJLabelMiliSeconds() {
|
515 |
if (jLabelMiliSeconds == null) {
|
516 |
jLabelMiliSeconds = new JLabel();
|
517 |
jLabelMiliSeconds.setText(PluginServices.getText(jLabelMiliSeconds, "miliSeconds"));
|
518 |
jLabelMiliSeconds.setBounds(new Rectangle(175, 50, 40, 16));
|
519 |
}
|
520 |
|
521 |
return jLabelMiliSeconds;
|
522 |
}
|
523 |
*/
|
524 |
|
525 |
private JPanel getCachePanel() { |
526 |
if (cachePanel == null) { |
527 |
cachePanel = new JPanel(); |
528 |
cachePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
529 |
cachePanel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "vectorial_cache"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); |
530 |
cachePanel.add(getEnableCacheCheckBox()); |
531 |
} |
532 |
return cachePanel;
|
533 |
} |
534 |
|
535 |
public JCheckBox getEnableCacheCheckBox() { |
536 |
if (enableCacheCheckBox == null) { |
537 |
enableCacheCheckBox = new JCheckBox(); |
538 |
enableCacheCheckBox.setText(PluginServices.getText(null, "enable_cache")); |
539 |
enableCacheCheckBox.setBounds(new Rectangle(175, 50, 40, 16)); |
540 |
} |
541 |
|
542 |
return enableCacheCheckBox;
|
543 |
} |
544 |
|
545 |
/*
|
546 |
* (non-Javadoc)
|
547 |
* @see com.iver.cit.gvsig.gui.panels.AbstractWFSPanel#initialize()
|
548 |
*/
|
549 |
protected void initialize() { |
550 |
setLabel(PluginServices.getText(this, "options")); |
551 |
setLabelGroup(PluginServices.getText(this, "wfs")); |
552 |
this.setLayout(new java.awt.BorderLayout()); |
553 |
java.awt.GridBagConstraints gridBagConstraints; |
554 |
|
555 |
northPanel = new JPanel(); |
556 |
northPanel.setLayout(new java.awt.GridBagLayout());
|
557 |
|
558 |
|
559 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
560 |
gridBagConstraints.gridx = 0;
|
561 |
gridBagConstraints.gridy = 0;
|
562 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
563 |
gridBagConstraints.weightx = 1.0;
|
564 |
northPanel.add(getVersionPanel(), gridBagConstraints); |
565 |
|
566 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
567 |
gridBagConstraints.gridx = 0;
|
568 |
gridBagConstraints.gridy = 1;
|
569 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
570 |
gridBagConstraints.weightx = 1.0;
|
571 |
northPanel.add(getConnectionParamsPanel(), gridBagConstraints); |
572 |
|
573 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
574 |
gridBagConstraints.gridx = 0;
|
575 |
gridBagConstraints.gridy = 2;
|
576 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
577 |
gridBagConstraints.weightx = 1.0;
|
578 |
northPanel.add(getFormatPanel(), gridBagConstraints); |
579 |
|
580 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
581 |
gridBagConstraints.gridx = 0;
|
582 |
gridBagConstraints.gridy = 3;
|
583 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
584 |
gridBagConstraints.weightx = 1.0;
|
585 |
northPanel.add(getCachePanel(), gridBagConstraints); |
586 |
|
587 |
add(northPanel, java.awt.BorderLayout.NORTH); |
588 |
} |
589 |
|
590 |
/**
|
591 |
* @return
|
592 |
*/
|
593 |
private Component getVersionPanel() { |
594 |
if (versionPanel == null) { |
595 |
versionPanel = new JPanel(); |
596 |
versionPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
597 |
versionPanel.setBorder(BorderFactory.createTitledBorder(null, |
598 |
PluginServices.getText(this, "_WFS_protocol_version"), |
599 |
TitledBorder.DEFAULT_JUSTIFICATION,
|
600 |
TitledBorder.DEFAULT_POSITION, null, null)); |
601 |
versionPanel.add(getVersionLabel()); |
602 |
versionPanel.add(getVersionCombo()); |
603 |
} |
604 |
return versionPanel;
|
605 |
} |
606 |
|
607 |
/**
|
608 |
*
|
609 |
* Returns the preferred CRS from a list. This is a utility
|
610 |
* and not very elegant method used until the WFS wizard is able
|
611 |
* to show a combo with the CRSs available in the server.
|
612 |
* Until then, we'll choose the CRS to prevent issues with axis order
|
613 |
*
|
614 |
*
|
615 |
* @param crs_list
|
616 |
* @return
|
617 |
* @deprecated
|
618 |
*/
|
619 |
public static String getAxisOrderPreferredCrs(List crs_list) { |
620 |
|
621 |
if (crs_list == null || crs_list.size() == 0) { |
622 |
return ""; |
623 |
} |
624 |
|
625 |
if (crs_list.size() == 1) { |
626 |
return crs_list.get(0).toString(); |
627 |
} |
628 |
|
629 |
String item = null; |
630 |
IProjection ipro = null;
|
631 |
|
632 |
for (int i=0; i<crs_list.size(); i++) { |
633 |
item = crs_list.get(i).toString(); |
634 |
try {
|
635 |
ipro = CRSFactory.getCRS(item); |
636 |
} catch (Exception ex) { |
637 |
// Unable to parse CRS
|
638 |
ipro = null;
|
639 |
} |
640 |
if (ipro != null && ipro.isProjected()) { |
641 |
// If we find a projected one, return it
|
642 |
return item;
|
643 |
} |
644 |
} |
645 |
// If no CRS found, return first
|
646 |
return crs_list.get(0).toString(); |
647 |
} |
648 |
|
649 |
/**
|
650 |
* @return
|
651 |
*/
|
652 |
public String getVersion() { |
653 |
|
654 |
if (this.ver_Combo != null && |
655 |
this.ver_Combo.getSelectedItem() != null) { |
656 |
String v = this.ver_Combo.getSelectedItem().toString(); |
657 |
return v;
|
658 |
} else {
|
659 |
// this should not happen
|
660 |
return "-"; |
661 |
} |
662 |
|
663 |
} |
664 |
} |