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