Statistics
| Revision:

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 @ 132

History | View | Annotate | Download (22.2 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.awt.event.ActionEvent;
7
import java.awt.event.ActionListener;
8
import java.util.Iterator;
9
import java.util.List;
10
import java.util.Vector;
11

    
12
import javax.swing.BorderFactory;
13
import javax.swing.JCheckBox;
14
import javax.swing.JComboBox;
15
import javax.swing.JLabel;
16
import javax.swing.JOptionPane;
17
import javax.swing.JPanel;
18
import javax.swing.JPasswordField;
19
import javax.swing.JSpinner;
20
import javax.swing.JTextField;
21
import javax.swing.SpinnerModel;
22
import javax.swing.SpinnerNumberModel;
23
import javax.swing.border.TitledBorder;
24
import org.apache.commons.lang3.StringUtils;
25

    
26
import org.cresques.cts.IProjection;
27

    
28
import org.gvsig.andami.PluginServices;
29
import org.gvsig.app.ApplicationLocator;
30
import org.gvsig.fmap.crs.CRSFactory;
31
import org.gvsig.gui.beans.panelGroup.IPanelGroup;
32
import org.gvsig.i18n.Messages;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.i18n.I18nManager;
35
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeature;
36

    
37

    
38
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
39
 *
40
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
41
 *
42
 * This program is free software; you can redistribute it and/or
43
 * modify it under the terms of the GNU General Public License
44
 * as published by the Free Software Foundation; either version 2
45
 * of the License, or (at your option) any later version.
46
 *
47
 * This program is distributed in the hope that it will be useful,
48
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
49
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
50
 * GNU General Public License for more details.
51
 *
52
 * You should have received a copy of the GNU General Public License
53
 * along with this program; if not, write to the Free Software
54
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
55
 *
56
 */
57
/**
58
 * <p>
59
 * Panel with options about the timeout, maximum number of features, the
60
 * projection reference system, and if it's implemented, user and password.</p>
61
 *
62
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
63
 * @author Pablo Piqueras Bartolom?
64
 */
65
public class WFSOptionsPanel extends AbstractWFSPanel {
66

    
67
    private static final long serialVersionUID = -769956995699452173L;
68

    
69
    public static final int DEFAULT_TIMEOUT_MILLISECONDS = 20000;
70

    
71
    private JPanel credentialsPanel = null;
72
    private JLabel usernameLabel = null;
73
    private JTextField usernameText = null;
74
    private JLabel passwordLabel = null;
75
    private JPasswordField passwordText = null;
76
    private JPanel connectionParamsPanel = null;
77
    private JLabel timeoutLabel = null;
78

    
79
    private JSpinner maxFeaturesSpinner = null;
80

    
81
    private JLabel bufferLabel = null;
82
    private JComboBox timeoutCombo = null;
83
    private JPanel formatPanel = null;
84
    private JLabel srsLabel = null;
85
    private JLabel verLabel = null;
86
    // private JTextField srsText = null;
87
    private JComboBox ver_Combo = null;
88
    private JPanel versionPanel = null;
89

    
90
    private JComboBox srsCombo = null;
91
    // private JLabel jLabelMiliSeconds = null;
92
    private JPanel bufferPanel = null;
93
    private JPanel timeOutPanel = null;
94
    private JPanel northPanel = null;
95
    //Cache panel
96
    private JPanel cachePanel = null;
97
    private JCheckBox enableCacheCheckBox = null;
98
    private JPanel axisOrderPanel;
99
    private JCheckBox axisOrderYXCheckBox;
100

    
101
    /**
102
     * Creates a new WFS options panel.
103
     */
104
    public WFSOptionsPanel() {
105
        super();
106
        initialize();
107
    }
108

    
109
    /**
110
     * This method initializes usernameText
111
     *
112
     * @return javax.swing.JTextField
113
     */
114
    private JTextField getUsernameText() {
115
        if (usernameText == null) {
116
            usernameText = new JTextField();
117
            usernameText.setBounds(new java.awt.Rectangle(100, 25, 200, 20));
118
            usernameText.addKeyListener(new java.awt.event.KeyAdapter() {
119
                public void keyTyped(java.awt.event.KeyEvent e) {
120
                    IPanelGroup panelGroup = getPanelGroup();
121

    
122
                    if (panelGroup == null) {
123
                        return;
124
                    }
125

    
126
                    ((WFSParamsPanel) panelGroup).setApplicable(true);
127
                }
128
            });
129
        }
130
        return usernameText;
131
    }
132

    
133
    /**
134
     * This method initializes passwordText
135
     *
136
     * @return javax.swing.JTextField
137
     */
138
    private JPasswordField getPasswordText() {
139
        if (passwordText == null) {
140
            passwordText = new JPasswordField();
141
            passwordText.setBounds(new java.awt.Rectangle(100, 50, 200, 20));
142
            passwordText.addKeyListener(new java.awt.event.KeyAdapter() {
143
                public void keyTyped(java.awt.event.KeyEvent e) {
144
                    IPanelGroup panelGroup = getPanelGroup();
145

    
146
                    if (panelGroup == null) {
147
                        return;
148
                    }
149

    
150
                    ((WFSParamsPanel) panelGroup).setApplicable(true);
151
                }
152
            });
153
        }
154
        return passwordText;
155
    }
156

    
157
    /**
158
     * This method initializes jPanel
159
     *
160
     * @return javax.swing.JPanel
161
     */
162
    private JPanel getConnectionParamsPanel() {
163
        if (connectionParamsPanel == null) {
164
            java.awt.GridBagConstraints gridBagConstraints;
165

    
166
            bufferPanel = new JPanel();
167
            bufferLabel = new JLabel();
168
            bufferLabel.setText(PluginServices.getText(null, "max_features"));
169
            bufferLabel.setPreferredSize(new Dimension(90, 20));
170
            bufferPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
171
            bufferPanel.add(bufferLabel);
172
            bufferPanel.add(getMaxFeatSpinner());
173

    
174
            timeOutPanel = new JPanel();
175
            timeoutLabel = new JLabel();
176
            timeoutLabel.setText(PluginServices.getText(null, "timeout"));
177
            timeoutLabel.setPreferredSize(new Dimension(90, 20));
178
            timeOutPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
179
            timeOutPanel.add(timeoutLabel);
180
            timeOutPanel.add(getTimeoutCombo());
181
            // timeOutPanel.add(getJLabelMiliSeconds());
182

    
183
            connectionParamsPanel = new JPanel();
184
            connectionParamsPanel.setLayout(new java.awt.GridBagLayout());
185
            connectionParamsPanel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "conection"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
186

    
187
            gridBagConstraints = new java.awt.GridBagConstraints();
188
            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
189
            gridBagConstraints.weightx = 1.0;
190
            connectionParamsPanel.add(bufferPanel, gridBagConstraints);
191

    
192
            gridBagConstraints = new java.awt.GridBagConstraints();
193
            gridBagConstraints.gridx = 0;
194
            gridBagConstraints.gridy = 1;
195
            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
196
            gridBagConstraints.weightx = 1.0;
197
            connectionParamsPanel.add(timeOutPanel, gridBagConstraints);
198
        }
199

    
200
        return connectionParamsPanel;
201
    }
202

    
203
    private JSpinner getMaxFeatSpinner() {
204

    
205
        if (maxFeaturesSpinner == null) {
206
            SpinnerModel model = new SpinnerNumberModel(10000, 1, 1000000, 1);
207
            maxFeaturesSpinner = new JSpinner(model);
208
            // maxFeaturesSpinner.setBounds(new Rectangle(100, 25, 100, 20));
209
        }
210
        return maxFeaturesSpinner;
211
    }
212

    
213
    /**
214
     * This method initializes jTextField1
215
     *
216
     * @return javax.swing.JTextField
217
     */
218
    private JComboBox getTimeoutCombo() {
219
        if (timeoutCombo == null) {
220
            timeoutCombo = new JComboBox();
221
            timeoutCombo.setEditable(false);
222
            timeoutCombo.addItem("5 sec");
223
            timeoutCombo.addItem("20 sec");
224
            timeoutCombo.addItem("2 min");
225
            timeoutCombo.addItem("10 min");
226
            // timeoutCombo.setBounds(new Rectangle(100, 50, 100, 20));
227
            timeoutCombo.setToolTipText(PluginServices.getText(timeoutCombo, "set_TimeOut_Explanation"));
228
        }
229
        return timeoutCombo;
230
    }
231

    
232
    /**
233
     * Gets the name of the user.
234
     *
235
     * @return name of the user
236
     */
237
    public String getUserName() {
238
        return getUsernameText().getText();
239
    }
240

    
241
    public void setUserName(String userName) {
242
        getUsernameText().setText(userName);
243
    }
244

    
245
    /**
246
     * Gets the password of the user.
247
     *
248
     * @return password of the user
249
     */
250
    public String getPassword() {
251
        return getPasswordText().getText();
252
    }
253

    
254
    public void setPassword(String password) {
255
        getPasswordText().setText(password);
256
    }
257

    
258
    /**
259
     * Gets the maximum number of values that can load.
260
     *
261
     * @return the maximum number of values that can load
262
     */
263
    public int getBuffer() {
264
        try {
265
            Object val = getMaxFeatSpinner().getValue();
266
            return Integer.parseInt(val.toString());
267
        } catch (Exception e) {
268
            return 10000;
269
        }
270
    }
271

    
272
    public void setBuffer(int buffer) {
273
        try {
274
            getMaxFeatSpinner().setValue(buffer);
275
        } catch (Exception exc) {
276
            ApplicationLocator.getManager().messageDialog(
277
                    Messages.getText("_Unable_to_show_max_featcount"),
278
                    Messages.getText("error"),
279
                    JOptionPane.ERROR_MESSAGE);
280
        }
281
    }
282

    
283
    /**
284
     * Gets the timeout used during the loading process.
285
     *
286
     * @return the timeout used during the loading process
287
     */
288
    public int getTimeout() {
289

    
290
        String tou = this.getTimeoutCombo().getSelectedItem().toString();
291
        return toMilliseconds(tou);
292

    
293
    }
294

    
295
    public void setTimeOut(int timeOut) {
296
        int cnt = this.getTimeoutCombo().getItemCount();
297
        for (int i = 0; i < cnt; i++) {
298
            String aux = this.getTimeoutCombo().getItemAt(i).toString();
299
            if (timeOut == toMilliseconds(aux)) {
300
                this.getTimeoutCombo().setSelectedIndex(i);
301
                return;
302
            }
303
        }
304
        this.getTimeoutCombo().setSelectedIndex(1);
305
    }
306

    
307
    private int toMilliseconds(String txt) {
308

    
309
        try {
310
            String[] tt = txt.split(" ");
311
            int aux = Integer.parseInt(tt[0]);
312
            if (tt[1].compareToIgnoreCase("min") == 0) {
313
                aux = aux * 60;
314
            }
315
            return aux * 1000;
316
        } catch (Exception ex) {
317
            logger.info("Did not parse item. Timeout = " + DEFAULT_TIMEOUT_MILLISECONDS);
318
            return DEFAULT_TIMEOUT_MILLISECONDS;
319
        }
320
    }
321

    
322
    /**
323
     * Gets the reference system of the layer.
324
     *
325
     * @return the reference system of the layer
326
     */
327
    public String getSRS() {
328
        Object sel = getSrsCombo().getSelectedItem();
329
        if (sel == null) {
330
            return "";
331
        } else {
332
            return sel.toString();
333
        }
334
    }
335

    
336
    public boolean getUseAxisOrderYX() {
337
        return this.axisOrderYXCheckBox.isSelected();
338
    }
339

    
340
    public void setSRS(String srs) {
341
        getSrsCombo().setSelectedItem(srs);
342
        refreshAxisOrder();
343
    }
344

    
345
    public void setVersion(String str_ver) {
346
        getVersionCombo().setSelectedItem(str_ver);
347
    }
348

    
349
    /**
350
     * This method initializes formatPanel
351
     *
352
     * @return javax.swing.JPanel
353
     */
354
    private JPanel getFormatPanel() {
355
        if (formatPanel == null) {
356
            formatPanel = new JPanel();
357
            formatPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
358
            formatPanel.setBorder(BorderFactory.createTitledBorder(null,
359
                    PluginServices.getText(this, "srs"),
360
                    TitledBorder.DEFAULT_JUSTIFICATION,
361
                    TitledBorder.DEFAULT_POSITION, null, null));
362
            formatPanel.add(getSRSLabel());
363
            formatPanel.add(getSrsCombo());
364
        }
365
        return formatPanel;
366
    }
367

    
368
    /**
369
     * This method initializes srsLabel
370
     *
371
     * @return javax.swing.JLabel
372
     */
373
    private JLabel getSRSLabel() {
374
        if (srsLabel == null) {
375
            srsLabel = new JLabel();
376
            srsLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
377
            srsLabel.setText(PluginServices.getText(this, "srs"));
378
            srsLabel.setPreferredSize(new Dimension(90, 20));
379
        }
380

    
381
        return srsLabel;
382
    }
383

    
384
    private JLabel getVersionLabel() {
385
        if (verLabel == null) {
386
            verLabel = new JLabel();
387
            verLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
388
            verLabel.setText(PluginServices.getText(this, "_Version"));
389
            verLabel.setPreferredSize(new Dimension(90, 20));
390
        }
391
        return verLabel;
392
    }
393

    
394
    /**
395
     * This method initializes srsText
396
     *
397
     * @return javax.swing.JTextField
398
     */
399
    private JComboBox getSrsCombo() {
400
        if (srsCombo == null) {
401
            srsCombo = new JComboBox();
402
            // srsCombo.setBounds(new java.awt.Rectangle(110, 25, 100, 20));
403
            srsCombo.setEnabled(true);
404
            srsCombo.setEditable(false);
405
            srsCombo.setToolTipText(
406
                    PluginServices.getText(srsCombo, "select_Feature_Reference_System"));
407
        }
408
        return srsCombo;
409
    }
410

    
411
    private JComboBox getVersionCombo() {
412

    
413
        if (ver_Combo == null) {
414
            ver_Combo = new JComboBox();
415
            ver_Combo.setEnabled(true);
416
            ver_Combo.setEditable(false);
417
            ver_Combo.addActionListener(new ActionListener() {
418
                public void actionPerformed(ActionEvent ae) {
419
                    refreshAxisOrder();
420
                }
421
            });
422
        }
423
        return ver_Combo;
424
    }
425

    
426
    /**
427
     * Refresh the panel
428
     *
429
     * @param feature
430
     */
431
    public void refresh(WFSSelectedFeature layer) {
432

    
433
        Vector srs = layer.getSrs();
434
        Iterator iter = srs.iterator();
435
        JComboBox bx = this.getSrsCombo();
436
        bx.removeAllItems();
437
        while (iter.hasNext()) {
438
            bx.addItem(iter.next());
439
        }
440
        refreshAxisOrder();
441
    }
442

    
443
    private void refreshAxisOrder() {
444
        try {
445
            String version = this.getVersion();
446
            if (version != null && version.compareToIgnoreCase("1.1.0") >= 0) {
447
                String srs = this.getSRS();
448
                if( !StringUtils.isBlank(srs) ) {
449
                    IProjection proj = CRSFactory.getCRS(srs);
450
                    if (proj != null && !proj.isProjected()) {
451
                        this.axisOrderYXCheckBox.setSelected(true);
452
                    }
453
                }
454
            } else {
455
                this.axisOrderYXCheckBox.setSelected(false);
456
            }
457
        } catch (Exception ex) {
458
            logger.warn("Can't set axis order automatically", ex);
459
        }
460
    }
461

    
462
    public void refreshVersions(List vers) {
463
        Iterator iter = vers.iterator();
464
        JComboBox bx = this.getVersionCombo();
465
        bx.removeAllItems();
466
        while (iter.hasNext()) {
467
            bx.addItem(iter.next());
468
        }
469
        refreshAxisOrder();
470
    }
471

    
472
    /**
473
     * This method initializes jLabelMiliSeconds
474
     *
475
     * @return javax.swing.JLabel
476
     */
477
    /*
478
     public JLabel getJLabelMiliSeconds() {
479
     if (jLabelMiliSeconds == null) {
480
     jLabelMiliSeconds = new JLabel();
481
     jLabelMiliSeconds.setText(PluginServices.getText(jLabelMiliSeconds, "miliSeconds"));
482
     jLabelMiliSeconds.setBounds(new Rectangle(175, 50, 40, 16));
483
     }
484

485
     return jLabelMiliSeconds;
486
     }
487
     */
488
    private JPanel getCachePanel() {
489
        if (cachePanel == null) {
490
            cachePanel = new JPanel();
491
            cachePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
492
            cachePanel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "vectorial_cache"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
493
            cachePanel.add(getEnableCacheCheckBox());
494
        }
495
        return cachePanel;
496
    }
497

    
498
    public JCheckBox getEnableCacheCheckBox() {
499
        if (enableCacheCheckBox == null) {
500
            enableCacheCheckBox = new JCheckBox();
501
            enableCacheCheckBox.setText(PluginServices.getText(null, "enable_cache"));
502
            enableCacheCheckBox.setBounds(new Rectangle(175, 50, 40, 16));
503
        }
504

    
505
        return enableCacheCheckBox;
506
    }
507

    
508
    private JPanel getAxisOrderPanel() {
509
        if (axisOrderPanel == null) {
510
            I18nManager i18nManager = ToolsLocator.getI18nManager();
511
            axisOrderPanel = new JPanel();
512
            axisOrderPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
513
            axisOrderPanel.setBorder(BorderFactory.createTitledBorder(
514
                    null,
515
                    PluginServices.getText(null,"_Axis_order"),
516
                    TitledBorder.DEFAULT_JUSTIFICATION,
517
                    TitledBorder.DEFAULT_POSITION,
518
                    null,
519
                    null
520
            ));
521
            axisOrderPanel.add(getAxisOrderYXCheckBox());
522
        }
523
        return axisOrderPanel;
524
    }
525

    
526
    public JCheckBox getAxisOrderYXCheckBox() {
527
        if (axisOrderYXCheckBox == null) {
528
            I18nManager i18nManager = ToolsLocator.getI18nManager();
529
            axisOrderYXCheckBox = new JCheckBox();
530
            axisOrderYXCheckBox.setText(PluginServices.getText(null,"_Use_axis_order_YX"));
531
            axisOrderYXCheckBox.setBounds(new Rectangle(175, 50, 40, 16));
532
        }
533

    
534
        return axisOrderYXCheckBox;
535
    }
536

    
537
    /*
538
     * (non-Javadoc)
539
     * @see com.iver.cit.gvsig.gui.panels.AbstractWFSPanel#initialize()
540
     */
541
    protected void initialize() {
542
        setLabel(PluginServices.getText(this, "options"));
543
        setLabelGroup(PluginServices.getText(this, "wfs"));
544
        this.setLayout(new java.awt.BorderLayout());
545
        java.awt.GridBagConstraints gridBagConstraints;
546

    
547
        northPanel = new JPanel();
548
        northPanel.setLayout(new java.awt.GridBagLayout());
549

    
550
        gridBagConstraints = new java.awt.GridBagConstraints();
551
        gridBagConstraints.gridx = 0;
552
        gridBagConstraints.gridy = 0;
553
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
554
        gridBagConstraints.weightx = 1.0;
555
        northPanel.add(getVersionPanel(), gridBagConstraints);
556

    
557
        gridBagConstraints = new java.awt.GridBagConstraints();
558
        gridBagConstraints.gridx = 0;
559
        gridBagConstraints.gridy = 1;
560
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
561
        gridBagConstraints.weightx = 1.0;
562
        northPanel.add(getConnectionParamsPanel(), gridBagConstraints);
563

    
564
        gridBagConstraints = new java.awt.GridBagConstraints();
565
        gridBagConstraints.gridx = 0;
566
        gridBagConstraints.gridy = 2;
567
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
568
        gridBagConstraints.weightx = 1.0;
569
        northPanel.add(getFormatPanel(), gridBagConstraints);
570

    
571
        gridBagConstraints = new java.awt.GridBagConstraints();
572
        gridBagConstraints.gridx = 0;
573
        gridBagConstraints.gridy = 3;
574
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
575
        gridBagConstraints.weightx = 1.0;
576
        northPanel.add(getCachePanel(), gridBagConstraints);
577

    
578
        gridBagConstraints = new java.awt.GridBagConstraints();
579
        gridBagConstraints.gridx = 0;
580
        gridBagConstraints.gridy = 4;
581
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
582
        gridBagConstraints.weightx = 1.0;
583
        northPanel.add(getAxisOrderPanel(), gridBagConstraints);
584

    
585
        add(northPanel, java.awt.BorderLayout.NORTH);
586
    }
587

    
588
    /**
589
     * @return
590
     */
591
    private Component getVersionPanel() {
592
        if (versionPanel == null) {
593
            versionPanel = new JPanel();
594
            versionPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
595
            versionPanel.setBorder(BorderFactory.createTitledBorder(null,
596
                    PluginServices.getText(this, "_WFS_protocol_version"),
597
                    TitledBorder.DEFAULT_JUSTIFICATION,
598
                    TitledBorder.DEFAULT_POSITION, null, null));
599
            versionPanel.add(getVersionLabel());
600
            versionPanel.add(getVersionCombo());
601
        }
602
        return versionPanel;
603
    }
604

    
605
    /**
606
     *
607
     * Returns the preferred CRS from a list. This is a utility and not very
608
     * elegant method used until the WFS wizard is able to show a combo with the
609
     * CRSs available in the server. Until then, we'll choose the CRS to prevent
610
     * issues with axis order
611
     *
612
     *
613
     * @param crs_list
614
     * @return
615
     * @deprecated
616
     */
617
    public static String getAxisOrderPreferredCrs(List crs_list) {
618

    
619
        if (crs_list == null || crs_list.size() == 0) {
620
            return "";
621
        }
622

    
623
        if (crs_list.size() == 1) {
624
            return crs_list.get(0).toString();
625
        }
626

    
627
        String item = null;
628
        IProjection ipro = null;
629

    
630
        for (int i = 0; i < crs_list.size(); i++) {
631
            item = crs_list.get(i).toString();
632
            try {
633
                ipro = CRSFactory.getCRS(item);
634
            } catch (Exception ex) {
635
                // Unable to parse CRS
636
                ipro = null;
637
            }
638
            if (ipro != null && ipro.isProjected()) {
639
                // If we find a projected one, return it
640
                return item;
641
            }
642
        }
643
        // If no CRS found, return first
644
        return crs_list.get(0).toString();
645
    }
646

    
647
    /**
648
     * @return
649
     */
650
    public String getVersion() {
651

    
652
        if (this.ver_Combo != null
653
                && this.ver_Combo.getSelectedItem() != null) {
654
            String v = this.ver_Combo.getSelectedItem().toString();
655
            return v;
656
        } else {
657
            // this should not happen
658
            return "-";
659
        }
660

    
661
    }
662
}