root / trunk / extensions / extWCS / src / com / iver / cit / gvsig / gui / panels / WCSParamsPanel.java @ 4356
History | View | Annotate | Download (37 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 |
package com.iver.cit.gvsig.gui.panels; |
42 |
|
43 |
import java.awt.geom.Point2D; |
44 |
import java.awt.geom.Rectangle2D; |
45 |
import java.util.ArrayList; |
46 |
import java.util.Iterator; |
47 |
|
48 |
import javax.swing.ButtonGroup; |
49 |
import javax.swing.JButton; |
50 |
import javax.swing.JComboBox; |
51 |
import javax.swing.JLabel; |
52 |
import javax.swing.JList; |
53 |
import javax.swing.JPanel; |
54 |
import javax.swing.JRadioButton; |
55 |
import javax.swing.JScrollPane; |
56 |
import javax.swing.JTabbedPane; |
57 |
import javax.swing.JTextField; |
58 |
|
59 |
import com.iver.andami.PluginServices; |
60 |
import com.iver.cit.gvsig.fmap.drivers.wcs.FMapWCSDriver; |
61 |
import com.iver.cit.gvsig.fmap.layers.WCSLayer; |
62 |
import com.iver.cit.gvsig.fmap.layers.WCSParameterModel; |
63 |
import com.iver.cit.gvsig.gui.wcs.WCSWizardData; |
64 |
|
65 |
/**
|
66 |
* This class implements the coverage option panel.
|
67 |
*
|
68 |
* It includes a set of Listeners that implement some control rules which
|
69 |
* refresh the component values that depends on those selected in the other
|
70 |
* components to avoid to choose an invalid set of options. It also includes a
|
71 |
* method (isCorrectlyConfigured()) that checks if the current set of values is enough to
|
72 |
* correctly launch a GetCoverage request.
|
73 |
*
|
74 |
* The information is obtained from a WCSWizardDataSource object.
|
75 |
*
|
76 |
*
|
77 |
* Esta clase implementa el panel de opciones disponibles sobre la cobertura.
|
78 |
*
|
79 |
* Incluye una serie de Listeners que implementan unas reglas de control que
|
80 |
* refrescan los valores de componentes cuyos valores dependen de aqu?llos
|
81 |
* seleccionados en otros componentes para evitar que se escoja una combinaci?n
|
82 |
* de opciones err?nea as? como una funci?n (isCorrectlyConfigured()) que
|
83 |
* comprueba si la combinaci?n escogida actualmente es suficiente para lanzar
|
84 |
* una operaci?n GetCoverage correctamente.
|
85 |
*
|
86 |
* La informaci?n obtiene a partir de un objeto WCSWizardDataSource.
|
87 |
*
|
88 |
* @author jaume - jaume dominguez faus
|
89 |
*
|
90 |
*/
|
91 |
public class WCSParamsPanel extends JPanel{ |
92 |
private final int SINGLE_VALUE = 0; |
93 |
private final int INTERVAL = 1; |
94 |
|
95 |
private JTabbedPane jTabbedPane = null; // @jve:decl-index=0:visual-constraint="37,30" |
96 |
private JPanel panelFormato = null; |
97 |
private JPanel panelTemps = null; |
98 |
private JPanel panelParametres = null; |
99 |
private JList lstCRSs = null; |
100 |
private JList lstTemps = null; |
101 |
private JComboBox cmbParam = null; |
102 |
private JList lstParamValues = null; |
103 |
private JButton btnDelTemps = null; |
104 |
private JList lstSelectedTimes = null; |
105 |
private JList lstFormats = null; |
106 |
private JPanel jPanel = null; |
107 |
private JPanel jPanel1 = null; |
108 |
private JPanel jPanel2 = null; |
109 |
private JPanel jPanel3 = null; |
110 |
private JPanel panelCovertures = null; |
111 |
private JPanel jPanel4 = null; |
112 |
private JTextField txtNomCobertura = null; |
113 |
private JScrollPane jScrollPane = null; |
114 |
private JButton btnAddTemps = null; |
115 |
private JList lstCoverages = null; |
116 |
private JLabel jLabel = null; |
117 |
private JScrollPane jScrollPane2 = null; |
118 |
private JScrollPane jScrollPane3 = null; |
119 |
private JScrollPane jScrollPane4 = null; |
120 |
private JScrollPane jScrollPane5 = null; |
121 |
private JScrollPane jScrollPane1 = null; |
122 |
private WCSWizardData data;
|
123 |
//private WCSWizardDataSource dataSource;
|
124 |
public JLabel lblInterval = null; |
125 |
public JLabel lblSample = null; |
126 |
private JTextField txtInterval = null; |
127 |
private JTextField txtIntervalBegin = null; |
128 |
private JTextField txtIntervalEnd = null; |
129 |
private JRadioButton radioSingleInterval = null; |
130 |
private JRadioButton radioMultipleInterval = null; |
131 |
private ButtonGroup group = new ButtonGroup(); |
132 |
public JLabel lblFrom = null; |
133 |
public JLabel lblTo = null; |
134 |
private int parameterType; |
135 |
/**
|
136 |
* This method initializes jTabbedPane
|
137 |
*
|
138 |
* @return javax.swing.JTabbedPane
|
139 |
*/
|
140 |
|
141 |
public WCSParamsPanel(){
|
142 |
super();
|
143 |
initialize(); |
144 |
} |
145 |
/**
|
146 |
* Returns the tab amount that the WCSParamsPanel currently have
|
147 |
*
|
148 |
* Devuelve el n?mero de solapas que tiene actualmente el WCSParamsPanel
|
149 |
*
|
150 |
* @return int
|
151 |
*/
|
152 |
public int getNumTabs(){ |
153 |
return getJTabbedPane().getTabCount();
|
154 |
} |
155 |
|
156 |
private void initialize(){ |
157 |
this.setLayout(null); |
158 |
//this.setPreferredSize(new java.awt.Dimension(750, 320));
|
159 |
this.setVisible(true); |
160 |
this.setSize(481, 427); |
161 |
this.add(getJTabbedPane(), null); |
162 |
} |
163 |
|
164 |
/**
|
165 |
* Sets the focus to the tab specified by the index.
|
166 |
*
|
167 |
* Establece el foco en la solapa especificada en index
|
168 |
*
|
169 |
* @param index
|
170 |
*/
|
171 |
private void setTabFocus(int index){ |
172 |
this.getJTabbedPane().setSelectedIndex(index);
|
173 |
} |
174 |
|
175 |
/**
|
176 |
* Sets the focus to the tab next to the current one.
|
177 |
*
|
178 |
* Enfoca a la solapa siguiente a la actualmente enfocada del TabbedPane
|
179 |
*
|
180 |
*/
|
181 |
public void avanzaTab(){ |
182 |
int currentPage = currentPage();
|
183 |
int nPages = getNumTabs();
|
184 |
if (nPages -1 > currentPage){ |
185 |
getJTabbedPane().setSelectedIndex(nextPageEnabled()); |
186 |
} |
187 |
} |
188 |
|
189 |
/**
|
190 |
* Sets the focus to the tab previous to the current one.
|
191 |
*
|
192 |
* Enfoca a la solapa anterior a la actualmente enfocada del TabbedPane
|
193 |
*
|
194 |
*/
|
195 |
public void retrocedeTab(){ |
196 |
this.getJTabbedPane().setSelectedIndex(previousEnabledPage());
|
197 |
|
198 |
} |
199 |
|
200 |
/**
|
201 |
* Returns the current tab index.
|
202 |
*
|
203 |
* Devuelve el n?mero de solapa en que se encuentra
|
204 |
*
|
205 |
* @return
|
206 |
*/
|
207 |
public int getIndiceSolapaActual(){ |
208 |
return this.getJTabbedPane().getSelectedIndex(); |
209 |
} |
210 |
|
211 |
public JTabbedPane getJTabbedPane() { |
212 |
if (jTabbedPane == null) { |
213 |
jTabbedPane = new JTabbedPane(); |
214 |
jTabbedPane.setSize(476, 422); |
215 |
jTabbedPane.addTab(PluginServices.getText(this, "Coberturas"), null, getPanelCovertures(), null); |
216 |
jTabbedPane.addTab(PluginServices.getText(this, "Formato"), null, getPanelFormato(), null); |
217 |
jTabbedPane.addTab(PluginServices.getText(this, "Tiempo"), null, getPanelTemps(), null); |
218 |
jTabbedPane.addTab(PluginServices.getText(this, "Parametros"), null, getPanelParametres(), null); |
219 |
} |
220 |
return jTabbedPane;
|
221 |
} |
222 |
/**
|
223 |
* This method initializes panelFormato
|
224 |
*
|
225 |
* @return javax.swing.JPanel
|
226 |
*/
|
227 |
private JPanel getPanelFormato() { |
228 |
if (panelFormato == null) { |
229 |
panelFormato = new JPanel(); |
230 |
panelFormato.setLayout(null);
|
231 |
panelFormato.add(getJPanel3(), null);
|
232 |
} |
233 |
return panelFormato;
|
234 |
} |
235 |
/**
|
236 |
* This method initializes panelTemps
|
237 |
*
|
238 |
* @return javax.swing.JPanel
|
239 |
*/
|
240 |
private JPanel getPanelTemps() { |
241 |
if (panelTemps == null) { |
242 |
panelTemps = new JPanel(); |
243 |
panelTemps.setLayout(null);
|
244 |
panelTemps.add(getJPanel(), null);
|
245 |
} |
246 |
return panelTemps;
|
247 |
} |
248 |
/**
|
249 |
* This method initializes panelParametres
|
250 |
*
|
251 |
* @return javax.swing.JPanel
|
252 |
*/
|
253 |
private JPanel getPanelParametres() { |
254 |
if (panelParametres == null) { |
255 |
panelParametres = new JPanel(); |
256 |
panelParametres.setLayout(null);
|
257 |
panelParametres.add(getJPanel1(), null);
|
258 |
} |
259 |
return panelParametres;
|
260 |
} |
261 |
/**
|
262 |
* This method initializes lstCRSs
|
263 |
*
|
264 |
* @return javax.swing.JList
|
265 |
*/
|
266 |
public JList getLstCRSs() { |
267 |
if (lstCRSs == null) { |
268 |
lstCRSs = new JList(); |
269 |
lstCRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
270 |
} |
271 |
return lstCRSs;
|
272 |
} |
273 |
/**
|
274 |
* This method initializes lstTemps
|
275 |
*
|
276 |
* @return javax.swing.JList
|
277 |
*/
|
278 |
public JList getLstTemps() { |
279 |
if (lstTemps == null) { |
280 |
lstTemps = new JList(); |
281 |
} |
282 |
return lstTemps;
|
283 |
} |
284 |
/**
|
285 |
* This method initializes cmbParam
|
286 |
*
|
287 |
* @return javax.swing.JComboBox
|
288 |
*/
|
289 |
public JComboBox getCmbParam() { |
290 |
if (cmbParam == null) { |
291 |
cmbParam = new JComboBox(); |
292 |
cmbParam.setBounds(23, 26, 188, 24); |
293 |
} |
294 |
return cmbParam;
|
295 |
} |
296 |
/**
|
297 |
* This method initializes lstParamValues
|
298 |
*
|
299 |
* @return javax.swing.JList
|
300 |
*/
|
301 |
public JList getSingleParamValuesList() { |
302 |
if (lstParamValues == null) { |
303 |
lstParamValues = new JList(); |
304 |
} |
305 |
return lstParamValues;
|
306 |
} |
307 |
|
308 |
|
309 |
|
310 |
/**
|
311 |
* This method initializes btnDelTemps
|
312 |
*
|
313 |
* @return javax.swing.JButton
|
314 |
*/
|
315 |
public JButton getBtnDelTemps() { |
316 |
if (btnDelTemps == null) { |
317 |
btnDelTemps = new JButton(); |
318 |
btnDelTemps.setText("<");
|
319 |
btnDelTemps.setBounds(171, 145, 41, 26); |
320 |
} |
321 |
return btnDelTemps;
|
322 |
} |
323 |
/**
|
324 |
* This method initializes lstSelectedTimes
|
325 |
*
|
326 |
* @return javax.swing.JList
|
327 |
*/
|
328 |
public JList getLstSelectedTimes() { |
329 |
if (lstSelectedTimes == null) { |
330 |
lstSelectedTimes = new JList(); |
331 |
} |
332 |
return lstSelectedTimes;
|
333 |
} |
334 |
/**
|
335 |
* This method initializes lstFormats
|
336 |
*
|
337 |
* @return javax.swing.JList
|
338 |
*/
|
339 |
public JList getLstFormats() { |
340 |
if (lstFormats == null) { |
341 |
lstFormats = new JList(); |
342 |
lstCRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
343 |
} |
344 |
return lstFormats;
|
345 |
} |
346 |
/**
|
347 |
* This method initializes jPanel
|
348 |
*
|
349 |
* @return javax.swing.JPanel
|
350 |
*/
|
351 |
private JPanel getJPanel() { |
352 |
if (jPanel == null) { |
353 |
jPanel = new JPanel(); |
354 |
jPanel.setLayout(null);
|
355 |
jPanel.setBounds(5, 17, 466, 374); |
356 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
357 |
null, PluginServices.getText(this, "seleccionar_tiempo"), |
358 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
359 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
360 |
jPanel.add(getBtnAddTemps(), null);
|
361 |
jPanel.add(getBtnDelTemps(), null);
|
362 |
jPanel.add(getJScrollPane3(), null);
|
363 |
jPanel.add(getJScrollPane4(), null);
|
364 |
} |
365 |
return jPanel;
|
366 |
} |
367 |
/**
|
368 |
* This method initializes jPanel1
|
369 |
*
|
370 |
* @return javax.swing.JPanel
|
371 |
*/
|
372 |
private JPanel getJPanel1() { |
373 |
if (jPanel1 == null) { |
374 |
lblTo = new JLabel(); |
375 |
lblTo.setBounds(55, 123, 124, 23); |
376 |
lblTo.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
377 |
lblTo.setText(PluginServices.getText(this, "hasta")); |
378 |
lblTo.setVisible(false);
|
379 |
lblFrom = new JLabel(); |
380 |
lblFrom.setBounds(54, 98, 125, 23); |
381 |
lblFrom.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
382 |
lblFrom.setText(PluginServices.getText(this, "desde")); |
383 |
lblFrom.setVisible(false);
|
384 |
lblSample = new JLabel(); |
385 |
lblSample.setBounds(218, 172, 197, 23); |
386 |
lblSample.setText("("+PluginServices.getText(this, "muestra")+": 1.2/2.6,3/4.5)"); |
387 |
lblSample.setVisible(false);
|
388 |
lblInterval = new JLabel(); |
389 |
lblInterval.setBounds(23, 52, 188, 23); |
390 |
lblInterval.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
391 |
lblInterval.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
392 |
lblInterval.setText(PluginServices.getText(this, "introduzca_intervalo_deseado")); |
393 |
lblInterval.setVisible(false);
|
394 |
jPanel1 = new JPanel(); |
395 |
jPanel1.setLayout(null);
|
396 |
jPanel1.setBounds(5, 23, 447, 202); |
397 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
398 |
null, PluginServices.getText(this, "seleccionar_parametros"), |
399 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
400 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
401 |
jPanel1.add(getCmbParam(), null);
|
402 |
jPanel1.add(getJScrollPane5(), null);
|
403 |
jPanel1.add(lblInterval, null);
|
404 |
jPanel1.add(lblSample, null);
|
405 |
jPanel1.add(getTxtInterval(), null);
|
406 |
jPanel1.add(getTxtIntervalBegin(), null);
|
407 |
jPanel1.add(getTxtIntervalEnd(), null);
|
408 |
jPanel1.add(getRadioSingleInterval(), null);
|
409 |
jPanel1.add(getRadioMultipleInterval(), null);
|
410 |
jPanel1.add(lblFrom, null);
|
411 |
jPanel1.add(lblTo, null);
|
412 |
} |
413 |
return jPanel1;
|
414 |
} |
415 |
/**
|
416 |
* This method initializes jPanel2
|
417 |
*
|
418 |
* @return javax.swing.JPanel
|
419 |
*/
|
420 |
private JPanel getJPanel2() { |
421 |
if (jPanel2 == null) { |
422 |
jPanel2 = new JPanel(); |
423 |
jPanel2.setLayout(null);
|
424 |
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( |
425 |
null, PluginServices.getText(this, "seleccionar_CRS"), |
426 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
427 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
428 |
jPanel2.setBounds(7, 282, 458, 109); |
429 |
jPanel2.add(getJScrollPane2(), null);
|
430 |
} |
431 |
return jPanel2;
|
432 |
} |
433 |
/**
|
434 |
* This method initializes jPanel3
|
435 |
*
|
436 |
* @return javax.swing.JPanel
|
437 |
*/
|
438 |
private JPanel getJPanel3() { |
439 |
if (jPanel3 == null) { |
440 |
jPanel3 = new JPanel(); |
441 |
jPanel3.setLayout(null);
|
442 |
jPanel3.setBounds(8, 9, 207, 203); |
443 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( |
444 |
null, PluginServices.getText(this, "seleccionar_formato"), |
445 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
446 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
447 |
jPanel3.add(getJScrollPane1(), null);
|
448 |
} |
449 |
return jPanel3;
|
450 |
} |
451 |
/**
|
452 |
* This method initializes panelCovertures
|
453 |
*
|
454 |
* @return javax.swing.JPanel
|
455 |
*/
|
456 |
private JPanel getPanelCovertures() { |
457 |
if (panelCovertures == null) { |
458 |
jLabel = new JLabel(); |
459 |
|
460 |
panelCovertures = new JPanel(); |
461 |
panelCovertures.setLayout(null);
|
462 |
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
463 |
jLabel.setBounds(7, 5, 130, 22); |
464 |
jLabel.setText(PluginServices.getText(this, "nombre_cobertura")); |
465 |
panelCovertures.add(getJPanel4(), null);
|
466 |
panelCovertures.add(getJPanel2(), null);
|
467 |
panelCovertures.add(getTxtNomCobertura(), null);
|
468 |
panelCovertures.add(jLabel, null);
|
469 |
} |
470 |
return panelCovertures;
|
471 |
} |
472 |
/**
|
473 |
* This method initializes jPanel4
|
474 |
*
|
475 |
* @return javax.swing.JPanel
|
476 |
*/
|
477 |
private JPanel getJPanel4() { |
478 |
if (jPanel4 == null) { |
479 |
jPanel4 = new JPanel(); |
480 |
jPanel4.setLayout(null);
|
481 |
jPanel4.setBounds(7, 33, 460, 159); |
482 |
jPanel4.add(getJScrollPane(), null);
|
483 |
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder( |
484 |
null, PluginServices.getText(this, "seleccionar_coberturas"), |
485 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
486 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
487 |
} |
488 |
return jPanel4;
|
489 |
} |
490 |
/**
|
491 |
* This method initializes jTextField
|
492 |
*
|
493 |
* @return javax.swing.JTextField
|
494 |
*/
|
495 |
public JTextField getTxtNomCobertura() { |
496 |
if (txtNomCobertura == null) { |
497 |
txtNomCobertura = new JTextField(); |
498 |
txtNomCobertura.setBounds(141, 6, 337, 21); |
499 |
} |
500 |
return txtNomCobertura;
|
501 |
} |
502 |
/**
|
503 |
* This method initializes jScrollPane
|
504 |
*
|
505 |
* @return javax.swing.JScrollPane
|
506 |
*/
|
507 |
private JScrollPane getJScrollPane() { |
508 |
if (jScrollPane == null) { |
509 |
jScrollPane = new JScrollPane(); |
510 |
jScrollPane.setBounds(6, 17, 446, 137); |
511 |
jScrollPane.setViewportView(getLstCoverages()); |
512 |
} |
513 |
return jScrollPane;
|
514 |
} |
515 |
/**
|
516 |
* This method initializes jButton2
|
517 |
*
|
518 |
* @return javax.swing.JButton
|
519 |
*/
|
520 |
public JButton getBtnAddTemps() { |
521 |
if (btnAddTemps == null) { |
522 |
btnAddTemps = new JButton(); |
523 |
btnAddTemps.setBounds(221, 145, 41, 26); |
524 |
btnAddTemps.setText(">");
|
525 |
} |
526 |
return btnAddTemps;
|
527 |
} |
528 |
/**
|
529 |
* This method initializes jList1
|
530 |
*
|
531 |
* @return javax.swing.JList
|
532 |
*/
|
533 |
public JList getLstCoverages() { |
534 |
if (lstCoverages == null) { |
535 |
lstCoverages = new JList(); |
536 |
lstCoverages.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
537 |
} |
538 |
return lstCoverages;
|
539 |
} |
540 |
/**
|
541 |
* This method initializes jScrollPane2
|
542 |
*
|
543 |
* @return javax.swing.JScrollPane
|
544 |
*/
|
545 |
private JScrollPane getJScrollPane2() { |
546 |
if (jScrollPane2 == null) { |
547 |
jScrollPane2 = new JScrollPane(); |
548 |
jScrollPane2.setBounds(6, 17, 441, 174); |
549 |
jScrollPane2.setViewportView(getLstCRSs()); |
550 |
} |
551 |
return jScrollPane2;
|
552 |
} |
553 |
|
554 |
public JLabel getCoverageLabel(){ |
555 |
return jLabel;
|
556 |
} |
557 |
/**
|
558 |
* This method initializes jScrollPane3
|
559 |
*
|
560 |
* @return javax.swing.JScrollPane
|
561 |
*/
|
562 |
private JScrollPane getJScrollPane3() { |
563 |
if (jScrollPane3 == null) { |
564 |
jScrollPane3 = new JScrollPane(); |
565 |
jScrollPane3.setBounds(6, 17, 158, 347); |
566 |
jScrollPane3.setViewportView(getLstTemps()); |
567 |
} |
568 |
return jScrollPane3;
|
569 |
} |
570 |
/**
|
571 |
* This method initializes jScrollPane4
|
572 |
*
|
573 |
* @return javax.swing.JScrollPane
|
574 |
*/
|
575 |
private JScrollPane getJScrollPane4() { |
576 |
if (jScrollPane4 == null) { |
577 |
jScrollPane4 = new JScrollPane(); |
578 |
jScrollPane4.setBounds(299, 17, 170, 185); |
579 |
jScrollPane4.setViewportView(getLstSelectedTimes()); |
580 |
} |
581 |
return jScrollPane4;
|
582 |
} |
583 |
/**
|
584 |
* This method initializes jScrollPane5
|
585 |
*
|
586 |
* @return javax.swing.JScrollPane
|
587 |
*/
|
588 |
public JScrollPane getJScrollPane5() { |
589 |
if (jScrollPane5 == null) { |
590 |
jScrollPane5 = new JScrollPane(); |
591 |
jScrollPane5.setBounds(226, 26, 193, 155); |
592 |
jScrollPane5.setViewportView(getSingleParamValuesList()); |
593 |
} |
594 |
return jScrollPane5;
|
595 |
} |
596 |
/**
|
597 |
* This method initializes jScrollPane1
|
598 |
*
|
599 |
* @return javax.swing.JScrollPane
|
600 |
*/
|
601 |
private JScrollPane getJScrollPane1() { |
602 |
if (jScrollPane1 == null) { |
603 |
jScrollPane1 = new JScrollPane(); |
604 |
jScrollPane1.setBounds(10, 32, 188, 160); |
605 |
jScrollPane1.setViewportView(getLstFormats()); |
606 |
} |
607 |
return jScrollPane1;
|
608 |
} |
609 |
|
610 |
|
611 |
/**
|
612 |
* Verifies that the selected parameters are enough to request the coverage
|
613 |
* to the server.
|
614 |
*
|
615 |
* Comprueba que los par?metros seleccionados son suficientes para pedir la
|
616 |
* cobertura al servidor.
|
617 |
*
|
618 |
* @return boolean
|
619 |
*/
|
620 |
public boolean isCorretlyConfigured() { |
621 |
|
622 |
if (getCurrentCoverageName()==null) return false; |
623 |
/*
|
624 |
* Seg?n el est?ndar WCS, si se especifica bounding box el par?metro TIME
|
625 |
* no es necesario. ?ste es el caso de gvSIG, que siempre especifica BBOX
|
626 |
* As? que, en teor?a, no deber?amos comprobar si se ha seleccionado algo
|
627 |
* o no. Pero en las pruebas, el servidor que us?bamos respond?a con una
|
628 |
* cobertura en blanco (negro) as? que se ha optado por evitar que se pueda
|
629 |
* consultar sin ninguna posici?n para el tiempo (siempre que la cobertura
|
630 |
* especifique posiciones para el tiempo).
|
631 |
*
|
632 |
* En cualquier caso con comentarizar la l?nea basta.
|
633 |
*/
|
634 |
if (timeRequired() && getTiempos()==null) return false; |
635 |
if (getCmbParam().getSelectedItem()!=null){ |
636 |
if (parameterType == SINGLE_VALUE && getParametro()==null) return false; |
637 |
if (parameterType == INTERVAL){
|
638 |
if (radioSingleInterval.isSelected()){
|
639 |
String beginText = getTxtIntervalBegin().getText();
|
640 |
String endText = getTxtIntervalEnd().getText();
|
641 |
try{
|
642 |
Double.parseDouble(beginText);
|
643 |
Double.parseDouble(endText);
|
644 |
} catch (Exception e){ |
645 |
return false; |
646 |
} |
647 |
} else {
|
648 |
String regexDouble = "-?[0-9]+(\\.[0-9]+)?"; |
649 |
String regexInterval = regexDouble+"/"+regexDouble; |
650 |
String regexIntervalList = regexInterval+"(,"+regexInterval+")*"; |
651 |
|
652 |
if (!getTxtInterval().getText().matches(regexIntervalList))
|
653 |
return false; |
654 |
|
655 |
} |
656 |
} |
657 |
} |
658 |
if (getSRS()==null) return false; |
659 |
if (getFormat()==null) return false; |
660 |
|
661 |
return true; |
662 |
} |
663 |
|
664 |
/**
|
665 |
* Returns the name and the selected values (if they are) of the parameter in
|
666 |
* a query string. Such string may directly be concatenated to the query string.
|
667 |
*
|
668 |
* Devuelve el nombre y los valores seleccionados (si hay alguno) del par?metro
|
669 |
* en forma de querystring, de manera que puede ser concatenado a la query.
|
670 |
*
|
671 |
* Si no se han seleccionado devuelve null.
|
672 |
*
|
673 |
* @return String
|
674 |
*/
|
675 |
public String getParametro(){ |
676 |
if (getCmbParam().getSelectedItem()!=null){ |
677 |
String s = null; |
678 |
if (parameterType == SINGLE_VALUE){
|
679 |
if (getSingleParamValuesList().getSelectedValues().length>0){ |
680 |
Object[] o = getSingleParamValuesList().getSelectedValues(); |
681 |
if (o.length > 0){ |
682 |
s = (String) o[0]; |
683 |
for (int i = 1; i < o.length; i++) { |
684 |
s += ","+(String) o[i]; |
685 |
} |
686 |
} |
687 |
} |
688 |
}else if (parameterType == INTERVAL){ |
689 |
if (radioSingleInterval.isSelected())
|
690 |
s = getTxtIntervalBegin().getText()+"/"+txtIntervalEnd.getText();
|
691 |
else{
|
692 |
s = getTxtInterval().getText(); |
693 |
} |
694 |
} |
695 |
if (s!=null) |
696 |
return (String) getCmbParam().getSelectedItem()+"="+s; |
697 |
} |
698 |
return null; |
699 |
} |
700 |
|
701 |
/**
|
702 |
* True if the TIME parameter is required, else false.
|
703 |
*
|
704 |
* True si se requiere especificar una posici?n para el tiempo.
|
705 |
* (jo crec que a?? no val per a res, per? per si de cas la tinc)
|
706 |
*
|
707 |
* @return
|
708 |
*/
|
709 |
private boolean timeRequired(){ |
710 |
return getLstTemps().getModel().getSize() > 0; |
711 |
} |
712 |
|
713 |
/**
|
714 |
* Made for internal uses. Takes the selected values at the parameter page.
|
715 |
*
|
716 |
* Usos internos. Recoge los valores seleccionados en los par?metros
|
717 |
* @param jList
|
718 |
* @return
|
719 |
*/
|
720 |
private Object[] recogeParametros(JList jList){ |
721 |
ArrayList o = new ArrayList(); |
722 |
for (int i = 0; i < jList.getModel().getSize(); i++) { |
723 |
o.add(jList.getModel().getElementAt(i)); |
724 |
} |
725 |
|
726 |
return o.toArray();
|
727 |
} |
728 |
|
729 |
/**
|
730 |
* Returns the time positions in a string that may directly be concatenated
|
731 |
* to the query string.
|
732 |
*
|
733 |
* Devuelve las posiciones para el tiempo en forma de querystring,
|
734 |
* de manera que puede ser concatenado a la query.
|
735 |
*
|
736 |
* @return String
|
737 |
*/
|
738 |
public String getTiempos(){ |
739 |
Object[] o = recogeParametros(getLstSelectedTimes()); |
740 |
String s = null; |
741 |
if (o.length > 0){ |
742 |
s = (String) o[0]; |
743 |
for (int i = 1; i < o.length; i++) { |
744 |
s += ","+ (String) o[i]; |
745 |
} |
746 |
} |
747 |
if (s!= null) return "TIME="+s; |
748 |
return s;
|
749 |
} |
750 |
|
751 |
/**
|
752 |
* Returns the selected CRS.
|
753 |
*
|
754 |
* Devuelve el CRS seleccionado.
|
755 |
*
|
756 |
* @return String
|
757 |
*/
|
758 |
public String getSRS() { |
759 |
return (String) getLstCRSs().getSelectedValue(); |
760 |
} |
761 |
|
762 |
/**
|
763 |
* Returns the selected format.
|
764 |
*
|
765 |
* Devuelve el formato seleccionado.
|
766 |
*
|
767 |
* @return String
|
768 |
*/
|
769 |
public String getFormat() { |
770 |
return (String) getLstFormats().getSelectedValue(); |
771 |
} |
772 |
|
773 |
/**
|
774 |
* Returns the name of the selected coverage.
|
775 |
*
|
776 |
* Devuelve el nombre de la cobertura seleccionada.
|
777 |
*
|
778 |
* @return String
|
779 |
*/
|
780 |
public String getLayerName() { |
781 |
return getTxtNomCobertura().getText();
|
782 |
} |
783 |
|
784 |
/**
|
785 |
* Cleans up the wizard's components but the server's layers list.
|
786 |
*
|
787 |
* Limpia todos los componentes del wizard excepto la lista de capas del
|
788 |
* servidor.
|
789 |
*/
|
790 |
public void limpiaWizard() { |
791 |
Object[] nada = new Object[0]; |
792 |
|
793 |
getLstCRSs().clearSelection(); |
794 |
getLstCRSs().setListData(nada); |
795 |
|
796 |
getLstFormats().clearSelection(); |
797 |
getLstFormats().setListData(nada); |
798 |
|
799 |
getLstTemps().clearSelection(); |
800 |
getLstTemps().setListData(nada); |
801 |
|
802 |
getLstSelectedTimes().clearSelection(); |
803 |
getLstSelectedTimes().setListData(nada); |
804 |
|
805 |
getCmbParam().removeAllItems(); |
806 |
getSingleParamValuesList().setVisible(true);
|
807 |
|
808 |
getSingleParamValuesList().clearSelection(); |
809 |
getSingleParamValuesList().setListData(nada); |
810 |
getTxtInterval().setText("");
|
811 |
getTxtIntervalBegin().setText("");
|
812 |
getTxtIntervalEnd().setText("");
|
813 |
getTxtInterval().setVisible(false);
|
814 |
getTxtIntervalBegin().setVisible(false);
|
815 |
getTxtIntervalEnd().setVisible(false);
|
816 |
} |
817 |
|
818 |
/**
|
819 |
* Returns the selected coverage name.
|
820 |
*
|
821 |
* Devuelve el nombre de la cobertura seleccionada
|
822 |
* @return String
|
823 |
*/
|
824 |
public String getCurrentCoverageName(){ |
825 |
return ((WCSLayer) getLstCoverages().getSelectedValue()).getName();
|
826 |
} |
827 |
|
828 |
/**
|
829 |
* Refreshes the wizard components data each time a coverage is selected.
|
830 |
*
|
831 |
* Actualiza los datos de los componentes del wizard cada vez que se selecciona
|
832 |
* una cobertura diferente.
|
833 |
*/
|
834 |
public void actualizaWizard(){ |
835 |
String coverageName = getCurrentCoverageName();
|
836 |
limpiaWizard(); |
837 |
if (coverageName != null){ |
838 |
WCSLayer lyr = data.getLayer(coverageName); |
839 |
getTxtNomCobertura().setText(lyr.getTitle()); |
840 |
|
841 |
getLstCRSs().clearSelection(); |
842 |
getLstCRSs().setListData(lyr.getSRSs().toArray()); |
843 |
|
844 |
getLstFormats().clearSelection(); |
845 |
getLstFormats().setListData(lyr.getFormats().toArray()); |
846 |
|
847 |
// getLstTemps().clearSelection();
|
848 |
// Object[] lista = lyr.toArray();
|
849 |
//
|
850 |
// // Activar/Desactivar pesta?a tiempos
|
851 |
// if (lista.length!=0){
|
852 |
// jTabbedPane.setEnabledAt(2, true);
|
853 |
// getLstTemps().setListData(lista);
|
854 |
// jTabbedPane.setEnabledAt(2, lista.length!=0);
|
855 |
// getBtnAddTemps().setEnabled(true);
|
856 |
// getBtnDelTemps().setEnabled(true);
|
857 |
// }
|
858 |
// else{
|
859 |
// jTabbedPane.setEnabledAt(2, false);
|
860 |
// getLstTemps().setEnabled(false);
|
861 |
// getLstSelectedTimes().setEnabled(false);
|
862 |
// getBtnAddTemps().setEnabled(false);
|
863 |
// getBtnDelTemps().setEnabled(false);
|
864 |
// }
|
865 |
|
866 |
// // ComboBox Par?metros
|
867 |
// // la lista de valores se actualiza con un listener
|
868 |
// ArrayList listaParametros = data.getCoverageInfo(coverageName).getParametros();
|
869 |
// jTabbedPane.setEnabledAt(3, !listaParametros.isEmpty());
|
870 |
// if (listaParametros.isEmpty()){
|
871 |
// getCmbParam().setEnabled(false);
|
872 |
// }
|
873 |
// else{
|
874 |
// getCmbParam().setEnabled(true);
|
875 |
// Iterator it = listaParametros.iterator();
|
876 |
// while (it.hasNext()) {
|
877 |
// WCSParameterModel p = (WCSParameterModel) it.next();
|
878 |
// getCmbParam().addItem(p.getName());
|
879 |
// }
|
880 |
// }
|
881 |
} |
882 |
} |
883 |
|
884 |
/**
|
885 |
* Refreshes the parameters name at the cmbParam.
|
886 |
*
|
887 |
* Actualiza los nombres de par?metros en el cmbParam.
|
888 |
*
|
889 |
* @param coverage
|
890 |
*/
|
891 |
public void actualizarParametros(String coverage){ |
892 |
// ArrayList listaParametros = data.getCoverageInfo((String) coverage).getParametros();
|
893 |
// Iterator it = listaParametros.iterator();
|
894 |
// while (it.hasNext()) {
|
895 |
// WCSParameterModel p = (WCSParameterModel) it.next();
|
896 |
// getCmbParam().addItem(p.getName());
|
897 |
// }
|
898 |
} |
899 |
|
900 |
/**
|
901 |
* Sets the object that holds the wizard data.
|
902 |
*
|
903 |
* Establece el objeto que contiene los datos del wizard.
|
904 |
*
|
905 |
* @param data
|
906 |
*/
|
907 |
public void setWizardData(WCSWizardData data) { |
908 |
this.data = data;
|
909 |
|
910 |
} |
911 |
|
912 |
/**
|
913 |
* Adds the selected items from the time list to the selected times list.
|
914 |
*
|
915 |
* A?ade los items seleccionados de la lista de tiempos a la
|
916 |
* lista de tiempos seleccionados.
|
917 |
*/
|
918 |
public void addTiempo() { |
919 |
ArrayList tiempos = new ArrayList(); |
920 |
for (int i = 0; i < getLstSelectedTimes() |
921 |
.getModel().getSize(); i++) { |
922 |
tiempos.add(getLstSelectedTimes().getModel() |
923 |
.getElementAt(i)); |
924 |
} |
925 |
|
926 |
Object[] obj = getLstTemps().getSelectedValues(); |
927 |
for (int i = 0; i < obj.length; i++) { |
928 |
if (!tiempos.contains(obj[i]))
|
929 |
tiempos.add(obj[i]); |
930 |
} |
931 |
getLstSelectedTimes() |
932 |
.setListData(tiempos.toArray()); |
933 |
} |
934 |
|
935 |
/**
|
936 |
* Refreshes the parameter values. This method is called by a listener when
|
937 |
* the state of the cmbParam changes. It is also called from FlyrWCS when the
|
938 |
* data is reloaded from a saved project.
|
939 |
*
|
940 |
* Actualiza la lista de valores para el par?metro. ?ste m?todo es lanzado
|
941 |
* por un listener cuando el estado del cmbParam (combo de los nombres de par?metro)
|
942 |
* cambia. Tambi?n es lanzado desde FLyrWCS cuando recuperamos los datos en un
|
943 |
* proyecto guardado.
|
944 |
*
|
945 |
* @param coverage
|
946 |
*/
|
947 |
public void refreshParamValues(String coverage){ |
948 |
if (getCmbParam().getItemCount()==0){ |
949 |
getSingleParamValuesList().setEnabled(false);
|
950 |
} |
951 |
if (coverage!=null && ( getCmbParam().getSelectedItem() != null) ){ |
952 |
String nombreParametro = (String) getCmbParam().getSelectedItem(); |
953 |
// WCSParameterModel p = data.getCoverageInfo(coverage).getParametro(nombreParametro);
|
954 |
// if (p.getType().equals("singleValue")){
|
955 |
// parameterType = SINGLE_VALUE;
|
956 |
// ArrayList valores = data.getCoverageInfo(coverage).getParametro(nombreParametro).getLista_valores_simples();
|
957 |
// getJScrollPane5().setVisible(true);
|
958 |
// lblInterval.setVisible(false);
|
959 |
// lblFrom.setVisible(false);
|
960 |
// getTxtIntervalBegin().setVisible(false);
|
961 |
// lblTo.setVisible(false);
|
962 |
// getTxtIntervalEnd().setVisible(false);
|
963 |
// getTxtInterval().setVisible(false);
|
964 |
// lblSample.setVisible(false);
|
965 |
// getRadioMultipleInterval().setVisible(false);
|
966 |
// getRadioSingleInterval().setVisible(false);
|
967 |
// getSingleParamValuesList().setEnabled(true);
|
968 |
// getSingleParamValuesList().setListData(valores.toArray());
|
969 |
// } else if (p.getType().equals("interval")){
|
970 |
// parameterType = INTERVAL;
|
971 |
// group.setSelected(getRadioSingleInterval().getModel(), true);
|
972 |
// double min = p.getMin();
|
973 |
// double max = p.getMax();
|
974 |
// String s = min+"";
|
975 |
// if (s.indexOf('.')>1 && (s.length()-s.indexOf('.')>3))
|
976 |
// s = s.substring(0, s.indexOf('.')+3);
|
977 |
// lblFrom.setText(PluginServices.getText(this, "desde")+" (min: "+s+"):");
|
978 |
// getTxtIntervalBegin().setText(min+"");
|
979 |
// s = max+"";
|
980 |
// if (s.indexOf('.')>1 && (s.length()-s.indexOf('.')>3))
|
981 |
// s = s.substring(0, s.indexOf('.')+3);
|
982 |
// lblTo.setText(PluginServices.getText(this, "hasta")+" (max: "+s+"):");
|
983 |
// getTxtIntervalEnd().setText(max+"");
|
984 |
// getJScrollPane5().setVisible(false);
|
985 |
// lblInterval.setVisible(true);
|
986 |
// lblFrom.setVisible(true);
|
987 |
// getTxtIntervalBegin().setVisible(true);
|
988 |
// lblTo.setVisible(true);
|
989 |
// getTxtIntervalEnd().setVisible(true);
|
990 |
// getTxtInterval().setVisible(true);
|
991 |
// lblSample.setVisible(true);
|
992 |
// getRadioMultipleInterval().setVisible(true);
|
993 |
// getRadioSingleInterval().setVisible(true);
|
994 |
// getSingleParamValuesList().setEnabled(false);
|
995 |
//
|
996 |
// }
|
997 |
} |
998 |
} |
999 |
|
1000 |
/**
|
1001 |
* Removes the selected items from the selected times list.
|
1002 |
*
|
1003 |
* Quita posiciones de tiempo de la lista de tiempos seleccionados.
|
1004 |
*/
|
1005 |
public void delTiempo() { |
1006 |
ArrayList tiempos = new ArrayList(); |
1007 |
Object[] obj = getLstSelectedTimes() |
1008 |
.getSelectedValues(); |
1009 |
for (int i = 0; i < getLstSelectedTimes() |
1010 |
.getModel().getSize(); i++) |
1011 |
tiempos.add(getLstSelectedTimes().getModel() |
1012 |
.getElementAt(i)); |
1013 |
|
1014 |
for (int j = 0; j < obj.length; j++) |
1015 |
if (tiempos.contains(obj[j]))
|
1016 |
tiempos.remove(obj[j]); |
1017 |
obj = new Object[tiempos.size()]; |
1018 |
for (int i = 0; i < obj.length; i++) { |
1019 |
obj[i] = tiempos.get(i); |
1020 |
} |
1021 |
getLstSelectedTimes() |
1022 |
.setListData(tiempos.toArray()); |
1023 |
} |
1024 |
|
1025 |
/**
|
1026 |
* The coverage label.
|
1027 |
*
|
1028 |
* La etiqueta de la cobertura
|
1029 |
* @return String
|
1030 |
*/
|
1031 |
public String getEtiquetaCobertura() { |
1032 |
return getTxtNomCobertura().getText();
|
1033 |
} |
1034 |
|
1035 |
/**
|
1036 |
* Returns the extent of the currently selected coverage for the currently
|
1037 |
* selected SRS.
|
1038 |
*
|
1039 |
* Devuelve el Extent de la cobertura actualmente seleccionada para el SRS
|
1040 |
* actualmente seleccionado
|
1041 |
*
|
1042 |
* @return Rectangle2D
|
1043 |
*/
|
1044 |
public Rectangle2D getExtent() { |
1045 |
return data.getLayer(getCurrentCoverageName()).getExtent(getSRS());
|
1046 |
} |
1047 |
|
1048 |
/**
|
1049 |
* Sets the wizard's data source
|
1050 |
*
|
1051 |
* Establece el origen de los datos del wizard
|
1052 |
* @param dataSource
|
1053 |
*/
|
1054 |
public void setDataSource(WCSWizardData dataSource) { |
1055 |
this.data = dataSource;
|
1056 |
|
1057 |
} |
1058 |
/**
|
1059 |
* Returns the index of the coverage within the coverages list
|
1060 |
*
|
1061 |
* Devuelve la posici?n que ocupa la cobertura en la lista de coberturas
|
1062 |
*
|
1063 |
* @param coverageName
|
1064 |
* @return The coverage's index if it exists, -1 if it not exists.
|
1065 |
*/
|
1066 |
public int getCoverageIndex(String coverageName) { |
1067 |
for (int i=0; i<getLstCoverages().getModel().getSize(); i++){ |
1068 |
if (coverageName.equals(getLstCoverages().getModel().getElementAt(i)))
|
1069 |
return i;
|
1070 |
} |
1071 |
return -1; |
1072 |
} |
1073 |
|
1074 |
/**
|
1075 |
* Returns the index of the CRS within the CRS list.
|
1076 |
*
|
1077 |
* Devuelve la posicion que ocupa el CRS en la lista de CRS
|
1078 |
*
|
1079 |
* @param crs
|
1080 |
* @return The CRS's index if it exists, -1 if it not exists.
|
1081 |
*/
|
1082 |
public int getSRSIndex(String crs) { |
1083 |
for (int i=0; i<getLstCRSs().getModel().getSize(); i++){ |
1084 |
if (crs.equals(getLstCRSs().getModel().getElementAt(i)))
|
1085 |
return i;
|
1086 |
} |
1087 |
return -1; |
1088 |
} |
1089 |
|
1090 |
/**
|
1091 |
* Returns the index of the format within the formats list.
|
1092 |
*
|
1093 |
* Devuelve la posicion que ocupa el formato en la lista de formatos
|
1094 |
* @param format
|
1095 |
*
|
1096 |
* @return The format's index if it exists, -1 if it not exists.
|
1097 |
*/
|
1098 |
public int getFormatIndex(String format) { |
1099 |
for (int i=0; i<getLstFormats().getModel().getSize(); i++){ |
1100 |
if (format.equals(getLstFormats().getModel().getElementAt(i)))
|
1101 |
return i;
|
1102 |
} |
1103 |
return -1; |
1104 |
} |
1105 |
|
1106 |
/**
|
1107 |
* Returns the parameter's name's index within the cmbBox.
|
1108 |
*
|
1109 |
* Devuelve la posicion que ocupa el nombre dle par?metro en el comboBox
|
1110 |
* de par?metros
|
1111 |
*
|
1112 |
* @param nParam
|
1113 |
* @return The index if it exists, -1 if it not exists.
|
1114 |
*/
|
1115 |
public int getParamIndex(String nParam) { |
1116 |
for (int i=0; i<getCmbParam().getModel().getSize(); i++){ |
1117 |
if (nParam.equals(getCmbParam().getItemAt(i)))
|
1118 |
return i;
|
1119 |
} |
1120 |
return -1; |
1121 |
} |
1122 |
|
1123 |
/**
|
1124 |
* Returns the position for the parameter's value within the parameter
|
1125 |
* values list.
|
1126 |
*
|
1127 |
* Devuelve la posicion que ocupa el valor para parametro
|
1128 |
* en la lista de valores para par?metro
|
1129 |
*
|
1130 |
* @param valor
|
1131 |
* @return The index if it exists, -1 if it not exists.
|
1132 |
*/
|
1133 |
public int getValueIndex(String valor) { |
1134 |
for (int i=0; i<getSingleParamValuesList().getModel().getSize(); i++){ |
1135 |
if (valor.equals(getSingleParamValuesList().getModel().getElementAt(i)))
|
1136 |
return i;
|
1137 |
} |
1138 |
return -1; |
1139 |
} |
1140 |
|
1141 |
/**
|
1142 |
* Returns the max supported resolution for the coverage.
|
1143 |
*
|
1144 |
* Recupera la resoluci?n m?xima soportada por la cobertura.
|
1145 |
* @return double
|
1146 |
*/
|
1147 |
public Point2D getMaxRes(){ |
1148 |
return data.getLayer(getCurrentCoverageName()).getMaxRes();
|
1149 |
} |
1150 |
/**
|
1151 |
* Returns the next enabled tab's index.
|
1152 |
*
|
1153 |
* Devuelve el ?ndicie de la siguiente pesta?a habilitada del wizard o -1 si no hay
|
1154 |
* ninguna.
|
1155 |
*
|
1156 |
* @return The index or -1 if there is no one.
|
1157 |
*/
|
1158 |
public int nextPageEnabled() { |
1159 |
int currentPage = currentPage();
|
1160 |
int nPages = getNumTabs();
|
1161 |
if (currentPage == nPages)
|
1162 |
return -1; |
1163 |
for (int i=currentPage+1; i<nPages; i++){ |
1164 |
if (getJTabbedPane().isEnabledAt(i)){
|
1165 |
return i;
|
1166 |
} |
1167 |
} |
1168 |
return -1; |
1169 |
} |
1170 |
|
1171 |
/**
|
1172 |
* Returns the index of the current tab.
|
1173 |
*
|
1174 |
* Devuelve el ?ndice de la p?gina actual del wizard.
|
1175 |
*
|
1176 |
* @return
|
1177 |
*/
|
1178 |
public int currentPage() { |
1179 |
return getJTabbedPane().getSelectedIndex();
|
1180 |
} |
1181 |
|
1182 |
/**
|
1183 |
* Returns the index of the previous enabled tab.
|
1184 |
*
|
1185 |
* Devuelve el ?ndice de la anterior p?gina habilitada del wizard o -1 si no hay
|
1186 |
* ninguna.
|
1187 |
*
|
1188 |
* @return The index, or -1 if there is no one.
|
1189 |
*/
|
1190 |
public int previousEnabledPage() { |
1191 |
int currentPage = currentPage();
|
1192 |
int j=0; |
1193 |
if (currentPage == 0) |
1194 |
j= -1;
|
1195 |
for (int i = currentPage-1; i>-1; i--){ |
1196 |
if (getJTabbedPane().isEnabledAt(i)){
|
1197 |
j= i; |
1198 |
break;
|
1199 |
} |
1200 |
} |
1201 |
return j;
|
1202 |
} |
1203 |
/**
|
1204 |
* This method initializes txtInterval
|
1205 |
*
|
1206 |
* @return javax.swing.JTextField
|
1207 |
*/
|
1208 |
public JTextField getTxtInterval() { |
1209 |
if (txtInterval == null) { |
1210 |
txtInterval = new JTextField(); |
1211 |
txtInterval.setBounds(61, 171, 149, 23); |
1212 |
txtInterval.setVisible(false);
|
1213 |
} |
1214 |
return txtInterval;
|
1215 |
} |
1216 |
/**
|
1217 |
* This method initializes txtIntervalBegin
|
1218 |
*
|
1219 |
* @return javax.swing.JTextField
|
1220 |
*/
|
1221 |
public JTextField getTxtIntervalBegin() { |
1222 |
if (txtIntervalBegin == null) { |
1223 |
txtIntervalBegin = new JTextField(); |
1224 |
txtIntervalBegin.setBounds(188, 98, 111, 23); |
1225 |
txtIntervalBegin.setVisible(false);
|
1226 |
} |
1227 |
return txtIntervalBegin;
|
1228 |
} |
1229 |
/**
|
1230 |
* This method initializes txtIntervalEnd
|
1231 |
*
|
1232 |
* @return javax.swing.JTextField
|
1233 |
*/
|
1234 |
public JTextField getTxtIntervalEnd() { |
1235 |
if (txtIntervalEnd == null) { |
1236 |
txtIntervalEnd = new JTextField(); |
1237 |
txtIntervalEnd.setBounds(188, 123, 111, 23); |
1238 |
txtIntervalEnd.setVisible(false);
|
1239 |
} |
1240 |
return txtIntervalEnd;
|
1241 |
} |
1242 |
|
1243 |
/**
|
1244 |
* This method initializes radioSingleInterval
|
1245 |
*
|
1246 |
* @return javax.swing.JRadioButton
|
1247 |
*/
|
1248 |
public JRadioButton getRadioSingleInterval() { |
1249 |
if (radioSingleInterval == null) { |
1250 |
radioSingleInterval = new JRadioButton(); |
1251 |
radioSingleInterval.setBounds(22, 75, 190, 21); |
1252 |
radioSingleInterval.addActionListener(new java.awt.event.ActionListener() {
|
1253 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
1254 |
boolean enabled = radioSingleInterval.isEnabled();
|
1255 |
lblTo.setEnabled(enabled); |
1256 |
lblFrom.setEnabled(enabled); |
1257 |
getTxtIntervalBegin().setEnabled(enabled); |
1258 |
getTxtIntervalEnd().setEnabled(enabled); |
1259 |
getTxtInterval().setEnabled(!enabled); |
1260 |
lblSample.setEnabled(!enabled); |
1261 |
} |
1262 |
}); |
1263 |
radioSingleInterval.setText(PluginServices.getText(this, "intervalo")); |
1264 |
radioSingleInterval.setVisible(false);
|
1265 |
group.add(radioSingleInterval); |
1266 |
} |
1267 |
return radioSingleInterval;
|
1268 |
} |
1269 |
/**
|
1270 |
* This method initializes radioMultipleInterval
|
1271 |
*
|
1272 |
* @return javax.swing.JRadioButton
|
1273 |
*/
|
1274 |
public JRadioButton getRadioMultipleInterval() { |
1275 |
if (radioMultipleInterval == null) { |
1276 |
radioMultipleInterval = new JRadioButton(); |
1277 |
radioMultipleInterval.setBounds(22, 148, 191, 21); |
1278 |
radioMultipleInterval.addActionListener(new java.awt.event.ActionListener() {
|
1279 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
1280 |
boolean enabled = radioMultipleInterval.isEnabled();
|
1281 |
lblTo.setEnabled(!enabled); |
1282 |
lblFrom.setEnabled(!enabled); |
1283 |
getTxtIntervalBegin().setEnabled(!enabled); |
1284 |
getTxtIntervalEnd().setEnabled(!enabled); |
1285 |
getTxtInterval().setEnabled(enabled); |
1286 |
lblSample.setEnabled(enabled); |
1287 |
} |
1288 |
}); |
1289 |
radioMultipleInterval.setText(PluginServices.getText(this, "multiples_intervalos")); |
1290 |
radioMultipleInterval.setVisible(false);
|
1291 |
group.add(radioMultipleInterval); |
1292 |
} |
1293 |
return radioMultipleInterval;
|
1294 |
} |
1295 |
|
1296 |
public void setMultipleInterval(String text) { |
1297 |
getTxtInterval().setText(text); |
1298 |
} |
1299 |
|
1300 |
public void setIntervalBegin(String text) { |
1301 |
getTxtIntervalBegin().setText(text); |
1302 |
} |
1303 |
|
1304 |
public void setIntervalEnd(String text) { |
1305 |
getTxtIntervalEnd().setText(text); |
1306 |
} |
1307 |
public FMapWCSDriver getDriver() {
|
1308 |
return data.getDriver();
|
1309 |
} |
1310 |
} |