root / branches / v05 / extensions / extWMS / src / com / iver / cit / gvsig / gui / panels / WMSParamsPanel.java @ 3962
History | View | Annotate | Download (36.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 |
|
44 |
import java.awt.event.FocusEvent; |
45 |
import java.awt.event.FocusListener; |
46 |
import java.awt.event.MouseAdapter; |
47 |
import java.awt.event.MouseEvent; |
48 |
import java.awt.geom.Rectangle2D; |
49 |
import java.util.AbstractCollection; |
50 |
import java.util.ArrayList; |
51 |
import java.util.ConcurrentModificationException; |
52 |
import java.util.HashSet; |
53 |
import java.util.Iterator; |
54 |
import java.util.TreeSet; |
55 |
import java.util.Vector; |
56 |
|
57 |
import javax.swing.DefaultListModel; |
58 |
import javax.swing.JCheckBox; |
59 |
import javax.swing.JPanel; |
60 |
import javax.swing.JTabbedPane; |
61 |
import javax.swing.JTextField; |
62 |
import javax.swing.tree.TreePath; |
63 |
|
64 |
import org.cresques.cts.ICoordTrans; |
65 |
import org.cresques.cts.IProjection; |
66 |
import org.cresques.cts.ProjectionPool; |
67 |
import org.cresques.cts.gt2.CoordSys; |
68 |
import org.cresques.cts.gt2.CoordTrans; |
69 |
import org.gvsig.remoteClient.utils.CapabilitiesTags; |
70 |
|
71 |
import com.iver.andami.PluginServices; |
72 |
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver; |
73 |
import com.iver.cit.gvsig.fmap.exceptions.CannotReprojectException; |
74 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
75 |
import com.iver.cit.gvsig.fmap.layers.IFMapWMSDimension; |
76 |
import com.iver.cit.gvsig.fmap.layers.WMSLayerNode; |
77 |
import com.iver.cit.gvsig.fmap.layers.WMSLayerNode.FMapWMSStyle; |
78 |
import com.iver.cit.gvsig.gui.WizardPanel; |
79 |
import com.iver.cit.gvsig.gui.beans.controls.dnd.JDnDList; |
80 |
import com.iver.cit.gvsig.gui.beans.controls.dnd.JDnDListModel; |
81 |
import com.iver.cit.gvsig.gui.beans.listeners.BeanListener; |
82 |
import com.iver.cit.gvsig.gui.wizards.FormatListModel; |
83 |
import com.iver.cit.gvsig.gui.wizards.LayerTreeModel; |
84 |
import com.iver.cit.gvsig.gui.wizards.SRSListModel; |
85 |
import com.iver.cit.gvsig.gui.wizards.WMSWizardData; |
86 |
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport; |
87 |
/**
|
88 |
* This class implements the map option panel.
|
89 |
*
|
90 |
* It includes a set of Listeners that implement some control rules which
|
91 |
* refresh the component values that depends on those selected in the other
|
92 |
* components to avoid to choose an invalid set of options. It also includes a
|
93 |
* method (isCorrectlyConfigured()) that checks if the current set of values is
|
94 |
* enough to correctly launch a GetMap request.
|
95 |
*
|
96 |
* The information is obtained from a WMSWizardDataSource object.
|
97 |
*
|
98 |
*
|
99 |
* Esta clase implementa el panel de opciones disponibles sobre el mapa
|
100 |
*
|
101 |
* Incluye una serie de Listeners que implementan unas reglas de control que
|
102 |
* refrescan los valores de componentes cuyos valores dependen de aqu?llos
|
103 |
* seleccionados en otros componentes para evitar que se escoja una combinaci?n
|
104 |
* de opciones err?nea as? como una funci?n (isCorrectlyConfigured()) que
|
105 |
* comprueba si la combinaci?n escogida actualmente es suficiente para lanzar
|
106 |
* una operaci?n GetMap correctamente.
|
107 |
*
|
108 |
* La informaci?n obtiene a partir de un objeto WMSWizardDataSource.
|
109 |
*
|
110 |
* @author jaume - jaume dominguez faus
|
111 |
*
|
112 |
*/
|
113 |
public class WMSParamsPanel extends WizardPanel { |
114 |
private javax.swing.JScrollPane jScrollPane1 = null; |
115 |
private javax.swing.JScrollPane jScrollPane2 = null; |
116 |
private javax.swing.JScrollPane jScrollPane5 = null; |
117 |
private javax.swing.JButton btnAdd = null; |
118 |
private javax.swing.JButton btnDel = null; |
119 |
private javax.swing.JScrollPane jScrollPane6 = null; |
120 |
private javax.swing.JPanel jPanel2 = null; |
121 |
private javax.swing.JPanel tabFormats = null; |
122 |
private JPanel jPanel4 = null; |
123 |
private JTextField jTxtNomCapa = null; |
124 |
private JDnDList lstSelectedLayers = null; |
125 |
private javax.swing.JList lstSRSs = null; |
126 |
private LayerTree treeLayers = null; |
127 |
private javax.swing.JList lstFormats = null; |
128 |
private JDnDListModel selectedLayersModel = new JDnDListModel(); |
129 |
private WizardListenerSupport listenerSupport;
|
130 |
private WMSWizardData dataSource;
|
131 |
private JTabbedPane jTabbedPane = null; |
132 |
private JPanel tabLayers = null; |
133 |
private JPanel jPanel1 = null; |
134 |
private JPanel jPanel5 = null; |
135 |
private StylesPanel tabStyle = null; |
136 |
private JCheckBox chkTransparency = null; |
137 |
private InfoPanel tabInfo = null; |
138 |
private DimensionPanel tabDimensions = null; |
139 |
private int dimensionTabIndex; |
140 |
private int stylesTabIndex; |
141 |
private String oldSRS = null; |
142 |
protected Vector oldStyles = null; |
143 |
protected AbstractCollection oldDimensions = null; |
144 |
|
145 |
public WMSParamsPanel(){
|
146 |
super();
|
147 |
initialize(); |
148 |
} |
149 |
|
150 |
/**
|
151 |
* This method initializes panelPage2
|
152 |
*
|
153 |
* @return javax.swing.JPanel
|
154 |
*/
|
155 |
private void initialize() { |
156 |
this.setLayout(null); |
157 |
this.setVisible(false); |
158 |
this.setBounds(10, 5, 481, 427); |
159 |
this.add(getJTabbedPane(), null); |
160 |
} |
161 |
/**
|
162 |
* This method initializes jPanel2
|
163 |
*
|
164 |
* @return javax.swing.JPanel
|
165 |
*/
|
166 |
private javax.swing.JPanel getJPanel2() {
|
167 |
if (jPanel2 == null) { |
168 |
jPanel2 = new javax.swing.JPanel();
|
169 |
jPanel2.setLayout(null);
|
170 |
jPanel2.setBounds(4, 59, 454, 328); |
171 |
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( |
172 |
null, PluginServices.getText(this, "select_layers"), |
173 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
174 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
175 |
jPanel2.add(getJScrollPane1(), null);
|
176 |
jPanel2.add(getBtnDel(), null);
|
177 |
jPanel2.add(getBtnAdd(), null);
|
178 |
jPanel2.add(getJScrollPane5(), null);
|
179 |
} |
180 |
|
181 |
return jPanel2;
|
182 |
} |
183 |
|
184 |
/**
|
185 |
* This method initializes jPanel4
|
186 |
*
|
187 |
* @return javax.swing.JPanel
|
188 |
*/
|
189 |
private JPanel getJPanel4() { |
190 |
if (jPanel4 == null) { |
191 |
jPanel4 = new JPanel(); |
192 |
jPanel4.setLayout(null);
|
193 |
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder( |
194 |
null, PluginServices.getText(this, "layer_name"), |
195 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
196 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
197 |
jPanel4.setBounds(4, 8, 457, 49); |
198 |
jPanel4.add(getJTxtNomCapa(), null);
|
199 |
} |
200 |
|
201 |
return jPanel4;
|
202 |
} |
203 |
|
204 |
/**
|
205 |
* This method initializes jPanel3
|
206 |
*
|
207 |
* @return javax.swing.JPanel
|
208 |
*/
|
209 |
private javax.swing.JPanel getTabFormats() {
|
210 |
if (tabFormats == null) { |
211 |
tabFormats = new javax.swing.JPanel();
|
212 |
tabFormats.setLayout(null);
|
213 |
tabFormats.add(getJPanel1(), null);
|
214 |
tabFormats.add(getJPanel5(), null);
|
215 |
} |
216 |
|
217 |
return tabFormats;
|
218 |
} |
219 |
/**
|
220 |
* This method initializes jScrollPane1
|
221 |
*
|
222 |
* @return javax.swing.JScrollPane
|
223 |
*/
|
224 |
private javax.swing.JScrollPane getJScrollPane1() {
|
225 |
if (jScrollPane1 == null) { |
226 |
jScrollPane1 = new javax.swing.JScrollPane();
|
227 |
jScrollPane1.setBounds(11, 22, 430, 124); |
228 |
jScrollPane1.setViewportView(getTreeLayers()); |
229 |
jScrollPane1.setPreferredSize(new java.awt.Dimension(205, 75)); |
230 |
} |
231 |
|
232 |
return jScrollPane1;
|
233 |
} |
234 |
|
235 |
/**
|
236 |
* This method initializes btnDel
|
237 |
*
|
238 |
* @return javax.swing.JButton
|
239 |
*/
|
240 |
private javax.swing.JButton getBtnDel() {
|
241 |
if (btnDel == null) { |
242 |
btnDel = new javax.swing.JButton();
|
243 |
btnDel.setPreferredSize(new java.awt.Dimension(23, 23)); |
244 |
btnDel.setText(PluginServices.getText(this, "quitar")); |
245 |
btnDel.setMargin(new java.awt.Insets(2, 0, 2, 0)); |
246 |
btnDel.setBounds(246, 158, 101, 23); |
247 |
btnDel.setEnabled(false);
|
248 |
btnDel.addActionListener(new java.awt.event.ActionListener() {
|
249 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
250 |
delLayer(); |
251 |
} |
252 |
}); |
253 |
} |
254 |
return btnDel;
|
255 |
} |
256 |
|
257 |
/**
|
258 |
* This method initializes btnAdd
|
259 |
*
|
260 |
* @return javax.swing.JButton
|
261 |
*/
|
262 |
private javax.swing.JButton getBtnAdd() {
|
263 |
if (btnAdd == null) { |
264 |
btnAdd = new javax.swing.JButton();
|
265 |
btnAdd.setPreferredSize(new java.awt.Dimension(23, 23)); |
266 |
btnAdd.setText(PluginServices.getText(this, "add")); |
267 |
btnAdd.setMargin(new java.awt.Insets(2, 0, 2, 0)); |
268 |
btnAdd.setBounds(133, 158, 101, 23); |
269 |
btnAdd.setEnabled(false);
|
270 |
btnAdd.addActionListener(new java.awt.event.ActionListener() {
|
271 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
272 |
addLayer(); |
273 |
} |
274 |
}); |
275 |
} |
276 |
|
277 |
return btnAdd;
|
278 |
} |
279 |
|
280 |
/**
|
281 |
* This method initializes jScrollPane5
|
282 |
*
|
283 |
* @return javax.swing.JScrollPane
|
284 |
*/
|
285 |
private javax.swing.JScrollPane getJScrollPane5() {
|
286 |
if (jScrollPane5 == null) { |
287 |
jScrollPane5 = new javax.swing.JScrollPane();
|
288 |
jScrollPane5.setBounds(11, 190, 431, 130); |
289 |
jScrollPane5.setViewportView(getLstSelectedLayers()); |
290 |
jScrollPane5.setPreferredSize(new java.awt.Dimension(205, 75)); |
291 |
} |
292 |
|
293 |
return jScrollPane5;
|
294 |
} |
295 |
|
296 |
/**
|
297 |
* This method initializes jTextField
|
298 |
*
|
299 |
* @return javax.swing.JTextField
|
300 |
*/
|
301 |
private JTextField getJTxtNomCapa() { |
302 |
if (jTxtNomCapa == null) { |
303 |
jTxtNomCapa = new JTextField(); |
304 |
jTxtNomCapa.setBounds(10, 19, 437, 20); |
305 |
jTxtNomCapa.setText(PluginServices.getText(this, "WMSLayer")); |
306 |
} |
307 |
|
308 |
return jTxtNomCapa;
|
309 |
} |
310 |
|
311 |
|
312 |
/**
|
313 |
* This method initializes jScrollPane6
|
314 |
*
|
315 |
* @return javax.swing.JScrollPane
|
316 |
*/
|
317 |
private javax.swing.JScrollPane getJScrollPane6() {
|
318 |
if (jScrollPane6 == null) { |
319 |
jScrollPane6 = new javax.swing.JScrollPane();
|
320 |
jScrollPane6.setBounds(5, 23, 442, 140); |
321 |
jScrollPane6.setViewportView(getLstFormats()); |
322 |
jScrollPane6.setPreferredSize(new java.awt.Dimension(250, 200)); |
323 |
} |
324 |
|
325 |
return jScrollPane6;
|
326 |
} |
327 |
|
328 |
/**
|
329 |
* This method initializes jScrollPane2
|
330 |
*
|
331 |
* @return javax.swing.JScrollPane
|
332 |
*/
|
333 |
private javax.swing.JScrollPane getJScrollPane2() {
|
334 |
if (jScrollPane2 == null) { |
335 |
jScrollPane2 = new javax.swing.JScrollPane();
|
336 |
jScrollPane2.setBounds(5, 23, 442, 141); |
337 |
jScrollPane2.setViewportView(getLstSRSs()); |
338 |
jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 200)); |
339 |
} |
340 |
|
341 |
return jScrollPane2;
|
342 |
} |
343 |
|
344 |
/**
|
345 |
* This method initializes treeLayers
|
346 |
*
|
347 |
* @return javax.swing.JTree
|
348 |
*/
|
349 |
private LayerTree getTreeLayers() {
|
350 |
if (treeLayers == null) { |
351 |
treeLayers = new LayerTree();
|
352 |
treeLayers.setRootVisible(true);
|
353 |
treeLayers.addMouseListener(new java.awt.event.MouseAdapter() {
|
354 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
355 |
if (e.getClickCount() == 2){ |
356 |
addLayer(); |
357 |
} |
358 |
} |
359 |
}); |
360 |
treeLayers.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
|
361 |
public void valueChanged( |
362 |
javax.swing.event.TreeSelectionEvent e) { |
363 |
|
364 |
boolean isGetMapable = false; // pffff, jajaja |
365 |
TreePath[] selecciones = getTreeLayers().getSelectionPaths(); |
366 |
if (selecciones!=null) // no entenc perqu? peta ac? i li arriba null a voltes... |
367 |
{ |
368 |
for (int i = 0; i < selecciones.length && !isGetMapable; i++) { |
369 |
WMSLayerNode layer = ((WMSLayerNode) selecciones[i].getLastPathComponent()); |
370 |
isGetMapable = layer.getChildren().size()==0 || layer.getName()!=null; |
371 |
} |
372 |
|
373 |
} |
374 |
getBtnAdd().setEnabled(isGetMapable); |
375 |
fireWizardComplete(isCorrectlyConfigured()); |
376 |
} |
377 |
}); |
378 |
} |
379 |
|
380 |
return treeLayers;
|
381 |
} |
382 |
|
383 |
|
384 |
/**
|
385 |
* This method checks for the options selected within the configuration dialog are
|
386 |
* correct and enough to perform a GetMap request.
|
387 |
* @return true if you're done, false if not.
|
388 |
*/
|
389 |
public boolean isCorrectlyConfigured() { |
390 |
|
391 |
boolean b;
|
392 |
this.repaint();
|
393 |
if ((getLstSRSs().getSelectedIndex() != -1) && |
394 |
(getLstFormats().getSelectedIndex() != -1) &&
|
395 |
(getLstSelectedLayers().getModel().getSize() > 0)) {
|
396 |
b = true;
|
397 |
} else {
|
398 |
b = false;
|
399 |
} |
400 |
|
401 |
// Enable or disable the delete layer button.
|
402 |
getBtnDel().setEnabled( |
403 |
getLstSelectedLayers().getSelectedIndices()!=null
|
404 |
&& getLstSelectedLayers().getSelectedIndices().length>0
|
405 |
); |
406 |
return b;
|
407 |
} |
408 |
|
409 |
public WMSLayerNode[] selectedLayersToArray() { |
410 |
JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel()); |
411 |
ArrayList elements = modelo.getElements();
|
412 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
413 |
return layers;
|
414 |
} |
415 |
|
416 |
/**
|
417 |
* DOCUMENT ME!
|
418 |
*/
|
419 |
private void delLayer() { |
420 |
int[] indices = lstSelectedLayers.getSelectedIndices(); |
421 |
|
422 |
ArrayList removeList = new ArrayList(); |
423 |
|
424 |
WMSLayerNode[] infos = selectedLayersToArray();
|
425 |
JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel()); |
426 |
|
427 |
for (int i = 0; i < indices.length; i++) { |
428 |
removeList.add(infos[indices[i]]); |
429 |
} |
430 |
|
431 |
modelo.delIndices(indices); |
432 |
lstSelectedLayers.clearSelection(); |
433 |
fireWizardComplete(isCorrectlyConfigured()); |
434 |
|
435 |
refreshData(); |
436 |
refreshInfo(); |
437 |
|
438 |
} |
439 |
|
440 |
/**
|
441 |
* Fires a notification to this wizard listeners telling them if the
|
442 |
* configuration is fair enough to send a GetMap request.
|
443 |
* @param b
|
444 |
*/
|
445 |
private void fireWizardComplete(boolean b){ |
446 |
listenerSupport.callStateChanged(b); |
447 |
callStateChanged(b); |
448 |
} |
449 |
|
450 |
/**
|
451 |
* Refreshes the content shown by this.
|
452 |
*/
|
453 |
public void refreshData() { |
454 |
refreshSRS(); |
455 |
getLstSelectedLayers().repaint(); |
456 |
refreshStyleTree(); |
457 |
refreshDimensions(); |
458 |
//refreshInfo();
|
459 |
} |
460 |
|
461 |
/**
|
462 |
* Refreshes the info tab
|
463 |
*
|
464 |
*/
|
465 |
public void refreshInfo() { |
466 |
getTabInfo().refresh(dataSource, |
467 |
selectedLayersVector(), |
468 |
getStyleTitles(), |
469 |
getFormat(), |
470 |
getSRS(), |
471 |
getDimensions()); |
472 |
} |
473 |
|
474 |
private void refreshDimensions() { |
475 |
int size = getLstSelectedLayers().getModel().getSize();
|
476 |
boolean enable = false; |
477 |
for (int i=0; i<size; i++) { |
478 |
WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers().getModel().getElementAt(i); |
479 |
if (node.getDimensions()==null) |
480 |
continue;
|
481 |
|
482 |
for (int j = 0; j < node.getDimensions().size(); j++) { |
483 |
IFMapWMSDimension dim = (IFMapWMSDimension) node.getDimensions().get(j); |
484 |
getTabDimensions().addDimension(dim); |
485 |
enable = true;
|
486 |
} |
487 |
} |
488 |
jTabbedPane.setEnabledAt(dimensionTabIndex, enable); |
489 |
|
490 |
} |
491 |
|
492 |
/* private void refreshDimensionTree() {
|
493 |
int size = getLstSelectedLayers().getModel().getSize();
|
494 |
|
495 |
WMSLayerNode dimensionRoot = new WMSLayerNode();
|
496 |
dimensionRoot.setTitle(PluginServices.getText(this, "selected_themes"));
|
497 |
|
498 |
DimensionTreeModel model = new DimensionTreeModel(dimensionRoot);
|
499 |
jTabbedPane.setEnabledAt(dimensionTabIndex, false);
|
500 |
for (int i=0; i<size; i++) {
|
501 |
WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers().getModel().getElementAt(i);
|
502 |
WMSLayerNode myNode = new WMSLayerNode();
|
503 |
myNode.setName(node.getName());
|
504 |
myNode.setTitle(node.getTitle());
|
505 |
if (node.getDimensions()==null)
|
506 |
continue;
|
507 |
|
508 |
for (int j = 0; j < node.getDimensions().size(); j++) {
|
509 |
IFMapWMSDimension dim = (IFMapWMSDimension) node.getDimensions().get(j);
|
510 |
myNode.addDimension(dim.getName(), dim.getUnit(), dim.getUnitSymbol(), dim.getExpression());
|
511 |
}
|
512 |
// If any of the layers defines dimensions, the tab will be enabled.
|
513 |
if (model.addLayerBranch(myNode))
|
514 |
jTabbedPane.setEnabledAt(dimensionTabIndex, true);
|
515 |
}
|
516 |
// getDimensionTree().setModel(model);
|
517 |
// getDimensionTree().repaint();
|
518 |
}*/
|
519 |
|
520 |
|
521 |
/**
|
522 |
*
|
523 |
*/
|
524 |
private void refreshStyleTree() { |
525 |
int size = getLstSelectedLayers().getModel().getSize();
|
526 |
|
527 |
WMSLayerNode styleRoot = new WMSLayerNode();
|
528 |
styleRoot.setTitle(PluginServices.getText(this, "selected_themes")); |
529 |
|
530 |
StyleTreeModel model = new StyleTreeModel(styleRoot);
|
531 |
//model.setLayerNames(getLayersQuery());
|
532 |
jTabbedPane.setEnabledAt(stylesTabIndex, false);
|
533 |
for (int i=0; i<size; i++){ |
534 |
WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers().getModel().getElementAt(i); |
535 |
WMSLayerNode myNode = new WMSLayerNode();
|
536 |
myNode.setName(node.getName()); |
537 |
myNode.setTitle(node.getTitle()); |
538 |
|
539 |
// if (node.getStyles()==null)
|
540 |
// continue;
|
541 |
//
|
542 |
// for (int j = 0; j < node.getStyles().size(); j++) {
|
543 |
// FMapWMSStyle sty = (FMapWMSStyle) node.getStyles().get(j);
|
544 |
// myNode.addStyle(sty.name, sty.title, sty.styleAbstract);
|
545 |
// }
|
546 |
//
|
547 |
// // If any of the layers defines styles, the tab will be enabled.
|
548 |
// if (model.addLayerBranch(myNode)){
|
549 |
// jTabbedPane.setEnabledAt(stylesTabIndex, true);
|
550 |
// }
|
551 |
if (node.getStyles()!=null){ |
552 |
|
553 |
for (int j = 0; j < node.getStyles().size(); j++) { |
554 |
FMapWMSStyle sty = (FMapWMSStyle) node.getStyles().get(j); |
555 |
myNode.addStyle(sty.name, sty.title, sty.styleAbstract); |
556 |
} |
557 |
} |
558 |
// If any of the layers defines styles, the tab will be enabled.
|
559 |
if (model.addLayerBranch(myNode)){
|
560 |
jTabbedPane.setEnabledAt(stylesTabIndex, true);
|
561 |
} |
562 |
|
563 |
} |
564 |
getStyleTree().setModel(model); |
565 |
getStyleTree().expandAll(); |
566 |
getStyleTree().repaint(); |
567 |
} |
568 |
|
569 |
public void setStyleSelections(WMSLayerNode[] selectedLayers, Vector styles) { |
570 |
getStyleTree().setSelections(selectedLayers, styles); |
571 |
} |
572 |
/**
|
573 |
* Gets the currently shown style tree.
|
574 |
* @return
|
575 |
*/
|
576 |
private StyleTree getStyleTree() {
|
577 |
return getTabStyle().getStyleTree();
|
578 |
} |
579 |
|
580 |
|
581 |
/**
|
582 |
* DOCUMENT ME!
|
583 |
*/
|
584 |
private void addLayer() { |
585 |
boolean alguno = false; |
586 |
|
587 |
TreePath[] selecciones = getTreeLayers().getSelectionPaths(); |
588 |
if (selecciones == null) |
589 |
return;
|
590 |
for (int i = 0; i < selecciones.length; i++) { |
591 |
WMSLayerNode nodo = (WMSLayerNode) selecciones[i].getLastPathComponent(); |
592 |
if (nodo.getChildren().size()>0) |
593 |
if (nodo.getName() == null || nodo.getName().equals("")) |
594 |
// no es un nodo que se pueda pedir
|
595 |
continue;
|
596 |
//Se a?ade a la lista de layers seleccionados
|
597 |
JDnDListModel modelo = (JDnDListModel) lstSelectedLayers.getModel(); |
598 |
|
599 |
if (modelo.addElement(0, nodo.clone())) { |
600 |
alguno = true;
|
601 |
} |
602 |
} |
603 |
|
604 |
if (alguno) {
|
605 |
refreshData(); |
606 |
} |
607 |
refreshInfo(); |
608 |
} |
609 |
|
610 |
/**
|
611 |
* This method initializes lstSelectedLayers
|
612 |
*
|
613 |
* @return javax.swing.JList
|
614 |
*/
|
615 |
public javax.swing.JList getLstSelectedLayers() {
|
616 |
if (lstSelectedLayers == null) { |
617 |
lstSelectedLayers = new JDnDList();
|
618 |
lstSelectedLayers.setModel(selectedLayersModel); |
619 |
lstSelectedLayers.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
620 |
lstSelectedLayers.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
621 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
622 |
fireWizardComplete(isCorrectlyConfigured()); |
623 |
} |
624 |
}); |
625 |
lstSelectedLayers.addMouseListener(new MouseAdapter(){ |
626 |
public void mouseReleased(MouseEvent e) { |
627 |
refreshData(); |
628 |
} |
629 |
}); |
630 |
} |
631 |
|
632 |
return lstSelectedLayers;
|
633 |
} |
634 |
|
635 |
/**
|
636 |
* This method initializes lstSRSs
|
637 |
*
|
638 |
* @return javax.swing.JList
|
639 |
*/
|
640 |
public javax.swing.JList getLstSRSs() {
|
641 |
if (lstSRSs == null) { |
642 |
lstSRSs = new javax.swing.JList();
|
643 |
lstSRSs.setModel(new SRSListModel());
|
644 |
lstSRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
645 |
lstSRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
646 |
public void valueChanged( |
647 |
javax.swing.event.ListSelectionEvent e) { |
648 |
int i = lstSRSs.getSelectedIndex();
|
649 |
if (i!=-1) |
650 |
oldSRS = (String) lstSRSs.getModel().getElementAt(i);
|
651 |
fireWizardComplete(isCorrectlyConfigured()); |
652 |
} |
653 |
}); |
654 |
} |
655 |
|
656 |
return lstSRSs;
|
657 |
} |
658 |
|
659 |
/**
|
660 |
* This method initializes lstFormats1
|
661 |
*
|
662 |
* @return javax.swing.JList
|
663 |
*/
|
664 |
public javax.swing.JList getLstFormats() {
|
665 |
if (lstFormats == null) { |
666 |
lstFormats = new javax.swing.JList();
|
667 |
lstFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
668 |
lstFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
669 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
670 |
fireWizardComplete(isCorrectlyConfigured()); |
671 |
} |
672 |
}); |
673 |
} |
674 |
|
675 |
return lstFormats;
|
676 |
} |
677 |
|
678 |
/**
|
679 |
* DOCUMENT ME!
|
680 |
*/
|
681 |
private void refreshSRS() { |
682 |
//String oldSrs = (String) getLstSRSs().getSelectedValue();
|
683 |
ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel()).getElements();
|
684 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
685 |
|
686 |
|
687 |
if (layers.length == 0) { |
688 |
lstSRSs.setModel(new DefaultListModel()); |
689 |
} else {
|
690 |
TreeSet srsSet = new TreeSet(); |
691 |
srsSet.addAll(layers[0].getAllSrs());
|
692 |
|
693 |
// I'm adding the layer specific SRS
|
694 |
for (int i = 1; i < layers.length; i++) { |
695 |
HashSet nuevo = new HashSet(layers[i].getAllSrs()); |
696 |
try{
|
697 |
Iterator it = srsSet.iterator();
|
698 |
while (it.hasNext()) {
|
699 |
String srs = (String) it.next(); |
700 |
|
701 |
if (!nuevo.contains(srs)) {
|
702 |
srsSet.remove(srs); |
703 |
} |
704 |
} |
705 |
} catch (ConcurrentModificationException e){ |
706 |
// just ignore it and wait the user for do something.
|
707 |
// this is tipically caused by a fast dialog manipulation.
|
708 |
} |
709 |
} |
710 |
// And now, I'm adding the service SRS
|
711 |
srsSet.addAll(((WMSLayerNode)getTreeLayers().getModel().getRoot()).getAllSrs()); |
712 |
|
713 |
DefaultListModel model = new DefaultListModel(); |
714 |
String[] array = (String[]) srsSet.toArray(new String[0]); |
715 |
|
716 |
for (int i = 0; i < array.length; i++) { |
717 |
model.addElement(array[i]); |
718 |
} |
719 |
|
720 |
lstSRSs.setModel(model); |
721 |
} |
722 |
//int srsIndex = getSRSIndex( oldSrs );
|
723 |
int srsIndex = getSRSIndex( oldSRS );
|
724 |
if (srsIndex!=-1) |
725 |
getLstSRSs().setSelectedIndex(srsIndex); |
726 |
|
727 |
} |
728 |
|
729 |
public void setListenerSupport(WizardListenerSupport support) { |
730 |
listenerSupport = support; |
731 |
} |
732 |
|
733 |
public void setWizardData(WMSWizardData data) { |
734 |
this.dataSource = data;
|
735 |
((JDnDListModel) getLstSelectedLayers().getModel()).clear(); |
736 |
getLstSelectedLayers().repaint(); |
737 |
|
738 |
getLstFormats().setModel(new FormatListModel(this.dataSource.getFormats())); |
739 |
getTreeLayers().setModel(new LayerTreeModel(this.dataSource.getLayer())); |
740 |
|
741 |
refreshInfo(); |
742 |
} |
743 |
|
744 |
|
745 |
private Vector getStyleTitles() { |
746 |
return getTabStyle().getStyleTree().getStyleSelectionTitles();
|
747 |
} |
748 |
|
749 |
/**
|
750 |
* @return
|
751 |
*/
|
752 |
private Vector selectedLayersVector() { |
753 |
JDnDListModel mod = (JDnDListModel) getLstSelectedLayers().getModel(); |
754 |
Vector lyrs = new Vector(); |
755 |
for (int i = 0; i < mod.getSize(); i++) { |
756 |
lyrs.add(mod.getElementAt(i)); |
757 |
} |
758 |
return lyrs;
|
759 |
} |
760 |
|
761 |
public String getFormat() { |
762 |
return (String) getLstFormats().getSelectedValue(); |
763 |
} |
764 |
|
765 |
public String getLayersQuery() { |
766 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
|
767 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
768 |
|
769 |
//Nombre separado por comas de las capas
|
770 |
String layersQuery = layers[layers.length-1].getName(); |
771 |
|
772 |
for (int i = layers.length-2; i >= 0; i--) { |
773 |
layersQuery += ("," + layers[i].getName());
|
774 |
} |
775 |
|
776 |
return layersQuery;
|
777 |
|
778 |
} |
779 |
|
780 |
public String getSRS() { |
781 |
return (String) getLstSRSs().getSelectedValue(); |
782 |
} |
783 |
|
784 |
public String getLayerName() { |
785 |
return getJTxtNomCapa().getText();
|
786 |
} |
787 |
|
788 |
public void setLayerName(String name) { |
789 |
getJTxtNomCapa().setText(name); |
790 |
} |
791 |
|
792 |
public Rectangle2D getLayersRectangle() throws CannotReprojectException{ |
793 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
|
794 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
795 |
String[] layerNames = new String[layers.length]; |
796 |
for (int i = 0; i < layerNames.length; i++) { |
797 |
layerNames[i] = layers[i].getName(); |
798 |
} |
799 |
//Boundingbox de todas las capas
|
800 |
//ArrayList rectangulos = new ArrayList();
|
801 |
|
802 |
Rectangle2D rect;
|
803 |
String latLonID;
|
804 |
|
805 |
rect = dataSource.getBoundingBox(layerNames, getSRS()); |
806 |
if(rect == null) |
807 |
{ |
808 |
rect = dataSource.getBoundingBox(layerNames, CapabilitiesTags.EPSG_4326); |
809 |
latLonID = CapabilitiesTags.EPSG_4326; |
810 |
if (rect == null) |
811 |
{ |
812 |
rect = dataSource.getBoundingBox(layerNames, CapabilitiesTags.CRS_84); |
813 |
latLonID = CapabilitiesTags.CRS_84; |
814 |
} |
815 |
|
816 |
IProjection reqProj = ProjectionPool.get(getSRS()); |
817 |
IProjection latLonProj = ProjectionPool.get(latLonID); |
818 |
if ((reqProj != null) && (latLonProj != null)) |
819 |
{ |
820 |
ICoordTrans ct = new CoordTrans((CoordSys) reqProj, (CoordSys) latLonProj);
|
821 |
Rectangle2D reprojectedRect;
|
822 |
reprojectedRect = ct.convert(rect); |
823 |
rect = reprojectedRect; |
824 |
} |
825 |
else
|
826 |
{ |
827 |
throw new CannotReprojectException(PluginServices.getText(this, "cannotReproject") + " " + getSRS() + " -> " + latLonID); |
828 |
} |
829 |
} |
830 |
|
831 |
// if (rect != null) {
|
832 |
// rectangulos.add(rect);
|
833 |
// }
|
834 |
//}
|
835 |
|
836 |
// rect = getRectangle((Rectangle2D.Double[]) rectangulos.toArray(
|
837 |
// new Rectangle2D.Double[0]));
|
838 |
|
839 |
return rect;
|
840 |
} |
841 |
|
842 |
public TreePath[] getSelectedLayers() { |
843 |
return getTreeLayers().getSelectionPaths();
|
844 |
} |
845 |
|
846 |
/**
|
847 |
* Obtiene el rect?ngulo que contiene a todos los otros
|
848 |
*
|
849 |
* @param rects rectangulos
|
850 |
*
|
851 |
* @return Rectangulo que contiene a todos los demas
|
852 |
*/
|
853 |
private Rectangle2D getRectangle(Rectangle2D[] rects) { |
854 |
Rectangle2D ret = rects[0]; |
855 |
|
856 |
for (int i = 1; i < rects.length; i++) { |
857 |
ret.add(rects[i]); |
858 |
} |
859 |
|
860 |
return ret;
|
861 |
} |
862 |
|
863 |
/**
|
864 |
* The piece of the GetMap request that has the layer names.
|
865 |
* @return
|
866 |
*/
|
867 |
public String getQueryableLayerQuery() { |
868 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
|
869 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
870 |
//Nombre separado por comas de las capas
|
871 |
String layersQuery = ""; |
872 |
int i;
|
873 |
|
874 |
for (i = 0; i < layers.length; i++) { |
875 |
if (layers[i].isQueryable()) {
|
876 |
layersQuery = layers[i].getName(); |
877 |
|
878 |
break;
|
879 |
} |
880 |
} |
881 |
|
882 |
for (int j = i + 1; j < layers.length; j++) { |
883 |
if (layers[j].isQueryable()) {
|
884 |
layersQuery += ("," + layers[j].getName());
|
885 |
} |
886 |
} |
887 |
|
888 |
return layersQuery;
|
889 |
} |
890 |
|
891 |
/**
|
892 |
* Returns the index of the CRS within the CRS list.
|
893 |
*
|
894 |
* Devuelve la posicion que ocupa el CRS en la lista de CRS
|
895 |
*
|
896 |
* @param crs
|
897 |
* @return The CRS's index if it exists, -1 if it not exists.
|
898 |
*/
|
899 |
public int getSRSIndex(String crs) { |
900 |
for (int i=0; i<getLstSRSs().getModel().getSize(); i++){ |
901 |
if (crs!=null && crs.equals(getLstSRSs().getModel().getElementAt(i))) |
902 |
return i;
|
903 |
} |
904 |
return -1; |
905 |
} |
906 |
|
907 |
/**
|
908 |
* Returns the index of the format within the formats list.
|
909 |
*
|
910 |
* Devuelve la posicion que ocupa el formato en la lista de formatos
|
911 |
* @param format
|
912 |
*
|
913 |
* @return The format's index if it exists, -1 if it not exists.
|
914 |
*/
|
915 |
public int getFormatIndex(String format) { |
916 |
for (int i=0; i<getLstFormats().getModel().getSize(); i++){ |
917 |
if (format!=null && format.equals(getLstFormats().getModel().getElementAt(i))) |
918 |
return i;
|
919 |
} |
920 |
return -1; |
921 |
} |
922 |
|
923 |
/**
|
924 |
* This method initializes jTabbedPane
|
925 |
*
|
926 |
* @return javax.swing.JTabbedPane
|
927 |
*/
|
928 |
public JTabbedPane getJTabbedPane() { |
929 |
if (jTabbedPane == null) { |
930 |
jTabbedPane = new JTabbedPane(); |
931 |
jTabbedPane.setBounds(3, 3, 475, 415); |
932 |
InfoPanel ip = getTabInfo(); |
933 |
ip.addFocusListener(new FocusListener(){ |
934 |
public void focusGained(FocusEvent e) { |
935 |
refreshInfo(); |
936 |
} |
937 |
public void focusLost(FocusEvent e) { |
938 |
} |
939 |
}); |
940 |
|
941 |
StylesPanel sp = getTabStyle(); |
942 |
DimensionPanel dp = getTabDimensions(); |
943 |
|
944 |
|
945 |
jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, null); |
946 |
jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null); |
947 |
jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null); |
948 |
stylesTabIndex = jTabbedPane.getTabCount()-1;
|
949 |
jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"), null, dp, null); |
950 |
dimensionTabIndex = jTabbedPane.getTabCount()-1;
|
951 |
jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getTabFormats(), null); |
952 |
jTabbedPane.setEnabledAt(dimensionTabIndex, false);
|
953 |
jTabbedPane.setEnabledAt(stylesTabIndex, false);
|
954 |
} |
955 |
return jTabbedPane;
|
956 |
} |
957 |
|
958 |
/**
|
959 |
* This method initializes jPanel
|
960 |
*
|
961 |
* @return javax.swing.JPanel
|
962 |
*/
|
963 |
private JPanel getTabLayers() { |
964 |
if (tabLayers == null) { |
965 |
tabLayers = new JPanel(); |
966 |
tabLayers.setLayout(null);
|
967 |
tabLayers.add(getJPanel4(), null);
|
968 |
tabLayers.add(getJPanel2(), null);
|
969 |
} |
970 |
return tabLayers;
|
971 |
} |
972 |
|
973 |
/**
|
974 |
* This method initializes jPanel1
|
975 |
*
|
976 |
* @return javax.swing.JPanel
|
977 |
*/
|
978 |
private JPanel getJPanel1() { |
979 |
if (jPanel1 == null) { |
980 |
jPanel1 = new JPanel(); |
981 |
jPanel1.setLayout(null);
|
982 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
983 |
null, PluginServices.getText(this, "select_formats"), |
984 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
985 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
986 |
jPanel1.setBounds(7, 10, 453, 194); |
987 |
jPanel1.add(getJScrollPane6(), null);
|
988 |
jPanel1.add(getChkTransparency(), null);
|
989 |
} |
990 |
return jPanel1;
|
991 |
} |
992 |
|
993 |
/**
|
994 |
* This method initializes jPanel5
|
995 |
*
|
996 |
* @return javax.swing.JPanel
|
997 |
*/
|
998 |
private JPanel getJPanel5() { |
999 |
if (jPanel5 == null) { |
1000 |
jPanel5 = new JPanel(); |
1001 |
jPanel5.setLayout(null);
|
1002 |
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder( |
1003 |
null, PluginServices.getText(this, "seleccionar_srs"), |
1004 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
1005 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
1006 |
jPanel5.setBounds(7, 210, 453, 168); |
1007 |
jPanel5.add(getJScrollPane2(), null);
|
1008 |
} |
1009 |
return jPanel5;
|
1010 |
} |
1011 |
|
1012 |
/**
|
1013 |
* This method initializes jPanel6
|
1014 |
*
|
1015 |
* @return javax.swing.JPanel
|
1016 |
*/
|
1017 |
private StylesPanel getTabStyle() {
|
1018 |
if (tabStyle == null) { |
1019 |
tabStyle = new StylesPanel(this); |
1020 |
tabStyle.setEnabled(false);
|
1021 |
tabStyle.addListener(new BeanListener(){
|
1022 |
public void beanValueChanged(Object value) { |
1023 |
Vector myStyles = (Vector) value; |
1024 |
if (oldStyles == null || !(oldStyles.size() == myStyles.size() && oldStyles.containsAll(myStyles))){ |
1025 |
oldStyles = myStyles; |
1026 |
callStateChanged(isCorrectlyConfigured()); |
1027 |
} |
1028 |
}; |
1029 |
}); |
1030 |
} |
1031 |
return tabStyle;
|
1032 |
} |
1033 |
|
1034 |
/**
|
1035 |
* Sets the focus to the tab next to the current one.
|
1036 |
*
|
1037 |
* Enfoca a la solapa siguiente a la actualmente enfocada del TabbedPane
|
1038 |
*
|
1039 |
*/
|
1040 |
public void avanzaTab(){ |
1041 |
int currentPage = currentPage();
|
1042 |
int nPages = getNumTabs();
|
1043 |
if (nPages -1 > currentPage){ |
1044 |
getJTabbedPane().setSelectedIndex(nextEnabledPage()); |
1045 |
} |
1046 |
} |
1047 |
|
1048 |
/**
|
1049 |
* Sets the focus to the tab previous to the current one.
|
1050 |
*
|
1051 |
* Enfoca a la solapa anterior a la actualmente enfocada del TabbedPane
|
1052 |
*
|
1053 |
*/
|
1054 |
public void retrocedeTab(){ |
1055 |
this.getJTabbedPane().setSelectedIndex(previousEnabledPage());
|
1056 |
|
1057 |
} |
1058 |
/**
|
1059 |
* Returns the index of the current tab.
|
1060 |
*
|
1061 |
* Devuelve el ?ndice de la p?gina actual del wizard.
|
1062 |
*
|
1063 |
* @return
|
1064 |
*/
|
1065 |
public int currentPage(){ |
1066 |
return getJTabbedPane().getSelectedIndex();
|
1067 |
} |
1068 |
|
1069 |
/**
|
1070 |
* Returns the tab amount that the WMSParamsPanel currently have
|
1071 |
*
|
1072 |
* Devuelve el n?mero de solapas que tiene actualmente el WMSParamsPanel
|
1073 |
*
|
1074 |
* @return int
|
1075 |
*/
|
1076 |
public int getNumTabs(){ |
1077 |
return getJTabbedPane().getTabCount();
|
1078 |
} |
1079 |
|
1080 |
|
1081 |
/**
|
1082 |
* <p>
|
1083 |
* Returns the index of the previous enabled tab.
|
1084 |
* </p>
|
1085 |
* <p>
|
1086 |
* Devuelve el ?ndice de la anterior p?gina habilitada del wizard o -1 si no hay
|
1087 |
* ninguna.
|
1088 |
* </p>
|
1089 |
* @return The index, or -1 if there is no one.
|
1090 |
*/
|
1091 |
public int previousEnabledPage(){ |
1092 |
int currentPage = currentPage();
|
1093 |
int j=0; |
1094 |
if (currentPage == 0) |
1095 |
j= -1;
|
1096 |
for (int i = currentPage-1; i>-1; i--){ |
1097 |
if (getJTabbedPane().isEnabledAt(i)){
|
1098 |
j= i; |
1099 |
break;
|
1100 |
} |
1101 |
} |
1102 |
return j;
|
1103 |
} |
1104 |
|
1105 |
/**
|
1106 |
* <p>
|
1107 |
* Returns the previous of the previous enabled tab.
|
1108 |
* </p>
|
1109 |
* <p>
|
1110 |
* Devuelve el ?ndice de la siguiente p?gina habilitada del wizard o -1 si no hay
|
1111 |
* ninguna.
|
1112 |
* </p>
|
1113 |
* @return The index, or -1 if there is no one.
|
1114 |
*/
|
1115 |
public int nextEnabledPage() { |
1116 |
int currentPage = currentPage();
|
1117 |
int nPages = getNumTabs();
|
1118 |
if (currentPage == nPages)
|
1119 |
return -1; |
1120 |
for (int i=currentPage+1; i<nPages; i++){ |
1121 |
if (getJTabbedPane().isEnabledAt(i)){
|
1122 |
return i;
|
1123 |
} |
1124 |
} |
1125 |
return -1; |
1126 |
} |
1127 |
|
1128 |
/**
|
1129 |
* Selects/deselects the transparency checkbox.
|
1130 |
* @param b
|
1131 |
*/
|
1132 |
public void setTransparent(boolean b) { |
1133 |
getChkTransparency().setSelected(b); |
1134 |
} |
1135 |
/**
|
1136 |
* This method initializes chkTrasparency
|
1137 |
*
|
1138 |
* @return javax.swing.JCheckBox
|
1139 |
*/
|
1140 |
private JCheckBox getChkTransparency() { |
1141 |
if (chkTransparency == null) { |
1142 |
chkTransparency = new JCheckBox(); |
1143 |
chkTransparency.setText(PluginServices.getText(this, "wms_transparency")); |
1144 |
chkTransparency.setSelected(true);
|
1145 |
chkTransparency.addItemListener(new java.awt.event.ItemListener() {
|
1146 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
1147 |
fireWizardComplete(isCorrectlyConfigured()); |
1148 |
} |
1149 |
}); |
1150 |
chkTransparency.setBounds(5, 168, 441, 21); |
1151 |
|
1152 |
} |
1153 |
return chkTransparency;
|
1154 |
} |
1155 |
|
1156 |
|
1157 |
/**
|
1158 |
* Returns a vector of strings containing the styles selected for the
|
1159 |
* layers. A blank style is correct and means that default style will
|
1160 |
* be used.
|
1161 |
*
|
1162 |
* @return Vector
|
1163 |
*/
|
1164 |
public Vector getStyles() { |
1165 |
return getTabStyle().getStyleTree().getStylesSelection(selectedLayersToArray());
|
1166 |
} |
1167 |
|
1168 |
/**
|
1169 |
* This method initializes tabInfo
|
1170 |
*
|
1171 |
* @return javax.swing.JPanel
|
1172 |
*/
|
1173 |
private InfoPanel getTabInfo() {
|
1174 |
if (tabInfo == null) { |
1175 |
tabInfo = new InfoPanel();
|
1176 |
|
1177 |
} |
1178 |
return tabInfo;
|
1179 |
} |
1180 |
|
1181 |
|
1182 |
public void setDimensions(Vector dimensions) { |
1183 |
for (int i = 0; i < dimensions.size(); i++) { |
1184 |
String[] s = ((String) dimensions.get(i)).split("="); |
1185 |
getTabDimensions().setDimensionValue(s[0], s[1]); |
1186 |
} |
1187 |
|
1188 |
} |
1189 |
|
1190 |
|
1191 |
/**
|
1192 |
* This method initializes tabDimension
|
1193 |
*
|
1194 |
* @return javax.swing.JPanel
|
1195 |
*/
|
1196 |
private DimensionPanel getTabDimensions() {
|
1197 |
if (tabDimensions == null) { |
1198 |
tabDimensions = new DimensionPanel();
|
1199 |
tabDimensions.setEnabled(false);
|
1200 |
tabDimensions.addListener(new BeanListener(){
|
1201 |
public void beanValueChanged(Object value) { |
1202 |
Vector myDimensions = (Vector) value; |
1203 |
if (oldDimensions == null || !(oldDimensions.size() == myDimensions.size() && oldDimensions.containsAll(myDimensions))){ |
1204 |
oldDimensions = myDimensions; |
1205 |
callStateChanged(isCorrectlyConfigured()); |
1206 |
} |
1207 |
} |
1208 |
}); |
1209 |
|
1210 |
} |
1211 |
return tabDimensions;
|
1212 |
} |
1213 |
|
1214 |
|
1215 |
|
1216 |
/**
|
1217 |
* @return
|
1218 |
*/
|
1219 |
public boolean getTransparency() { |
1220 |
return getChkTransparency().isSelected();
|
1221 |
} |
1222 |
|
1223 |
/**
|
1224 |
* @return
|
1225 |
*/
|
1226 |
public Vector getDimensions() { |
1227 |
return getTabDimensions().getDimensions();
|
1228 |
} |
1229 |
|
1230 |
public void initWizard() {} |
1231 |
public void execute() { } |
1232 |
public FLayer getLayer() { return null; } |
1233 |
|
1234 |
public FMapWMSDriver getDriver() {
|
1235 |
return dataSource.getDriver();
|
1236 |
} |
1237 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
1238 |
|
1239 |
|