svn-gvsig-desktop / branches / MULTITHREADING_DEVELOPMENT / extensions / extWMS / src / com / iver / cit / gvsig / gui / panels / WMSParamsPanel.java @ 5292
History | View | Annotate | Download (45.3 KB)
1 | 4594 | jaume | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | 3746 | jaume | *
|
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 | 4594 | jaume | * Av. Blasco Ib??ez, 50
|
24 | 3746 | jaume | * 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 | 4222 | jaume | import java.awt.Component; |
44 | import java.awt.Dimension; |
||
45 | import java.awt.event.FocusAdapter; |
||
46 | 3746 | jaume | import java.awt.event.FocusEvent; |
47 | import java.awt.event.FocusListener; |
||
48 | 4222 | jaume | import java.awt.event.MouseAdapter; |
49 | import java.awt.event.MouseEvent; |
||
50 | 3746 | jaume | import java.awt.geom.Rectangle2D; |
51 | 4947 | ldiaz | import java.net.MalformedURLException; |
52 | import java.net.URL; |
||
53 | 3850 | jaume | import java.util.AbstractCollection; |
54 | 3746 | jaume | import java.util.ArrayList; |
55 | 4222 | jaume | import java.util.Hashtable; |
56 | 3746 | jaume | import java.util.TreeSet; |
57 | import java.util.Vector; |
||
58 | 4222 | jaume | import java.util.prefs.Preferences; |
59 | 3746 | jaume | |
60 | 4222 | jaume | import javax.swing.ImageIcon; |
61 | import javax.swing.JButton; |
||
62 | 3746 | jaume | import javax.swing.JCheckBox; |
63 | 4222 | jaume | import javax.swing.JOptionPane; |
64 | 3746 | jaume | import javax.swing.JPanel; |
65 | import javax.swing.JTabbedPane; |
||
66 | import javax.swing.JTextField; |
||
67 | import javax.swing.tree.TreePath; |
||
68 | |||
69 | 4222 | jaume | import org.cresques.cts.ICoordTrans; |
70 | import org.cresques.cts.IProjection; |
||
71 | import org.cresques.cts.ProjectionPool; |
||
72 | import org.cresques.cts.gt2.CoordSys; |
||
73 | import org.cresques.cts.gt2.CoordTrans; |
||
74 | 4606 | jaume | import org.gvsig.gui.beans.controls.dnd.JDnDListModel; |
75 | import org.gvsig.gui.beans.listeners.BeanListener; |
||
76 | 4222 | jaume | |
77 | 3746 | jaume | import com.iver.andami.PluginServices; |
78 | 4222 | jaume | import com.iver.andami.messages.NotificationManager; |
79 | 3746 | jaume | import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver; |
80 | 4222 | jaume | import com.iver.cit.gvsig.fmap.exceptions.CannotReprojectException; |
81 | 3746 | jaume | import com.iver.cit.gvsig.fmap.layers.FLayer; |
82 | 4947 | ldiaz | import com.iver.cit.gvsig.fmap.layers.FLayers; |
83 | import com.iver.cit.gvsig.fmap.layers.FLyrWMS; |
||
84 | 3746 | jaume | import com.iver.cit.gvsig.fmap.layers.IFMapWMSDimension; |
85 | import com.iver.cit.gvsig.fmap.layers.WMSLayerNode; |
||
86 | import com.iver.cit.gvsig.fmap.layers.WMSLayerNode.FMapWMSStyle; |
||
87 | import com.iver.cit.gvsig.gui.WizardPanel; |
||
88 | import com.iver.cit.gvsig.gui.wizards.FormatListModel; |
||
89 | import com.iver.cit.gvsig.gui.wizards.LayerTreeModel; |
||
90 | import com.iver.cit.gvsig.gui.wizards.SRSListModel; |
||
91 | import com.iver.cit.gvsig.gui.wizards.WMSWizardData; |
||
92 | import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport; |
||
93 | /**
|
||
94 | * This class implements the map option panel.
|
||
95 | *
|
||
96 | * It includes a set of Listeners that implement some control rules which
|
||
97 | * refresh the component values that depends on those selected in the other
|
||
98 | * components to avoid to choose an invalid set of options. It also includes a
|
||
99 | 3756 | jaume | * method (isCorrectlyConfigured()) that checks if the current set of values is
|
100 | * enough to correctly launch a GetMap request.
|
||
101 | 3746 | jaume | *
|
102 | * The information is obtained from a WMSWizardDataSource object.
|
||
103 | *
|
||
104 | *
|
||
105 | 3756 | jaume | * Esta clase implementa el panel de opciones disponibles sobre el mapa
|
106 | 3746 | jaume | *
|
107 | * Incluye una serie de Listeners que implementan unas reglas de control que
|
||
108 | 4594 | jaume | * refrescan los valores de componentes cuyos valores dependen de aqu?llos
|
109 | * seleccionados en otros componentes para evitar que se escoja una combinaci?n
|
||
110 | * de opciones err?nea as? como una funci?n (isCorrectlyConfigured()) que
|
||
111 | * comprueba si la combinaci?n escogida actualmente es suficiente para lanzar
|
||
112 | * una operaci?n GetMap correctamente.
|
||
113 | 3746 | jaume | *
|
114 | 4594 | jaume | * La informaci?n obtiene a partir de un objeto WMSWizardDataSource.
|
115 | 3746 | jaume | *
|
116 | * @author jaume - jaume dominguez faus
|
||
117 | *
|
||
118 | */
|
||
119 | public class WMSParamsPanel extends WizardPanel { |
||
120 | 4360 | ldiaz | |
121 | 3746 | jaume | private javax.swing.JScrollPane jScrollPane1 = null; |
122 | private javax.swing.JScrollPane jScrollPane2 = null; |
||
123 | private javax.swing.JScrollPane jScrollPane5 = null; |
||
124 | private javax.swing.JButton btnAdd = null; |
||
125 | private javax.swing.JButton btnDel = null; |
||
126 | private javax.swing.JScrollPane jScrollPane6 = null; |
||
127 | private javax.swing.JPanel jPanel2 = null; |
||
128 | private javax.swing.JPanel tabFormats = null; |
||
129 | private JPanel jPanel4 = null; |
||
130 | private JTextField jTxtNomCapa = null; |
||
131 | 4222 | jaume | private LayerList lstSelectedLayers = null; |
132 | 4473 | ldiaz | private ArrayList selectedPaths = new ArrayList(); |
133 | 3746 | jaume | private javax.swing.JList lstSRSs = null; |
134 | private LayerTree treeLayers = null; |
||
135 | private javax.swing.JList lstFormats = null; |
||
136 | private WizardListenerSupport listenerSupport;
|
||
137 | 4397 | ldiaz | public WMSWizardData dataSource;
|
138 | 3746 | jaume | private JTabbedPane jTabbedPane = null; |
139 | private JPanel tabLayers = null; |
||
140 | private JPanel jPanel1 = null; |
||
141 | private JPanel jPanel5 = null; |
||
142 | private StylesPanel tabStyle = null; |
||
143 | private JCheckBox chkTransparency = null; |
||
144 | private InfoPanel tabInfo = null; |
||
145 | 3756 | jaume | private DimensionPanel tabDimensions = null; |
146 | 3746 | jaume | private int dimensionTabIndex; |
147 | private int stylesTabIndex; |
||
148 | 3850 | jaume | private String oldSRS = null; |
149 | 4222 | jaume | private AbstractCollection oldDimensions = null; |
150 | private Dimension sizeFixed; |
||
151 | private JCheckBox chkExtendedNames = null; |
||
152 | private JButton btnUp = null; |
||
153 | private JButton btnDown = null; |
||
154 | public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wms-wizard" ); |
||
155 | 4449 | ldiaz | private JCheckBox chkDisagregate = null; |
156 | 3746 | jaume | |
157 | public WMSParamsPanel(){
|
||
158 | super();
|
||
159 | initialize(); |
||
160 | } |
||
161 | 4360 | ldiaz | |
162 | //TODO: crear nuevo constructor para a?adir los panels que quieras...
|
||
163 | public WMSParamsPanel(WMSWizardData data)
|
||
164 | { |
||
165 | super();
|
||
166 | setWizardData(data); |
||
167 | this.setLayout(null); |
||
168 | this.setVisible(false); |
||
169 | this.setBounds(10, 5, 481, 427); |
||
170 | |||
171 | if (jTabbedPane == null) { |
||
172 | jTabbedPane = new JTabbedPane(); |
||
173 | jTabbedPane.setBounds(3, 3, 475, 415); |
||
174 | |||
175 | StylesPanel sp = getTabStyle(); |
||
176 | DimensionPanel dp = getTabDimensions(); |
||
177 | |||
178 | jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null); |
||
179 | jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null); |
||
180 | stylesTabIndex = jTabbedPane.getTabCount()-1;
|
||
181 | jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"), null, dp, null); |
||
182 | dimensionTabIndex = jTabbedPane.getTabCount()-1;
|
||
183 | jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getTabFormats(), null); |
||
184 | jTabbedPane.setEnabledAt(dimensionTabIndex, false);
|
||
185 | jTabbedPane.setEnabledAt(stylesTabIndex, false);
|
||
186 | } |
||
187 | this.add(jTabbedPane, null); |
||
188 | |||
189 | setListenerSupport(new WizardListenerSupport());
|
||
190 | } |
||
191 | |||
192 | 3746 | jaume | |
193 | /**
|
||
194 | * This method initializes panelPage2
|
||
195 | *
|
||
196 | * @return javax.swing.JPanel
|
||
197 | */
|
||
198 | private void initialize() { |
||
199 | this.setLayout(null); |
||
200 | this.setVisible(false); |
||
201 | this.setBounds(10, 5, 481, 427); |
||
202 | this.add(getJTabbedPane(), null); |
||
203 | } |
||
204 | /**
|
||
205 | * This method initializes jPanel2
|
||
206 | *
|
||
207 | * @return javax.swing.JPanel
|
||
208 | */
|
||
209 | private javax.swing.JPanel getJPanel2() {
|
||
210 | if (jPanel2 == null) { |
||
211 | jPanel2 = new javax.swing.JPanel();
|
||
212 | jPanel2.setLayout(null);
|
||
213 | 4222 | jaume | jPanel2.setBounds(4, 59, 457, 328); |
214 | 3746 | jaume | jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( |
215 | 3774 | jaume | null, PluginServices.getText(this, "select_layers"), |
216 | 3746 | jaume | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
217 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
218 | 4222 | jaume | jPanel2.add(getChkExtendedNames(), null);
|
219 | |||
220 | 3746 | jaume | jPanel2.add(getJScrollPane1(), null);
|
221 | jPanel2.add(getBtnDel(), null);
|
||
222 | jPanel2.add(getBtnAdd(), null);
|
||
223 | jPanel2.add(getJScrollPane5(), null);
|
||
224 | 4222 | jaume | jPanel2.add(getBtnUp(), null);
|
225 | jPanel2.add(getBtnDown(), null);
|
||
226 | 4449 | ldiaz | jPanel2.add(getChkDisagregate(), null);
|
227 | 3746 | jaume | } |
228 | |||
229 | return jPanel2;
|
||
230 | } |
||
231 | |||
232 | /**
|
||
233 | * This method initializes jPanel4
|
||
234 | *
|
||
235 | * @return javax.swing.JPanel
|
||
236 | */
|
||
237 | private JPanel getJPanel4() { |
||
238 | if (jPanel4 == null) { |
||
239 | jPanel4 = new JPanel(); |
||
240 | jPanel4.setLayout(null);
|
||
241 | jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder( |
||
242 | 3774 | jaume | null, PluginServices.getText(this, "layer_name"), |
243 | 3746 | jaume | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
244 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
245 | jPanel4.setBounds(4, 8, 457, 49); |
||
246 | jPanel4.add(getJTxtNomCapa(), null);
|
||
247 | } |
||
248 | |||
249 | return jPanel4;
|
||
250 | } |
||
251 | |||
252 | /**
|
||
253 | * This method initializes jPanel3
|
||
254 | *
|
||
255 | * @return javax.swing.JPanel
|
||
256 | */
|
||
257 | private javax.swing.JPanel getTabFormats() {
|
||
258 | if (tabFormats == null) { |
||
259 | tabFormats = new javax.swing.JPanel();
|
||
260 | tabFormats.setLayout(null);
|
||
261 | tabFormats.add(getJPanel1(), null);
|
||
262 | tabFormats.add(getJPanel5(), null);
|
||
263 | } |
||
264 | |||
265 | return tabFormats;
|
||
266 | } |
||
267 | /**
|
||
268 | * This method initializes jScrollPane1
|
||
269 | *
|
||
270 | * @return javax.swing.JScrollPane
|
||
271 | */
|
||
272 | private javax.swing.JScrollPane getJScrollPane1() {
|
||
273 | if (jScrollPane1 == null) { |
||
274 | jScrollPane1 = new javax.swing.JScrollPane();
|
||
275 | 4449 | ldiaz | jScrollPane1.setBounds(11, 22, 430, 123); |
276 | 3746 | jaume | jScrollPane1.setViewportView(getTreeLayers()); |
277 | jScrollPane1.setPreferredSize(new java.awt.Dimension(205, 75)); |
||
278 | } |
||
279 | |||
280 | return jScrollPane1;
|
||
281 | } |
||
282 | |||
283 | /**
|
||
284 | * This method initializes btnDel
|
||
285 | *
|
||
286 | * @return javax.swing.JButton
|
||
287 | */
|
||
288 | private javax.swing.JButton getBtnDel() {
|
||
289 | if (btnDel == null) { |
||
290 | btnDel = new javax.swing.JButton();
|
||
291 | 4222 | jaume | //btnDel.setPreferredSize(new java.awt.Dimension(23, 23));
|
292 | btnDel.setText(PluginServices.getText(this, "remove")); |
||
293 | 3746 | jaume | btnDel.setMargin(new java.awt.Insets(2, 0, 2, 0)); |
294 | 4222 | jaume | btnDel.setBounds(339, 300, 101, 20); |
295 | 3746 | jaume | btnDel.setEnabled(false);
|
296 | btnDel.addActionListener(new java.awt.event.ActionListener() {
|
||
297 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
298 | delLayer(); |
||
299 | } |
||
300 | }); |
||
301 | } |
||
302 | return btnDel;
|
||
303 | } |
||
304 | |||
305 | /**
|
||
306 | * This method initializes btnAdd
|
||
307 | *
|
||
308 | * @return javax.swing.JButton
|
||
309 | */
|
||
310 | private javax.swing.JButton getBtnAdd() {
|
||
311 | if (btnAdd == null) { |
||
312 | btnAdd = new javax.swing.JButton();
|
||
313 | 4222 | jaume | //btnAdd.setPreferredSize(new java.awt.Dimension(23, 23));
|
314 | 3774 | jaume | btnAdd.setText(PluginServices.getText(this, "add")); |
315 | 3746 | jaume | btnAdd.setMargin(new java.awt.Insets(2, 0, 2, 0)); |
316 | 4222 | jaume | btnAdd.setBounds(236, 300, 101, 20); |
317 | 3746 | jaume | btnAdd.setEnabled(false);
|
318 | btnAdd.addActionListener(new java.awt.event.ActionListener() {
|
||
319 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
320 | addLayer(); |
||
321 | } |
||
322 | }); |
||
323 | } |
||
324 | return btnAdd;
|
||
325 | } |
||
326 | |||
327 | /**
|
||
328 | * This method initializes jScrollPane5
|
||
329 | *
|
||
330 | * @return javax.swing.JScrollPane
|
||
331 | */
|
||
332 | private javax.swing.JScrollPane getJScrollPane5() {
|
||
333 | if (jScrollPane5 == null) { |
||
334 | jScrollPane5 = new javax.swing.JScrollPane();
|
||
335 | 4449 | ldiaz | jScrollPane5.setBounds(47, 155, 394, 120); |
336 | 3746 | jaume | jScrollPane5.setViewportView(getLstSelectedLayers()); |
337 | jScrollPane5.setPreferredSize(new java.awt.Dimension(205, 75)); |
||
338 | } |
||
339 | |||
340 | return jScrollPane5;
|
||
341 | } |
||
342 | |||
343 | /**
|
||
344 | * This method initializes jTextField
|
||
345 | *
|
||
346 | * @return javax.swing.JTextField
|
||
347 | */
|
||
348 | private JTextField getJTxtNomCapa() { |
||
349 | if (jTxtNomCapa == null) { |
||
350 | jTxtNomCapa = new JTextField(); |
||
351 | jTxtNomCapa.setBounds(10, 19, 437, 20); |
||
352 | 3774 | jaume | jTxtNomCapa.setText(PluginServices.getText(this, "WMSLayer")); |
353 | 4222 | jaume | jTxtNomCapa.addKeyListener(new java.awt.event.KeyAdapter() {
|
354 | public void keyTyped(java.awt.event.KeyEvent e) { |
||
355 | fireWizardComplete(isCorrectlyConfigured()); |
||
356 | } |
||
357 | }); |
||
358 | 3746 | jaume | } |
359 | |||
360 | return jTxtNomCapa;
|
||
361 | } |
||
362 | |||
363 | |||
364 | /**
|
||
365 | * This method initializes jScrollPane6
|
||
366 | *
|
||
367 | * @return javax.swing.JScrollPane
|
||
368 | */
|
||
369 | private javax.swing.JScrollPane getJScrollPane6() {
|
||
370 | if (jScrollPane6 == null) { |
||
371 | jScrollPane6 = new javax.swing.JScrollPane();
|
||
372 | jScrollPane6.setBounds(5, 23, 442, 140); |
||
373 | jScrollPane6.setViewportView(getLstFormats()); |
||
374 | jScrollPane6.setPreferredSize(new java.awt.Dimension(250, 200)); |
||
375 | } |
||
376 | |||
377 | return jScrollPane6;
|
||
378 | } |
||
379 | |||
380 | /**
|
||
381 | * This method initializes jScrollPane2
|
||
382 | *
|
||
383 | * @return javax.swing.JScrollPane
|
||
384 | */
|
||
385 | private javax.swing.JScrollPane getJScrollPane2() {
|
||
386 | if (jScrollPane2 == null) { |
||
387 | jScrollPane2 = new javax.swing.JScrollPane();
|
||
388 | jScrollPane2.setBounds(5, 23, 442, 141); |
||
389 | jScrollPane2.setViewportView(getLstSRSs()); |
||
390 | jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 200)); |
||
391 | } |
||
392 | |||
393 | return jScrollPane2;
|
||
394 | } |
||
395 | |||
396 | /**
|
||
397 | 4449 | ldiaz | * Gets the available layers in WMS maintaining the tree structure
|
398 | * @return
|
||
399 | */
|
||
400 | public LayerTree getLayerStructure(){
|
||
401 | return treeLayers;
|
||
402 | } |
||
403 | |||
404 | /**
|
||
405 | 3746 | jaume | * This method initializes treeLayers
|
406 | *
|
||
407 | * @return javax.swing.JTree
|
||
408 | */
|
||
409 | private LayerTree getTreeLayers() {
|
||
410 | if (treeLayers == null) { |
||
411 | treeLayers = new LayerTree();
|
||
412 | treeLayers.setRootVisible(true);
|
||
413 | treeLayers.addMouseListener(new java.awt.event.MouseAdapter() {
|
||
414 | public void mouseClicked(java.awt.event.MouseEvent e) { |
||
415 | if (e.getClickCount() == 2){ |
||
416 | addLayer(); |
||
417 | } |
||
418 | } |
||
419 | }); |
||
420 | treeLayers.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
|
||
421 | public void valueChanged( |
||
422 | javax.swing.event.TreeSelectionEvent e) { |
||
423 | |||
424 | boolean isGetMapable = false; // pffff, jajaja |
||
425 | TreePath[] selecciones = getTreeLayers().getSelectionPaths(); |
||
426 | 4222 | jaume | if (selecciones!=null) // no entenc perqu? peta ac? i li arriba null a voltes... |
427 | 3746 | jaume | { |
428 | for (int i = 0; i < selecciones.length && !isGetMapable; i++) { |
||
429 | 4222 | jaume | WMSLayerNode layer = ((WMSLayerNode) selecciones[i].getLastPathComponent()); |
430 | isGetMapable = layer.getChildren().size()==0 || layer.getName()!=null; |
||
431 | 3746 | jaume | } |
432 | |||
433 | } |
||
434 | getBtnAdd().setEnabled(isGetMapable); |
||
435 | fireWizardComplete(isCorrectlyConfigured()); |
||
436 | } |
||
437 | }); |
||
438 | } |
||
439 | |||
440 | return treeLayers;
|
||
441 | } |
||
442 | |||
443 | |||
444 | /**
|
||
445 | * This method checks for the options selected within the configuration dialog are
|
||
446 | * correct and enough to perform a GetMap request.
|
||
447 | * @return true if you're done, false if not.
|
||
448 | */
|
||
449 | public boolean isCorrectlyConfigured() { |
||
450 | |||
451 | boolean b;
|
||
452 | this.repaint();
|
||
453 | if ((getLstSRSs().getSelectedIndex() != -1) && |
||
454 | (getLstFormats().getSelectedIndex() != -1) &&
|
||
455 | (getLstSelectedLayers().getModel().getSize() > 0)) {
|
||
456 | b = true;
|
||
457 | } else {
|
||
458 | b = false;
|
||
459 | } |
||
460 | |||
461 | 4222 | jaume | // Enable or disable del button.
|
462 | int[] selectedIndices = getLstSelectedLayers().getSelectedIndices(); |
||
463 | |||
464 | 3746 | jaume | getBtnDel().setEnabled( |
465 | 4222 | jaume | selectedIndices != null
|
466 | && selectedIndices.length>0
|
||
467 | 3746 | jaume | ); |
468 | 4222 | jaume | |
469 | 3746 | jaume | return b;
|
470 | } |
||
471 | 4222 | jaume | |
472 | public WMSLayerNode[] selectedLayersToArray() { |
||
473 | JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel()); |
||
474 | ArrayList elements = modelo.getElements();
|
||
475 | WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
||
476 | return layers;
|
||
477 | } |
||
478 | |||
479 | 3746 | jaume | /**
|
480 | * DOCUMENT ME!
|
||
481 | */
|
||
482 | private void delLayer() { |
||
483 | int[] indices = lstSelectedLayers.getSelectedIndices(); |
||
484 | |||
485 | 4222 | jaume | try {
|
486 | ArrayList removeList = new ArrayList(); |
||
487 | WMSLayerNode[] infos = selectedLayersToArray();
|
||
488 | 4492 | ldiaz | JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel()); |
489 | 4222 | jaume | for (int i = 0; i < indices.length; i++) { |
490 | removeList.add(infos[indices[i]]); |
||
491 | 4492 | ldiaz | } |
492 | 4222 | jaume | modelo.delIndices(indices); |
493 | lstSelectedLayers.clearSelection(); |
||
494 | fireWizardComplete(isCorrectlyConfigured()); |
||
495 | |||
496 | 4492 | ldiaz | //delete from selectedPaths as well
|
497 | WMSLayerNode elemento = null;
|
||
498 | WMSLayerNode last = null;
|
||
499 | TreePath path = null; |
||
500 | for(int i = removeList.size()-1; i >= 0 ; i--){ |
||
501 | elemento = (WMSLayerNode)removeList.get(i); |
||
502 | for(int j = 0; j < selectedPaths.size(); j++){ |
||
503 | path = (TreePath)selectedPaths.get( j );
|
||
504 | last = (WMSLayerNode)path.getLastPathComponent(); |
||
505 | if (last.getTitle().compareTo(elemento.getTitle()) == 0 ){ |
||
506 | selectedPaths.remove(path); |
||
507 | } |
||
508 | } |
||
509 | } |
||
510 | |||
511 | 4222 | jaume | refreshData(); |
512 | refreshInfo(); |
||
513 | } catch (ArrayIndexOutOfBoundsException ex) { |
||
514 | // if you reach this, please, tell me how you did it.
|
||
515 | ex.printStackTrace(); |
||
516 | 3746 | jaume | } |
517 | } |
||
518 | |||
519 | /**
|
||
520 | * Fires a notification to this wizard listeners telling them if the
|
||
521 | * configuration is fair enough to send a GetMap request.
|
||
522 | * @param b
|
||
523 | */
|
||
524 | private void fireWizardComplete(boolean b){ |
||
525 | listenerSupport.callStateChanged(b); |
||
526 | callStateChanged(b); |
||
527 | } |
||
528 | |||
529 | /**
|
||
530 | * Refreshes the content shown by this.
|
||
531 | */
|
||
532 | 4222 | jaume | public void refreshData() { |
533 | 3746 | jaume | refreshSRS(); |
534 | getLstSelectedLayers().repaint(); |
||
535 | refreshStyleTree(); |
||
536 | refreshDimensions(); |
||
537 | 4222 | jaume | |
538 | 3746 | jaume | } |
539 | 3806 | jaume | |
540 | /**
|
||
541 | * Refreshes the info tab
|
||
542 | *
|
||
543 | */
|
||
544 | public void refreshInfo() { |
||
545 | getTabInfo().refresh(dataSource, |
||
546 | selectedLayersVector(), |
||
547 | getStyleTitles(), |
||
548 | getFormat(), |
||
549 | getSRS(), |
||
550 | getDimensions()); |
||
551 | } |
||
552 | 3746 | jaume | |
553 | private void refreshDimensions() { |
||
554 | int size = getLstSelectedLayers().getModel().getSize();
|
||
555 | boolean enable = false; |
||
556 | for (int i=0; i<size; i++) { |
||
557 | WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers().getModel().getElementAt(i); |
||
558 | if (node.getDimensions()==null) |
||
559 | continue;
|
||
560 | |||
561 | for (int j = 0; j < node.getDimensions().size(); j++) { |
||
562 | IFMapWMSDimension dim = (IFMapWMSDimension) node.getDimensions().get(j); |
||
563 | 4222 | jaume | |
564 | try {
|
||
565 | getTabDimensions().addDimension(dim); |
||
566 | enable = true;
|
||
567 | } catch (IllegalArgumentException e) { |
||
568 | NotificationManager.addWarning("Unrecognized dimension expression: " + dim.getExpression()
|
||
569 | + " (for " + dim.getName() + " in layer '"+node.getName()+"')", null); |
||
570 | } |
||
571 | 3746 | jaume | } |
572 | } |
||
573 | jTabbedPane.setEnabledAt(dimensionTabIndex, enable); |
||
574 | |||
575 | } |
||
576 | |||
577 | /**
|
||
578 | *
|
||
579 | */
|
||
580 | private void refreshStyleTree() { |
||
581 | 4222 | jaume | |
582 | 3746 | jaume | int size = getLstSelectedLayers().getModel().getSize();
|
583 | WMSLayerNode styleRoot = new WMSLayerNode();
|
||
584 | styleRoot.setTitle(PluginServices.getText(this, "selected_themes")); |
||
585 | |||
586 | 3850 | jaume | StyleTreeModel model = new StyleTreeModel(styleRoot);
|
587 | 3746 | jaume | jTabbedPane.setEnabledAt(stylesTabIndex, false);
|
588 | for (int i=0; i<size; i++){ |
||
589 | 4222 | jaume | WMSLayerNode node = (WMSLayerNode) getLstSelectedLayers().getModel().getElementAt(i); |
590 | 3746 | jaume | // If any of the layers defines styles, the tab will be enabled.
|
591 | 4222 | jaume | if (model.addLayerBranch(node)) {
|
592 | 3746 | jaume | jTabbedPane.setEnabledAt(stylesTabIndex, true);
|
593 | } |
||
594 | } |
||
595 | 4222 | jaume | |
596 | 3746 | jaume | getStyleTree().setModel(model); |
597 | getStyleTree().expandAll(); |
||
598 | getStyleTree().repaint(); |
||
599 | } |
||
600 | |||
601 | 4222 | jaume | /**
|
602 | * Takes the array of selected layers and a vector containing the style names
|
||
603 | * and set them as selected in the styles panel
|
||
604 | * @param selectedLayers
|
||
605 | * @param styles
|
||
606 | */
|
||
607 | 3746 | jaume | public void setStyleSelections(Vector styles) { |
608 | 4222 | jaume | |
609 | WMSLayerNode[] layers = selectedLayersToArray();
|
||
610 | int length = layers.length;
|
||
611 | for (int i = 0; i < length; i++) { |
||
612 | String styleName = (String) styles.get(i); |
||
613 | layers[length - i - 1].setSelectedStyleByName(styleName);
|
||
614 | } |
||
615 | 3746 | jaume | } |
616 | 4222 | jaume | |
617 | 3746 | jaume | /**
|
618 | * Gets the currently shown style tree.
|
||
619 | * @return
|
||
620 | */
|
||
621 | private StyleTree getStyleTree() {
|
||
622 | return getTabStyle().getStyleTree();
|
||
623 | } |
||
624 | |||
625 | 4222 | jaume | |
626 | 3746 | jaume | |
627 | /**
|
||
628 | 4222 | jaume | * Method called when pressing the Add layer button or when double-clicking on
|
629 | * a layer from the server's layer tree.
|
||
630 | 3746 | jaume | */
|
631 | 4962 | ldiaz | public void addLayer() { |
632 | 3746 | jaume | boolean alguno = false; |
633 | |||
634 | TreePath[] selecciones = getTreeLayers().getSelectionPaths(); |
||
635 | 3806 | jaume | if (selecciones == null) |
636 | return;
|
||
637 | 3746 | jaume | for (int i = 0; i < selecciones.length; i++) { |
638 | 4473 | ldiaz | selectedPaths.add(selecciones[i]); |
639 | 3746 | jaume | WMSLayerNode nodo = (WMSLayerNode) selecciones[i].getLastPathComponent(); |
640 | 4222 | jaume | if (nodo.getName() == null || nodo.getName().equals("")) |
641 | // no es un node que es puga demanar
|
||
642 | continue;
|
||
643 | if (nodo.isSizeFixed()) {
|
||
644 | if (sizeFixed == null) |
||
645 | sizeFixed = nodo.getFixedSize(); |
||
646 | else if ((sizeFixed.getHeight() != nodo.getFixedSize().getHeight()) || |
||
647 | (sizeFixed.getWidth() != nodo.getFixedSize().getWidth())) { |
||
648 | JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame() |
||
649 | ,PluginServices.getText(this, "server_cant_render_layers")); |
||
650 | 3749 | jaume | continue;
|
651 | 4222 | jaume | } |
652 | } |
||
653 | // s'afegeix a la llista de capes seleccionades
|
||
654 | 3746 | jaume | JDnDListModel modelo = (JDnDListModel) lstSelectedLayers.getModel(); |
655 | |||
656 | if (modelo.addElement(0, nodo.clone())) { |
||
657 | alguno = true;
|
||
658 | } |
||
659 | 3756 | jaume | } |
660 | 3746 | jaume | |
661 | if (alguno) {
|
||
662 | 4222 | jaume | refreshData(); |
663 | 3746 | jaume | } |
664 | 4222 | jaume | refreshInfo(); |
665 | 3746 | jaume | } |
666 | |||
667 | /**
|
||
668 | * This method initializes lstSelectedLayers
|
||
669 | *
|
||
670 | * @return javax.swing.JList
|
||
671 | */
|
||
672 | 4222 | jaume | public LayerList getLstSelectedLayers() {
|
673 | 3746 | jaume | if (lstSelectedLayers == null) { |
674 | 4222 | jaume | lstSelectedLayers = new LayerList();
|
675 | 4606 | jaume | lstSelectedLayers.setModel(new JDnDListModel());
|
676 | 3746 | jaume | lstSelectedLayers.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
677 | lstSelectedLayers.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||
678 | public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
||
679 | fireWizardComplete(isCorrectlyConfigured()); |
||
680 | } |
||
681 | }); |
||
682 | 4222 | jaume | lstSelectedLayers.addMouseListener(new MouseAdapter(){ |
683 | public void mouseReleased(MouseEvent e) { |
||
684 | refreshData(); |
||
685 | } |
||
686 | }); |
||
687 | 3746 | jaume | } |
688 | |||
689 | return lstSelectedLayers;
|
||
690 | } |
||
691 | |||
692 | /**
|
||
693 | * This method initializes lstSRSs
|
||
694 | *
|
||
695 | * @return javax.swing.JList
|
||
696 | */
|
||
697 | public javax.swing.JList getLstSRSs() {
|
||
698 | if (lstSRSs == null) { |
||
699 | lstSRSs = new javax.swing.JList();
|
||
700 | lstSRSs.setModel(new SRSListModel());
|
||
701 | lstSRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
||
702 | lstSRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||
703 | public void valueChanged( |
||
704 | javax.swing.event.ListSelectionEvent e) { |
||
705 | 3850 | jaume | int i = lstSRSs.getSelectedIndex();
|
706 | if (i!=-1) |
||
707 | oldSRS = (String) lstSRSs.getModel().getElementAt(i);
|
||
708 | 3746 | jaume | fireWizardComplete(isCorrectlyConfigured()); |
709 | } |
||
710 | }); |
||
711 | } |
||
712 | |||
713 | return lstSRSs;
|
||
714 | } |
||
715 | |||
716 | /**
|
||
717 | 4222 | jaume | * This method initializes lstFormats
|
718 | 3746 | jaume | *
|
719 | * @return javax.swing.JList
|
||
720 | */
|
||
721 | public javax.swing.JList getLstFormats() {
|
||
722 | if (lstFormats == null) { |
||
723 | lstFormats = new javax.swing.JList();
|
||
724 | lstFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
||
725 | lstFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||
726 | public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
||
727 | fireWizardComplete(isCorrectlyConfigured()); |
||
728 | } |
||
729 | }); |
||
730 | } |
||
731 | |||
732 | return lstFormats;
|
||
733 | } |
||
734 | |||
735 | /**
|
||
736 | 4222 | jaume | * Refreshes the SRS list
|
737 | 3746 | jaume | */
|
738 | private void refreshSRS() { |
||
739 | ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel()).getElements();
|
||
740 | WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
||
741 | |||
742 | 4222 | jaume | SRSListModel model = new SRSListModel();
|
743 | 3746 | jaume | |
744 | if (layers.length == 0) { |
||
745 | 4222 | jaume | lstSRSs.setModel(model);//new DefaultListModel());
|
746 | sizeFixed = null;
|
||
747 | 3746 | jaume | } else {
|
748 | TreeSet srsSet = new TreeSet(); |
||
749 | srsSet.addAll(layers[0].getAllSrs());
|
||
750 | 4222 | jaume | model.setAll(srsSet); |
751 | for (int i = 1; i < layers.length; i++) { |
||
752 | model.setAll(model.intersect(layers[i].getAllSrs())); |
||
753 | 3746 | jaume | } |
754 | lstSRSs.setModel(model); |
||
755 | } |
||
756 | 4222 | jaume | int srsIndex = getSRSIndex( oldSRS );
|
757 | 3746 | jaume | if (srsIndex!=-1) |
758 | getLstSRSs().setSelectedIndex(srsIndex); |
||
759 | |||
760 | } |
||
761 | |||
762 | public void setListenerSupport(WizardListenerSupport support) { |
||
763 | listenerSupport = support; |
||
764 | } |
||
765 | |||
766 | public void setWizardData(WMSWizardData data) { |
||
767 | this.dataSource = data;
|
||
768 | ((JDnDListModel) getLstSelectedLayers().getModel()).clear(); |
||
769 | getLstSelectedLayers().repaint(); |
||
770 | |||
771 | getLstFormats().setModel(new FormatListModel(this.dataSource.getFormats())); |
||
772 | getTreeLayers().setModel(new LayerTreeModel(this.dataSource.getLayer())); |
||
773 | |||
774 | 3806 | jaume | refreshInfo(); |
775 | 3746 | jaume | } |
776 | |||
777 | private Vector getStyleTitles() { |
||
778 | return getTabStyle().getStyleTree().getStyleSelectionTitles();
|
||
779 | } |
||
780 | |||
781 | /**
|
||
782 | * @return
|
||
783 | */
|
||
784 | private Vector selectedLayersVector() { |
||
785 | JDnDListModel mod = (JDnDListModel) getLstSelectedLayers().getModel(); |
||
786 | Vector lyrs = new Vector(); |
||
787 | for (int i = 0; i < mod.getSize(); i++) { |
||
788 | lyrs.add(mod.getElementAt(i)); |
||
789 | } |
||
790 | return lyrs;
|
||
791 | } |
||
792 | |||
793 | public String getFormat() { |
||
794 | return (String) getLstFormats().getSelectedValue(); |
||
795 | } |
||
796 | |||
797 | public String getLayersQuery() { |
||
798 | ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
|
||
799 | WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
||
800 | |||
801 | //Nombre separado por comas de las capas
|
||
802 | 3756 | jaume | String layersQuery = layers[layers.length-1].getName(); |
803 | 3746 | jaume | |
804 | 3756 | jaume | for (int i = layers.length-2; i >= 0; i--) { |
805 | 3746 | jaume | layersQuery += ("," + layers[i].getName());
|
806 | } |
||
807 | |||
808 | return layersQuery;
|
||
809 | |||
810 | } |
||
811 | |||
812 | 4222 | jaume | /**
|
813 | * Returns the current selected SRS.
|
||
814 | * @return
|
||
815 | */
|
||
816 | 3746 | jaume | public String getSRS() { |
817 | return (String) getLstSRSs().getSelectedValue(); |
||
818 | } |
||
819 | |||
820 | 4222 | jaume | /**
|
821 | * Returns the name of the layer that the user has typed-in
|
||
822 | * @return
|
||
823 | */
|
||
824 | 3746 | jaume | public String getLayerName() { |
825 | return getJTxtNomCapa().getText();
|
||
826 | } |
||
827 | |||
828 | 4222 | jaume | public void setLayerName(String name) { |
829 | getJTxtNomCapa().setText(name); |
||
830 | } |
||
831 | |||
832 | public Rectangle2D getLayersRectangle() throws CannotReprojectException{ |
||
833 | 3746 | jaume | ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
|
834 | WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
||
835 | String[] layerNames = new String[layers.length]; |
||
836 | for (int i = 0; i < layerNames.length; i++) { |
||
837 | layerNames[i] = layers[i].getName(); |
||
838 | } |
||
839 | //Boundingbox de todas las capas
|
||
840 | 4222 | jaume | //ArrayList rectangulos = new ArrayList();
|
841 | 3746 | jaume | |
842 | Rectangle2D rect;
|
||
843 | 4222 | jaume | String latLonID;
|
844 | 3746 | jaume | |
845 | 4222 | jaume | rect = dataSource.getBoundingBox(layerNames, getSRS()); |
846 | if(rect == null) { |
||
847 | latLonID = "EPSG:4326";
|
||
848 | rect = dataSource.getBoundingBox(layerNames, latLonID); |
||
849 | if (rect == null) { |
||
850 | rect = dataSource.getBoundingBox(layerNames, "CRS:84");
|
||
851 | } |
||
852 | |||
853 | IProjection reqProj = ProjectionPool.get(getSRS()); |
||
854 | IProjection latLonProj = ProjectionPool.get(latLonID); |
||
855 | if ((reqProj != null) && (latLonProj != null)) { |
||
856 | ICoordTrans ct = new CoordTrans((CoordSys) latLonProj, (CoordSys) reqProj);
|
||
857 | Rectangle2D reprojectedRect;
|
||
858 | reprojectedRect = ct.convert(rect); |
||
859 | rect = reprojectedRect; |
||
860 | } else {
|
||
861 | throw new CannotReprojectException(PluginServices.getText(this, "cannotReproject") + " " + getSRS() + " -> " + latLonID); |
||
862 | } |
||
863 | } |
||
864 | 3746 | jaume | |
865 | return rect;
|
||
866 | } |
||
867 | |||
868 | public TreePath[] getSelectedLayers() { |
||
869 | return getTreeLayers().getSelectionPaths();
|
||
870 | } |
||
871 | |||
872 | 4222 | jaume | public Hashtable getOnlineResources() { |
873 | return dataSource.getOnlineResources();
|
||
874 | 3746 | jaume | } |
875 | |||
876 | /**
|
||
877 | * The piece of the GetMap request that has the layer names.
|
||
878 | * @return
|
||
879 | */
|
||
880 | public String getQueryableLayerQuery() { |
||
881 | ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements();
|
||
882 | WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
||
883 | //Nombre separado por comas de las capas
|
||
884 | String layersQuery = ""; |
||
885 | int i;
|
||
886 | |||
887 | for (i = 0; i < layers.length; i++) { |
||
888 | if (layers[i].isQueryable()) {
|
||
889 | layersQuery = layers[i].getName(); |
||
890 | |||
891 | break;
|
||
892 | } |
||
893 | } |
||
894 | |||
895 | for (int j = i + 1; j < layers.length; j++) { |
||
896 | if (layers[j].isQueryable()) {
|
||
897 | layersQuery += ("," + layers[j].getName());
|
||
898 | } |
||
899 | } |
||
900 | |||
901 | return layersQuery;
|
||
902 | } |
||
903 | |||
904 | /**
|
||
905 | * Returns the index of the CRS within the CRS list.
|
||
906 | *
|
||
907 | * Devuelve la posicion que ocupa el CRS en la lista de CRS
|
||
908 | *
|
||
909 | * @param crs
|
||
910 | * @return The CRS's index if it exists, -1 if it not exists.
|
||
911 | */
|
||
912 | public int getSRSIndex(String crs) { |
||
913 | for (int i=0; i<getLstSRSs().getModel().getSize(); i++){ |
||
914 | if (crs!=null && crs.equals(getLstSRSs().getModel().getElementAt(i))) |
||
915 | return i;
|
||
916 | } |
||
917 | return -1; |
||
918 | } |
||
919 | |||
920 | /**
|
||
921 | * Returns the index of the format within the formats list.
|
||
922 | *
|
||
923 | * Devuelve la posicion que ocupa el formato en la lista de formatos
|
||
924 | * @param format
|
||
925 | *
|
||
926 | * @return The format's index if it exists, -1 if it not exists.
|
||
927 | */
|
||
928 | public int getFormatIndex(String format) { |
||
929 | for (int i=0; i<getLstFormats().getModel().getSize(); i++){ |
||
930 | if (format!=null && format.equals(getLstFormats().getModel().getElementAt(i))) |
||
931 | return i;
|
||
932 | } |
||
933 | return -1; |
||
934 | } |
||
935 | |||
936 | /**
|
||
937 | * This method initializes jTabbedPane
|
||
938 | *
|
||
939 | * @return javax.swing.JTabbedPane
|
||
940 | */
|
||
941 | public JTabbedPane getJTabbedPane() { |
||
942 | if (jTabbedPane == null) { |
||
943 | jTabbedPane = new JTabbedPane(); |
||
944 | jTabbedPane.setBounds(3, 3, 475, 415); |
||
945 | InfoPanel ip = getTabInfo(); |
||
946 | ip.addFocusListener(new FocusListener(){ |
||
947 | public void focusGained(FocusEvent e) { |
||
948 | 3806 | jaume | refreshInfo(); |
949 | 3746 | jaume | } |
950 | public void focusLost(FocusEvent e) { |
||
951 | } |
||
952 | }); |
||
953 | |||
954 | StylesPanel sp = getTabStyle(); |
||
955 | 3756 | jaume | DimensionPanel dp = getTabDimensions(); |
956 | 3746 | jaume | |
957 | |||
958 | jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, null); |
||
959 | jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null); |
||
960 | jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null); |
||
961 | stylesTabIndex = jTabbedPane.getTabCount()-1;
|
||
962 | jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"), null, dp, null); |
||
963 | dimensionTabIndex = jTabbedPane.getTabCount()-1;
|
||
964 | jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getTabFormats(), null); |
||
965 | jTabbedPane.setEnabledAt(dimensionTabIndex, false);
|
||
966 | jTabbedPane.setEnabledAt(stylesTabIndex, false);
|
||
967 | } |
||
968 | return jTabbedPane;
|
||
969 | } |
||
970 | |||
971 | /**
|
||
972 | * This method initializes jPanel
|
||
973 | *
|
||
974 | * @return javax.swing.JPanel
|
||
975 | */
|
||
976 | private JPanel getTabLayers() { |
||
977 | if (tabLayers == null) { |
||
978 | tabLayers = new JPanel(); |
||
979 | tabLayers.setLayout(null);
|
||
980 | tabLayers.add(getJPanel4(), null);
|
||
981 | tabLayers.add(getJPanel2(), null);
|
||
982 | } |
||
983 | return tabLayers;
|
||
984 | } |
||
985 | |||
986 | /**
|
||
987 | * This method initializes jPanel1
|
||
988 | *
|
||
989 | * @return javax.swing.JPanel
|
||
990 | */
|
||
991 | private JPanel getJPanel1() { |
||
992 | if (jPanel1 == null) { |
||
993 | jPanel1 = new JPanel(); |
||
994 | jPanel1.setLayout(null);
|
||
995 | jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
||
996 | 3774 | jaume | null, PluginServices.getText(this, "select_formats"), |
997 | 3746 | jaume | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
998 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
999 | jPanel1.setBounds(7, 10, 453, 194); |
||
1000 | jPanel1.add(getJScrollPane6(), null);
|
||
1001 | jPanel1.add(getChkTransparency(), null);
|
||
1002 | } |
||
1003 | return jPanel1;
|
||
1004 | } |
||
1005 | |||
1006 | /**
|
||
1007 | * This method initializes jPanel5
|
||
1008 | *
|
||
1009 | * @return javax.swing.JPanel
|
||
1010 | */
|
||
1011 | private JPanel getJPanel5() { |
||
1012 | if (jPanel5 == null) { |
||
1013 | jPanel5 = new JPanel(); |
||
1014 | jPanel5.setLayout(null);
|
||
1015 | jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder( |
||
1016 | null, PluginServices.getText(this, "seleccionar_srs"), |
||
1017 | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
||
1018 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
1019 | jPanel5.setBounds(7, 210, 453, 168); |
||
1020 | jPanel5.add(getJScrollPane2(), null);
|
||
1021 | } |
||
1022 | return jPanel5;
|
||
1023 | } |
||
1024 | |||
1025 | /**
|
||
1026 | * This method initializes jPanel6
|
||
1027 | *
|
||
1028 | * @return javax.swing.JPanel
|
||
1029 | */
|
||
1030 | private StylesPanel getTabStyle() {
|
||
1031 | if (tabStyle == null) { |
||
1032 | 4222 | jaume | tabStyle = new StylesPanel(this); |
1033 | 3746 | jaume | tabStyle.setEnabled(false);
|
1034 | 3850 | jaume | tabStyle.addListener(new BeanListener(){
|
1035 | public void beanValueChanged(Object value) { |
||
1036 | 4222 | jaume | fireWizardComplete(isCorrectlyConfigured()); |
1037 | 3850 | jaume | }; |
1038 | }); |
||
1039 | 4222 | jaume | tabStyle.addFocusListener(new FocusAdapter() { |
1040 | public void focusGained(FocusEvent e) { |
||
1041 | refreshStyleTree(); |
||
1042 | } |
||
1043 | }); |
||
1044 | 3746 | jaume | } |
1045 | return tabStyle;
|
||
1046 | } |
||
1047 | |||
1048 | /**
|
||
1049 | * Sets the focus to the tab next to the current one.
|
||
1050 | *
|
||
1051 | * Enfoca a la solapa siguiente a la actualmente enfocada del TabbedPane
|
||
1052 | *
|
||
1053 | */
|
||
1054 | public void avanzaTab(){ |
||
1055 | int currentPage = currentPage();
|
||
1056 | int nPages = getNumTabs();
|
||
1057 | if (nPages -1 > currentPage){ |
||
1058 | getJTabbedPane().setSelectedIndex(nextEnabledPage()); |
||
1059 | } |
||
1060 | } |
||
1061 | |||
1062 | /**
|
||
1063 | * Sets the focus to the tab previous to the current one.
|
||
1064 | *
|
||
1065 | * Enfoca a la solapa anterior a la actualmente enfocada del TabbedPane
|
||
1066 | *
|
||
1067 | */
|
||
1068 | public void retrocedeTab(){ |
||
1069 | this.getJTabbedPane().setSelectedIndex(previousEnabledPage());
|
||
1070 | |||
1071 | } |
||
1072 | /**
|
||
1073 | * Returns the index of the current tab.
|
||
1074 | *
|
||
1075 | 4222 | jaume | * Devuelve el ?ndice de la p?gina actual del wizard.
|
1076 | 3746 | jaume | *
|
1077 | * @return
|
||
1078 | */
|
||
1079 | public int currentPage(){ |
||
1080 | return getJTabbedPane().getSelectedIndex();
|
||
1081 | } |
||
1082 | |||
1083 | /**
|
||
1084 | * Returns the tab amount that the WMSParamsPanel currently have
|
||
1085 | *
|
||
1086 | 4222 | jaume | * Devuelve el n?mero de solapas que tiene actualmente el WMSParamsPanel
|
1087 | 3746 | jaume | *
|
1088 | * @return int
|
||
1089 | */
|
||
1090 | public int getNumTabs(){ |
||
1091 | return getJTabbedPane().getTabCount();
|
||
1092 | } |
||
1093 | |||
1094 | /**
|
||
1095 | * <p>
|
||
1096 | * Returns the index of the previous enabled tab.
|
||
1097 | * </p>
|
||
1098 | * <p>
|
||
1099 | 4222 | jaume | * Devuelve el ?ndice de la anterior p?gina habilitada del wizard o -1 si no hay
|
1100 | 3746 | jaume | * ninguna.
|
1101 | * </p>
|
||
1102 | * @return The index, or -1 if there is no one.
|
||
1103 | */
|
||
1104 | public int previousEnabledPage(){ |
||
1105 | int currentPage = currentPage();
|
||
1106 | int j=0; |
||
1107 | if (currentPage == 0) |
||
1108 | j= -1;
|
||
1109 | for (int i = currentPage-1; i>-1; i--){ |
||
1110 | if (getJTabbedPane().isEnabledAt(i)){
|
||
1111 | j= i; |
||
1112 | break;
|
||
1113 | } |
||
1114 | } |
||
1115 | return j;
|
||
1116 | } |
||
1117 | |||
1118 | /**
|
||
1119 | * <p>
|
||
1120 | * Returns the previous of the previous enabled tab.
|
||
1121 | * </p>
|
||
1122 | * <p>
|
||
1123 | 4222 | jaume | * Devuelve el ?ndice de la siguiente p?gina habilitada del wizard o -1 si no hay
|
1124 | 3746 | jaume | * ninguna.
|
1125 | * </p>
|
||
1126 | * @return The index, or -1 if there is no one.
|
||
1127 | */
|
||
1128 | public int nextEnabledPage() { |
||
1129 | int currentPage = currentPage();
|
||
1130 | int nPages = getNumTabs();
|
||
1131 | if (currentPage == nPages)
|
||
1132 | return -1; |
||
1133 | for (int i=currentPage+1; i<nPages; i++){ |
||
1134 | if (getJTabbedPane().isEnabledAt(i)){
|
||
1135 | return i;
|
||
1136 | } |
||
1137 | } |
||
1138 | return -1; |
||
1139 | } |
||
1140 | |||
1141 | /**
|
||
1142 | * Selects/deselects the transparency checkbox.
|
||
1143 | * @param b
|
||
1144 | */
|
||
1145 | public void setTransparent(boolean b) { |
||
1146 | 4222 | jaume | getChkTransparency().setSelected(b); |
1147 | 3746 | jaume | } |
1148 | /**
|
||
1149 | * This method initializes chkTrasparency
|
||
1150 | *
|
||
1151 | * @return javax.swing.JCheckBox
|
||
1152 | */
|
||
1153 | private JCheckBox getChkTransparency() { |
||
1154 | if (chkTransparency == null) { |
||
1155 | chkTransparency = new JCheckBox(); |
||
1156 | chkTransparency.setText(PluginServices.getText(this, "wms_transparency")); |
||
1157 | chkTransparency.setSelected(true);
|
||
1158 | 4222 | jaume | chkTransparency.addItemListener(new java.awt.event.ItemListener() {
|
1159 | public void itemStateChanged(java.awt.event.ItemEvent e) { |
||
1160 | fireWizardComplete(isCorrectlyConfigured()); |
||
1161 | } |
||
1162 | }); |
||
1163 | 3746 | jaume | chkTransparency.setBounds(5, 168, 441, 21); |
1164 | 4222 | jaume | |
1165 | 3746 | jaume | } |
1166 | return chkTransparency;
|
||
1167 | } |
||
1168 | |||
1169 | /**
|
||
1170 | * Returns a vector of strings containing the styles selected for the
|
||
1171 | * layers. A blank style is correct and means that default style will
|
||
1172 | * be used.
|
||
1173 | *
|
||
1174 | * @return Vector
|
||
1175 | */
|
||
1176 | public Vector getStyles() { |
||
1177 | 4222 | jaume | Vector v = new Vector(); |
1178 | WMSLayerNode[] layers = selectedLayersToArray();
|
||
1179 | for (int i = 0; i < layers.length; i++) { |
||
1180 | FMapWMSStyle sty = layers[i].getSelectedStyle(); |
||
1181 | String s = (sty!=null)? sty.name : ""; |
||
1182 | v.add(s); |
||
1183 | } |
||
1184 | return v;
|
||
1185 | 3746 | jaume | } |
1186 | 4222 | jaume | |
1187 | 3746 | jaume | /**
|
1188 | * This method initializes tabInfo
|
||
1189 | *
|
||
1190 | * @return javax.swing.JPanel
|
||
1191 | */
|
||
1192 | private InfoPanel getTabInfo() {
|
||
1193 | if (tabInfo == null) { |
||
1194 | tabInfo = new InfoPanel();
|
||
1195 | |||
1196 | } |
||
1197 | return tabInfo;
|
||
1198 | } |
||
1199 | |||
1200 | public void setDimensions(Vector dimensions) { |
||
1201 | for (int i = 0; i < dimensions.size(); i++) { |
||
1202 | 4222 | jaume | String st = (String) dimensions.get(i); |
1203 | if (st.split("=").length == 2) { |
||
1204 | String[] s = st.split("="); |
||
1205 | getTabDimensions().setDimensionValue(s[0], s[1]); |
||
1206 | } |
||
1207 | 3746 | jaume | } |
1208 | |||
1209 | } |
||
1210 | |||
1211 | /**
|
||
1212 | * This method initializes tabDimension
|
||
1213 | *
|
||
1214 | * @return javax.swing.JPanel
|
||
1215 | */
|
||
1216 | 3756 | jaume | private DimensionPanel getTabDimensions() {
|
1217 | 3746 | jaume | if (tabDimensions == null) { |
1218 | 3756 | jaume | tabDimensions = new DimensionPanel();
|
1219 | 3746 | jaume | tabDimensions.setEnabled(false);
|
1220 | 3850 | jaume | tabDimensions.addListener(new BeanListener(){
|
1221 | public void beanValueChanged(Object value) { |
||
1222 | Vector myDimensions = (Vector) value; |
||
1223 | 4222 | jaume | if (value!=null && ( oldDimensions == null || |
1224 | !(oldDimensions.size() == myDimensions.size() |
||
1225 | && oldDimensions.containsAll(myDimensions))) |
||
1226 | ){ |
||
1227 | 3850 | jaume | oldDimensions = myDimensions; |
1228 | 4222 | jaume | } |
1229 | fireWizardComplete(isCorrectlyConfigured()); |
||
1230 | 3850 | jaume | } |
1231 | }); |
||
1232 | 3746 | jaume | |
1233 | } |
||
1234 | return tabDimensions;
|
||
1235 | } |
||
1236 | |||
1237 | /**
|
||
1238 | * @return
|
||
1239 | */
|
||
1240 | public boolean getTransparency() { |
||
1241 | return getChkTransparency().isSelected();
|
||
1242 | } |
||
1243 | |||
1244 | /**
|
||
1245 | * @return
|
||
1246 | */
|
||
1247 | public Vector getDimensions() { |
||
1248 | return getTabDimensions().getDimensions();
|
||
1249 | } |
||
1250 | |||
1251 | public void initWizard() {} |
||
1252 | public void execute() { } |
||
1253 | 4947 | ldiaz | |
1254 | //changed by Laura:
|
||
1255 | //To relegate getLayer to ParamsPanel from WMSWizard and WMSProps
|
||
1256 | //public FLayer getLayer() { return null; }
|
||
1257 | public FLayer getLayer(){
|
||
1258 | if(getDisagregatedLayers()){
|
||
1259 | return getLayerTree();
|
||
1260 | }else{
|
||
1261 | return getLayerPlain();
|
||
1262 | } |
||
1263 | } |
||
1264 | /**
|
||
1265 | * If user does not select the chekbox Disagregate layers, will get the layer tree in WMS
|
||
1266 | * @return
|
||
1267 | */
|
||
1268 | protected FLayer getLayerTree() {
|
||
1269 | LayerTree layerTree = getLayerStructure(); |
||
1270 | TreePath[] selection = (TreePath[])getSelectedPaths().toArray(new TreePath[0]);//layerTree.getSelectionPaths(); |
||
1271 | if (selection!=null){ |
||
1272 | return getSubTree((WMSLayerNode)layerTree.getModel().getRoot(), selection);
|
||
1273 | } |
||
1274 | return null; |
||
1275 | } |
||
1276 | |||
1277 | protected boolean nodeSelected(TreePath[] selection, WMSLayerNode node){ |
||
1278 | for (int i = 0; i < selection.length; i++) { |
||
1279 | Object[] components = selection[i].getPath(); |
||
1280 | for (int j=0; j < components.length ; j++) |
||
1281 | { |
||
1282 | if (components[j] instanceof WMSLayerNode){ |
||
1283 | if (((WMSLayerNode)components[j]).getTitle().compareTo(node.getTitle()) == 0){ |
||
1284 | return true; |
||
1285 | } |
||
1286 | } |
||
1287 | } |
||
1288 | } |
||
1289 | return false; |
||
1290 | } |
||
1291 | |||
1292 | protected FLayer getSubTree(WMSLayerNode node, TreePath[] selection) |
||
1293 | { |
||
1294 | if (node.getChildren().size() > 0) |
||
1295 | { |
||
1296 | FLayers l = null;
|
||
1297 | if (this.getMapCtrl() == null){ |
||
1298 | com.iver.cit.gvsig.gui.View v = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
||
1299 | l = new FLayers(v.getMapControl().getMapContext(), null); |
||
1300 | }else{
|
||
1301 | l = new FLayers(this.getMapCtrl().getMapContext(), null); |
||
1302 | } |
||
1303 | |||
1304 | l.setName(node.getTitle()); |
||
1305 | for(int i = 0; i < node.getChildren().size(); i++ ){ |
||
1306 | if (nodeSelected(selection, (WMSLayerNode)(node.getChildren().get(i))))
|
||
1307 | { |
||
1308 | FLayer lyr = getSubTree((WMSLayerNode)node.getChildren().get(i), selection); |
||
1309 | if(lyr != null){ |
||
1310 | l.addLayer(lyr); |
||
1311 | } |
||
1312 | } |
||
1313 | } |
||
1314 | return l;
|
||
1315 | } |
||
1316 | else{
|
||
1317 | if (nodeSelected(selection, node))
|
||
1318 | { |
||
1319 | FLyrWMS layer = new FLyrWMS();
|
||
1320 | //layer.setHost(getHost());
|
||
1321 | try {
|
||
1322 | layer.setHost(new URL(dataSource.getHost())); |
||
1323 | layer.setFullExtent(getLayersRectangle()); |
||
1324 | } catch (CannotReprojectException e) {
|
||
1325 | e.printStackTrace(); |
||
1326 | return null; |
||
1327 | } catch (MalformedURLException e) { |
||
1328 | e.printStackTrace(); |
||
1329 | return null; |
||
1330 | } |
||
1331 | layer.setFormat(getFormat()); |
||
1332 | layer.setLayerQuery(node.getName()); |
||
1333 | layer.setInfoLayerQuery(getQueryableLayerQuery()); |
||
1334 | layer.setSRS(getSRS()); |
||
1335 | layer.setName(node.getTitle()); |
||
1336 | layer.setWmsTransparency(getTransparency()); |
||
1337 | layer.setStyles(getStyles()); |
||
1338 | layer.setDimensions(getDimensions()); |
||
1339 | 5292 | jaume | // layer.setDriver(getDriver());
|
1340 | 4947 | ldiaz | layer.setOnlineResources(getOnlineResources()); |
1341 | layer.setFixedSize(getFixedSize()); |
||
1342 | //layer.setQueryable(isQueryable());
|
||
1343 | layer.setQueryable(dataSource.isQueryable()); |
||
1344 | return layer;
|
||
1345 | |||
1346 | }else{
|
||
1347 | return null; |
||
1348 | } |
||
1349 | } |
||
1350 | } |
||
1351 | 3746 | jaume | |
1352 | 4947 | ldiaz | /**
|
1353 | * If user selects the chekbox Disagregate layers, will get the selected layers rendered in one
|
||
1354 | * the tree structure in WMS will be lost.
|
||
1355 | * @return
|
||
1356 | */
|
||
1357 | protected FLayer getLayerPlain(){
|
||
1358 | FLyrWMS layer = new FLyrWMS();
|
||
1359 | //layer.setHost(getHost());
|
||
1360 | try{
|
||
1361 | layer.setFullExtent(getLayersRectangle()); |
||
1362 | layer.setHost(new URL(dataSource.getHost())); |
||
1363 | }catch(CannotReprojectException ex){
|
||
1364 | ex.printStackTrace(); |
||
1365 | JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), ex.getMessage()); |
||
1366 | return null; |
||
1367 | } catch (MalformedURLException e) { |
||
1368 | e.printStackTrace(); |
||
1369 | return null; |
||
1370 | } |
||
1371 | layer.setFormat(getFormat()); |
||
1372 | layer.setLayerQuery(getLayersQuery()); |
||
1373 | layer.setInfoLayerQuery(getQueryableLayerQuery()); |
||
1374 | layer.setSRS(getSRS()); |
||
1375 | layer.setName(getLayerName()); |
||
1376 | layer.setWmsTransparency(getTransparency()); |
||
1377 | layer.setStyles(getStyles()); |
||
1378 | layer.setDimensions(getDimensions()); |
||
1379 | 5292 | jaume | // layer.setDriver(getDriver());
|
1380 | 4947 | ldiaz | layer.setOnlineResources(getOnlineResources()); |
1381 | layer.setFixedSize(getFixedSize()); |
||
1382 | //layer.setQueryable(isQueryable());
|
||
1383 | layer.setQueryable(dataSource.isQueryable()); |
||
1384 | return layer;
|
||
1385 | } |
||
1386 | //---------------------
|
||
1387 | |||
1388 | 3746 | jaume | public FMapWMSDriver getDriver() {
|
1389 | return dataSource.getDriver();
|
||
1390 | } |
||
1391 | |||
1392 | 4222 | jaume | public Dimension getFixedSize() { |
1393 | return sizeFixed;
|
||
1394 | } |
||
1395 | 3746 | jaume | |
1396 | 4222 | jaume | /**
|
1397 | * This method initializes chkExtendedNames
|
||
1398 | *
|
||
1399 | * @return javax.swing.JCheckBox
|
||
1400 | */
|
||
1401 | private JCheckBox getChkExtendedNames() { |
||
1402 | if (chkExtendedNames == null) { |
||
1403 | chkExtendedNames = new JCheckBox(); |
||
1404 | chkExtendedNames.setText(PluginServices.getText(this, "show_layer_names")); |
||
1405 | chkExtendedNames.addItemListener(new java.awt.event.ItemListener() {
|
||
1406 | public void itemStateChanged(java.awt.event.ItemEvent e) { |
||
1407 | boolean b = chkExtendedNames.isSelected();
|
||
1408 | getTreeLayers().showLayerNames = b; |
||
1409 | getTreeLayers().repaint(); |
||
1410 | getLstSelectedLayers().showLayerNames = b; |
||
1411 | getLstSelectedLayers().repaint(); |
||
1412 | getStyleTree().showLayerNames = b; |
||
1413 | } |
||
1414 | }); |
||
1415 | chkExtendedNames.addActionListener(new java.awt.event.ActionListener() {
|
||
1416 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
1417 | fPrefs.putBoolean("show_layer_names", chkExtendedNames.isSelected());
|
||
1418 | } |
||
1419 | }); |
||
1420 | chkExtendedNames.setBounds(46, 300, 150, 20); |
||
1421 | chkExtendedNames.setSelected(fPrefs.getBoolean("show_layer_names", false)); |
||
1422 | |||
1423 | } |
||
1424 | return chkExtendedNames;
|
||
1425 | } |
||
1426 | |||
1427 | /**
|
||
1428 | * This method initializes btnUp
|
||
1429 | *
|
||
1430 | * @return javax.swing.JButton
|
||
1431 | */
|
||
1432 | private JButton getBtnUp() { |
||
1433 | if (btnUp == null) { |
||
1434 | btnUp = new JButton(); |
||
1435 | 4449 | ldiaz | btnUp.setBounds(11, 184, 30, 30); |
1436 | 4222 | jaume | btnUp.setToolTipText(PluginServices.getText(this, "move_layer_up")); |
1437 | btnUp.addActionListener(new java.awt.event.ActionListener() {
|
||
1438 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
1439 | LayerList list = getLstSelectedLayers(); |
||
1440 | int[] selectedIndices = list.getSelectedIndices(); |
||
1441 | int index = list.getSelectedIndex();
|
||
1442 | if (selectedIndices != null && selectedIndices.length==1 && index > 0 ) { |
||
1443 | JDnDListModel m = (JDnDListModel) list.getModel(); |
||
1444 | m.itemsMoved(index - 1, new int[] {index}); |
||
1445 | list.setSelectedIndex(index - 1);
|
||
1446 | } |
||
1447 | } |
||
1448 | }); |
||
1449 | btnUp.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/up-arrow.png"))); |
||
1450 | } |
||
1451 | return btnUp;
|
||
1452 | } |
||
1453 | |||
1454 | 4961 | jaume | |
1455 | 4222 | jaume | /**
|
1456 | * This method initializes btnDown
|
||
1457 | *
|
||
1458 | * @return javax.swing.JButton
|
||
1459 | */
|
||
1460 | private JButton getBtnDown() { |
||
1461 | if (btnDown == null) { |
||
1462 | btnDown = new JButton(); |
||
1463 | 4449 | ldiaz | btnDown.setBounds(11, 215, 30, 30); |
1464 | 4222 | jaume | btnDown.setToolTipText(PluginServices.getText(this, "move_layer_down")); |
1465 | btnDown.addActionListener(new java.awt.event.ActionListener() {
|
||
1466 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
1467 | LayerList list = getLstSelectedLayers(); |
||
1468 | int[] selectedIndices = list.getSelectedIndices(); |
||
1469 | int index = list.getSelectedIndex();
|
||
1470 | if (selectedIndices != null && selectedIndices.length == 1 && index < getLstSelectedLayers().getModel().getSize()-1) { |
||
1471 | JDnDListModel m = (JDnDListModel) list.getModel(); |
||
1472 | m.itemsMoved(index + 1, new int[] {index}); |
||
1473 | list.setSelectedIndex( index + 1);
|
||
1474 | } |
||
1475 | } |
||
1476 | }); |
||
1477 | btnDown.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/down-arrow.png"))); |
||
1478 | } |
||
1479 | return btnDown;
|
||
1480 | } |
||
1481 | |||
1482 | public void setFixedSize(Dimension sz) { |
||
1483 | sizeFixed = sz; |
||
1484 | } |
||
1485 | 4449 | ldiaz | |
1486 | 4473 | ldiaz | public ArrayList getSelectedPaths(){ |
1487 | return selectedPaths;
|
||
1488 | } |
||
1489 | 4962 | ldiaz | |
1490 | public LayerTree getJustTreeLayer(){
|
||
1491 | return treeLayers;
|
||
1492 | } |
||
1493 | |||
1494 | |||
1495 | 4449 | ldiaz | /**
|
1496 | * This method initializes chkDisagregate
|
||
1497 | *
|
||
1498 | * @return javax.swing.JCheckBox
|
||
1499 | */
|
||
1500 | private JCheckBox getChkDisagregate() { |
||
1501 | if (chkDisagregate == null) { |
||
1502 | 4962 | ldiaz | |
1503 | 4449 | ldiaz | chkDisagregate = new JCheckBox(); |
1504 | 4492 | ldiaz | chkDisagregate.setBounds(new java.awt.Rectangle(46,276,247,20)); |
1505 | 4449 | ldiaz | chkDisagregate.setText(PluginServices.getText(this, "disagregate_layers")); |
1506 | 4962 | ldiaz | |
1507 | chkDisagregate.addActionListener(new java.awt.event.ActionListener() {
|
||
1508 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
1509 | fPrefs.putBoolean("disagregate_layers", chkDisagregate.isSelected());
|
||
1510 | } |
||
1511 | }); |
||
1512 | chkDisagregate.setSelected(fPrefs.getBoolean("disagregate_layers", false)); |
||
1513 | |||
1514 | 4449 | ldiaz | } |
1515 | return chkDisagregate;
|
||
1516 | } |
||
1517 | |||
1518 | public boolean getDisagregatedLayers(){ |
||
1519 | return chkDisagregate.isSelected();
|
||
1520 | } |
||
1521 | 4222 | jaume | } // @jve:decl-index=0:visual-constraint="10,10" |