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