Revision 215 org.gvsig.raster.app/trunk/org.gvsig.raster.app/org.gvsig.raster.app.wmtsclient/src/main/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/WMTSParamsPanel.java
WMTSParamsPanel.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel; |
24 | 24 |
|
25 |
import java.awt.Component; |
|
26 | 25 |
import java.awt.Dimension; |
27 | 26 |
import java.awt.event.FocusAdapter; |
28 | 27 |
import java.awt.event.FocusEvent; |
29 | 28 |
import java.awt.event.FocusListener; |
30 | 29 |
import java.awt.event.MouseAdapter; |
31 | 30 |
import java.awt.event.MouseEvent; |
32 |
import java.util.AbstractCollection; |
|
33 | 31 |
import java.util.ArrayList; |
34 | 32 |
import java.util.TreeSet; |
35 | 33 |
import java.util.Vector; |
36 | 34 |
import java.util.prefs.Preferences; |
37 | 35 |
|
36 |
import javax.swing.JButton; |
|
38 | 37 |
import javax.swing.JCheckBox; |
39 | 38 |
import javax.swing.JList; |
40 |
import javax.swing.JOptionPane; |
|
41 | 39 |
import javax.swing.JPanel; |
42 | 40 |
import javax.swing.JScrollPane; |
43 | 41 |
import javax.swing.JTabbedPane; |
... | ... | |
45 | 43 |
import javax.swing.tree.TreePath; |
46 | 44 |
|
47 | 45 |
import org.gvsig.andami.PluginServices; |
48 |
import org.gvsig.andami.messages.NotificationManager; |
|
49 | 46 |
import org.gvsig.app.gui.WizardPanel; |
50 | 47 |
import org.gvsig.app.gui.wizards.WizardListenerSupport; |
51 | 48 |
import org.gvsig.fmap.dal.DataStoreParameters; |
52 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
53 |
import org.gvsig.fmap.dal.coverage.datastruct.RemoteStyle; |
|
54 | 49 |
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer; |
55 |
import org.gvsig.fmap.dal.coverage.store.remote.RemoteLayerNode; |
|
56 |
import org.gvsig.fmap.dal.coverage.store.remote.RemoteTimeDimension; |
|
57 | 50 |
import org.gvsig.gui.beans.controls.dnd.JDnDListModel; |
58 | 51 |
import org.gvsig.gui.beans.listeners.BeanListener; |
59 |
import org.gvsig.gui.beans.swing.JButton;
|
|
52 |
import org.gvsig.raster.app.extension.wmtsclient.gui.wizard.LayerTreeModel;
|
|
60 | 53 |
import org.gvsig.raster.app.extension.wmtsclient.gui.wizard.SRSListModel; |
54 |
import org.gvsig.remoteclient.wmts.struct.WMTSTheme; |
|
61 | 55 |
|
62 | 56 |
|
63 | 57 |
/** |
... | ... | |
71 | 65 |
* |
72 | 66 |
* The information is obtained from a WMSWizardDataSource object. |
73 | 67 |
* |
74 |
* |
|
75 |
* Esta clase implementa el panel de opciones disponibles sobre el mapa |
|
76 |
* |
|
77 |
* Incluye una serie de Listeners que implementan unas reglas de control que |
|
78 |
* refrescan los valores de componentes cuyos valores dependen de aqu�llos |
|
79 |
* seleccionados en otros componentes para evitar que se escoja una combinaci�n |
|
80 |
* de opciones err�nea as� como una funci�n (isCorrectlyConfigured()) que |
|
81 |
* comprueba si la combinaci�n escogida actualmente es suficiente para lanzar |
|
82 |
* una operaci�n GetMap correctamente. |
|
83 |
* |
|
84 |
* La informaci�n obtiene a partir de un objeto WMSWizardDataSource. |
|
85 |
* |
|
86 |
* @author jaume - jaume dominguez faus |
|
87 |
* |
|
68 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
88 | 69 |
*/ |
89 |
@SuppressWarnings("deprecation")
|
|
70 |
@SuppressWarnings("unchecked")
|
|
90 | 71 |
public class WMTSParamsPanel extends WizardPanel { |
91 |
private static final long serialVersionUID = 1L; |
|
92 |
private JScrollPane jScrollPane1 = null; |
|
93 |
private JScrollPane jScrollPane2 = null; |
|
94 |
private JScrollPane jScrollPane5 = null; |
|
95 |
private JButton btnAdd = null; |
|
96 |
private JButton btnDel = null; |
|
97 |
private JScrollPane jScrollPane6 = null; |
|
98 |
private JPanel jPanel2 = null; |
|
99 |
private JPanel tabFormats = null; |
|
100 |
private JPanel jPanel4 = null; |
|
101 |
private JTextField jTxtNomCapa = null; |
|
102 |
private ArrayList<TreePath> selectedPaths = new ArrayList<TreePath>(); |
|
103 |
private JList lstSRSs = null; |
|
104 |
private JList lstFormats = null; |
|
105 |
private WizardListenerSupport listenerSupport; |
|
106 |
private JTabbedPane jTabbedPane = null; |
|
107 |
private JPanel tabLayers = null; |
|
108 |
private JPanel jPanel1 = null; |
|
109 |
private JPanel jPanel5 = null; |
|
110 |
private StylesPanel tabStyle = null; |
|
111 |
private JCheckBox chkTransparency = null; |
|
112 |
private InfoPanel tabInfo = null; |
|
113 |
private DimensionPanel tabDimensions = null; |
|
72 |
private static final long serialVersionUID = 1L; |
|
73 |
private JScrollPane jScrollTreeLayers = null; |
|
74 |
private JScrollPane jScrollLstSrs = null; |
|
75 |
private JScrollPane jScrollLstSelectedLayers = null; |
|
76 |
private JButton btnAdd = null; |
|
77 |
private JButton btnDel = null; |
|
78 |
private JPanel jPanel2 = null; |
|
79 |
private JPanel tabFormats = null; |
|
80 |
private JPanel jPanel4 = null; |
|
81 |
private JTextField jTxtNomCapa = null; |
|
82 |
private ArrayList<TreePath> selectedPaths = new ArrayList<TreePath>(); |
|
83 |
private JList lstSRSs = null; |
|
84 |
private JScrollPane jScrollImageFormats = null; |
|
85 |
private JList lstImageFormats = null; |
|
86 |
private JScrollPane jScrollInfoFormats = null; |
|
87 |
private JList lstInfoFormats = null; |
|
88 |
private WizardListenerSupport listenerSupport = null; |
|
89 |
private JTabbedPane jTabbedPane = null; |
|
90 |
private JPanel tabLayers = null; |
|
91 |
private JPanel jPanelImageFormats = null; |
|
92 |
private JPanel jPanelInfoFormats = null; |
|
93 |
private JPanel jPanelLstSrs = null; |
|
94 |
private StylesPanel tabStyle = null; |
|
95 |
private JCheckBox chkTransparency = null; |
|
96 |
private InfoPanel tabInfo = null; |
|
114 | 97 |
private int dimensionTabIndex; |
115 | 98 |
private int stylesTabIndex; |
116 |
private String oldSRS = null; |
|
117 |
@SuppressWarnings("unchecked") |
|
118 |
private AbstractCollection oldDimensions = null; |
|
119 |
private Dimension sizeFixed; |
|
120 |
private JCheckBox chkExtendedNames = null; |
|
121 |
private JButton btnUp = null; |
|
122 |
private JButton btnDown = null; |
|
123 |
private LayerTree treeLayers = null; |
|
124 |
private LayerList lstSelectedLayers = null; |
|
125 |
protected WMTSServerExplorer explorer = null; |
|
126 |
public static Preferences fPrefs = Preferences.userRoot().node( |
|
127 |
"gvsig.wmts-wizard"); |
|
128 |
private JCheckBox chkDisagregate = null; |
|
99 |
private String oldSRS = null; |
|
100 |
private Dimension sizeFixed = null; |
|
101 |
private JCheckBox chkExtendedNames = null; |
|
102 |
private JButton btnUp = null; |
|
103 |
private JButton btnDown = null; |
|
104 |
private LayerTree treeLayers = null; |
|
105 |
private LayerList lstSelectedLayers = null; |
|
106 |
protected WMTSServerExplorer explorer = null; |
|
107 |
public static Preferences fPrefs = Preferences.userRoot().node("gvsig.wmts-wizard"); |
|
108 |
private JCheckBox chkDisagregate = null; |
|
129 | 109 |
|
130 | 110 |
public WMTSParamsPanel() { |
131 | 111 |
super(); |
... | ... | |
143 | 123 |
jTabbedPane = new JTabbedPane(); |
144 | 124 |
jTabbedPane.setBounds(4, 4, 502, 415); |
145 | 125 |
StylesPanel sp = getTabStyle(); |
146 |
DimensionPanel dp = getTabDimensions(); |
|
147 | 126 |
|
148 |
jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, |
|
149 |
getTabLayers(), null); |
|
150 |
jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, |
|
151 |
sp, null); |
|
127 |
jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null); |
|
128 |
jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null); |
|
152 | 129 |
stylesTabIndex = jTabbedPane.getTabCount() - 1; |
153 |
jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"), |
|
154 |
null, dp, null); |
|
155 | 130 |
dimensionTabIndex = jTabbedPane.getTabCount() - 1; |
156 |
jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, |
|
157 |
getTabFormats(), null); |
|
131 |
jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getTabFormats(), null); |
|
158 | 132 |
jTabbedPane.setEnabledAt(dimensionTabIndex, false); |
159 | 133 |
jTabbedPane.setEnabledAt(stylesTabIndex, false); |
160 | 134 |
} |
... | ... | |
192 | 166 |
null)); |
193 | 167 |
jPanel2.add(getChkExtendedNames(), null); |
194 | 168 |
|
195 |
jPanel2.add(getJScrollPane1(), null);
|
|
169 |
jPanel2.add(getJScrollTreeLayers(), null);
|
|
196 | 170 |
jPanel2.add(getBtnDel(), null); |
197 | 171 |
jPanel2.add(getBtnAdd(), null); |
198 |
jPanel2.add(getJScrollPane5(), null);
|
|
172 |
jPanel2.add(getJScrollLstSelectedLayers(), null);
|
|
199 | 173 |
jPanel2.add(getBtnUp(), null); |
200 | 174 |
jPanel2.add(getBtnDown(), null); |
201 | 175 |
jPanel2.add(getChkDisagregate(), null); |
... | ... | |
234 | 208 |
if (tabFormats == null) { |
235 | 209 |
tabFormats = new JPanel(); |
236 | 210 |
tabFormats.setLayout(null); |
237 |
tabFormats.add(getJPanel1(), null); |
|
238 |
tabFormats.add(getJPanel5(), null); |
|
211 |
tabFormats.add(getJPanelImageFormats(), null); |
|
212 |
tabFormats.add(getJPanelLstSrs(), null); |
|
213 |
tabFormats.add(getJPanelInfoFormats(), null); |
|
239 | 214 |
} |
240 | 215 |
|
241 | 216 |
return tabFormats; |
... | ... | |
246 | 221 |
* |
247 | 222 |
* @return ScrollPane |
248 | 223 |
*/ |
249 |
private JScrollPane getJScrollPane1() {
|
|
250 |
if (jScrollPane1 == null) {
|
|
251 |
jScrollPane1 = new JScrollPane();
|
|
252 |
jScrollPane1.setBounds(11, 22, 460, 123);
|
|
253 |
jScrollPane1.setViewportView(getTreeLayers());
|
|
254 |
jScrollPane1.setPreferredSize(new java.awt.Dimension(205, 75));
|
|
224 |
private JScrollPane getJScrollTreeLayers() {
|
|
225 |
if (jScrollTreeLayers == null) {
|
|
226 |
jScrollTreeLayers = new JScrollPane();
|
|
227 |
jScrollTreeLayers.setBounds(11, 22, 460, 123);
|
|
228 |
jScrollTreeLayers.setViewportView(getTreeLayers());
|
|
229 |
jScrollTreeLayers.setPreferredSize(new java.awt.Dimension(205, 75));
|
|
255 | 230 |
} |
256 | 231 |
|
257 |
return jScrollPane1;
|
|
232 |
return jScrollTreeLayers;
|
|
258 | 233 |
} |
259 | 234 |
|
260 | 235 |
/** |
... | ... | |
306 | 281 |
* |
307 | 282 |
* @return ScrollPane |
308 | 283 |
*/ |
309 |
private JScrollPane getJScrollPane5() {
|
|
310 |
if (jScrollPane5 == null) {
|
|
311 |
jScrollPane5 = new JScrollPane();
|
|
312 |
jScrollPane5.setBounds(11, 155, 422, 120);
|
|
313 |
jScrollPane5.setViewportView(getLstSelectedLayers());
|
|
314 |
jScrollPane5.setPreferredSize(new java.awt.Dimension(205, 75));
|
|
284 |
private JScrollPane getJScrollLstSelectedLayers() {
|
|
285 |
if (jScrollLstSelectedLayers == null) {
|
|
286 |
jScrollLstSelectedLayers = new JScrollPane();
|
|
287 |
jScrollLstSelectedLayers.setBounds(11, 155, 422, 120);
|
|
288 |
jScrollLstSelectedLayers.setViewportView(getLstSelectedLayers());
|
|
289 |
jScrollLstSelectedLayers.setPreferredSize(new java.awt.Dimension(205, 75));
|
|
315 | 290 |
} |
316 | 291 |
|
317 |
return jScrollPane5;
|
|
292 |
return jScrollLstSelectedLayers;
|
|
318 | 293 |
} |
319 | 294 |
|
320 | 295 |
/** |
... | ... | |
326 | 301 |
if (jTxtNomCapa == null) { |
327 | 302 |
jTxtNomCapa = new JTextField(); |
328 | 303 |
jTxtNomCapa.setBounds(10, 19, 460, 20); |
329 |
jTxtNomCapa.setText(PluginServices.getText(this, "WMSLayer")); |
|
304 |
jTxtNomCapa.setText(PluginServices.getText(this, "WMTSLayer"));
|
|
330 | 305 |
jTxtNomCapa.addKeyListener(new java.awt.event.KeyAdapter() { |
331 | 306 |
public void keyTyped(java.awt.event.KeyEvent e) { |
332 | 307 |
fireWizardComplete(isCorrectlyConfigured()); |
... | ... | |
336 | 311 |
|
337 | 312 |
return jTxtNomCapa; |
338 | 313 |
} |
339 |
|
|
314 |
|
|
340 | 315 |
/** |
341 | 316 |
* This method initializes jScrollPane6 |
342 |
* |
|
343 | 317 |
* @return ScrollPane |
344 | 318 |
*/ |
345 |
private JScrollPane getJScrollPane6() {
|
|
346 |
if (jScrollPane6 == null) {
|
|
347 |
jScrollPane6 = new JScrollPane();
|
|
348 |
jScrollPane6.setBounds(5, 23, 470, 140);
|
|
349 |
jScrollPane6.setViewportView(getLstFormats());
|
|
350 |
jScrollPane6.setPreferredSize(new java.awt.Dimension(250, 200));
|
|
319 |
private JScrollPane getJScrollInfoFormats() {
|
|
320 |
if (jScrollInfoFormats == null) {
|
|
321 |
jScrollInfoFormats = new JScrollPane();
|
|
322 |
jScrollInfoFormats.setBounds(5, 23, 470, 90);
|
|
323 |
jScrollInfoFormats.setViewportView(getLstInfoFormats());
|
|
324 |
jScrollInfoFormats.setPreferredSize(new java.awt.Dimension(250, 90));
|
|
351 | 325 |
} |
352 | 326 |
|
353 |
return jScrollPane6;
|
|
327 |
return jScrollInfoFormats;
|
|
354 | 328 |
} |
355 | 329 |
|
356 | 330 |
/** |
357 |
* This method initializes jScrollPane2 |
|
358 |
* |
|
331 |
* This method initializes jScrollImageFormats |
|
359 | 332 |
* @return ScrollPane |
360 | 333 |
*/ |
361 |
private JScrollPane getJScrollPane2() {
|
|
362 |
if (jScrollPane2 == null) {
|
|
363 |
jScrollPane2 = new JScrollPane();
|
|
364 |
jScrollPane2.setBounds(5, 23, 470, 140);
|
|
365 |
jScrollPane2.setViewportView(getLstSRSs());
|
|
366 |
jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 200));
|
|
334 |
private JScrollPane getJScrollImageFormats() {
|
|
335 |
if (jScrollImageFormats == null) {
|
|
336 |
jScrollImageFormats = new JScrollPane();
|
|
337 |
jScrollImageFormats.setBounds(5, 23, 470, 90);
|
|
338 |
jScrollImageFormats.setViewportView(getLstImageFormats());
|
|
339 |
jScrollImageFormats.setPreferredSize(new java.awt.Dimension(250, 90));
|
|
367 | 340 |
} |
368 | 341 |
|
369 |
return jScrollPane2;
|
|
342 |
return jScrollImageFormats;
|
|
370 | 343 |
} |
371 | 344 |
|
372 | 345 |
/** |
346 |
* This method initializes jScrollLstSrs |
|
347 |
* @return ScrollPane |
|
348 |
*/ |
|
349 |
private JScrollPane getJScrollLstSrs() { |
|
350 |
if (jScrollLstSrs == null) { |
|
351 |
jScrollLstSrs = new JScrollPane(); |
|
352 |
jScrollLstSrs.setBounds(5, 23, 470, 90); |
|
353 |
jScrollLstSrs.setViewportView(getLstSRSs()); |
|
354 |
jScrollLstSrs.setPreferredSize(new java.awt.Dimension(100, 90)); |
|
355 |
} |
|
356 |
|
|
357 |
return jScrollLstSrs; |
|
358 |
} |
|
359 |
|
|
360 |
/** |
|
373 | 361 |
* Gets the available layers in WMS maintaining the tree structure |
374 | 362 |
* |
375 | 363 |
* @return |
... | ... | |
387 | 375 |
if (treeLayers == null) { |
388 | 376 |
treeLayers = new LayerTree(); |
389 | 377 |
treeLayers.setRootVisible(true); |
378 |
|
|
379 |
//Cuando se hace doble click sobre una capa se a?ade a la list |
|
390 | 380 |
treeLayers.addMouseListener(new java.awt.event.MouseAdapter() { |
391 | 381 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
392 | 382 |
if (e.getClickCount() == 2) { |
... | ... | |
394 | 384 |
} |
395 | 385 |
} |
396 | 386 |
}); |
397 |
treeLayers |
|
398 |
.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { |
|
399 |
public void valueChanged( |
|
400 |
javax.swing.event.TreeSelectionEvent e) { |
|
387 |
|
|
388 |
//Cuando se selecciona una capa se activa el bot?n de a?adir |
|
389 |
treeLayers.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { |
|
390 |
public void valueChanged(javax.swing.event.TreeSelectionEvent e) { |
|
391 |
boolean isGetMapable = false; |
|
392 |
TreePath[] selecciones = getTreeLayers().getSelectionPaths(); |
|
401 | 393 |
|
402 |
boolean isGetMapable = false; // pffff, jajaja |
|
403 |
TreePath[] selecciones = getTreeLayers() |
|
404 |
.getSelectionPaths(); |
|
405 |
if (selecciones != null) // no entenc perqu� |
|
406 |
// peta ac� i li |
|
407 |
// arriba null a |
|
408 |
// voltes... |
|
409 |
{ |
|
410 |
for (int i = 0; i < selecciones.length |
|
411 |
&& !isGetMapable; i++) { |
|
412 |
RemoteLayerNode layer = ((RemoteLayerNode) selecciones[i] |
|
413 |
.getLastPathComponent()); |
|
414 |
isGetMapable = layer.getChildren().size() == 0 |
|
415 |
|| layer.getName() != null; |
|
416 |
} |
|
417 |
|
|
394 |
if (selecciones != null) { |
|
395 |
for (int i = 0; i < selecciones.length && !isGetMapable; i++) { |
|
396 |
if(selecciones[i].getLastPathComponent() instanceof WMTSTheme) { |
|
397 |
WMTSTheme layer = ((WMTSTheme) selecciones[i].getLastPathComponent()); |
|
398 |
isGetMapable = layer.getChildCount() == 0 || layer.getTitle() != null; |
|
418 | 399 |
} |
419 |
getBtnAdd().setEnabled(isGetMapable); |
|
420 |
fireWizardComplete(isCorrectlyConfigured()); |
|
421 | 400 |
} |
422 |
}); |
|
401 |
|
|
402 |
} |
|
403 |
getBtnAdd().setEnabled(isGetMapable); |
|
404 |
fireWizardComplete(isCorrectlyConfigured()); |
|
405 |
} |
|
406 |
}); |
|
423 | 407 |
} |
424 | 408 |
|
425 | 409 |
return treeLayers; |
... | ... | |
436 | 420 |
boolean b; |
437 | 421 |
this.repaint(); |
438 | 422 |
if ((getLstSRSs().getSelectedIndex() != -1) |
439 |
&& (getLstFormats().getSelectedIndex() != -1) |
|
423 |
&& (getLstImageFormats().getSelectedIndex() != -1)
|
|
440 | 424 |
&& (getLstSelectedLayers().getModel().getSize() > 0)) { |
441 | 425 |
b = true; |
442 | 426 |
} else { |
... | ... | |
452 | 436 |
return b; |
453 | 437 |
} |
454 | 438 |
|
455 |
@SuppressWarnings("unchecked") |
|
456 |
public RemoteLayerNode[] selectedLayersToArray() { |
|
439 |
public WMTSTheme[] selectedLayersToArray() { |
|
457 | 440 |
JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel()); |
458 | 441 |
ArrayList elements = modelo.getElements(); |
459 |
RemoteLayerNode[] layers = (RemoteLayerNode[]) elements |
|
460 |
.toArray(new RemoteLayerNode[0]); |
|
442 |
WMTSTheme[] layers = (WMTSTheme[]) elements.toArray(new WMTSTheme[0]); |
|
461 | 443 |
return layers; |
462 | 444 |
} |
463 | 445 |
|
464 | 446 |
/** |
465 | 447 |
* DOCUMENT ME! |
466 | 448 |
*/ |
467 |
@SuppressWarnings("unchecked") |
|
468 | 449 |
private void delLayer() { |
469 | 450 |
int[] indices = lstSelectedLayers.getSelectedIndices(); |
470 | 451 |
|
471 | 452 |
try { |
472 | 453 |
ArrayList removeList = new ArrayList(); |
473 |
RemoteLayerNode[] infos = selectedLayersToArray();
|
|
454 |
WMTSTheme[] infos = selectedLayersToArray();
|
|
474 | 455 |
JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers |
475 | 456 |
.getModel()); |
476 | 457 |
for (int i = 0; i < indices.length; i++) { |
... | ... | |
481 | 462 |
fireWizardComplete(isCorrectlyConfigured()); |
482 | 463 |
|
483 | 464 |
// delete from selectedPaths as well |
484 |
RemoteLayerNode elemento = null;
|
|
485 |
RemoteLayerNode last = null;
|
|
465 |
WMTSTheme elemento = null;
|
|
466 |
WMTSTheme last = null;
|
|
486 | 467 |
TreePath path = null; |
487 | 468 |
for (int i = removeList.size() - 1; i >= 0; i--) { |
488 |
elemento = (RemoteLayerNode) removeList.get(i);
|
|
469 |
elemento = (WMTSTheme) removeList.get(i);
|
|
489 | 470 |
for (int j = 0; j < selectedPaths.size(); j++) { |
490 | 471 |
path = (TreePath) selectedPaths.get(j); |
491 |
last = (RemoteLayerNode) path.getLastPathComponent();
|
|
472 |
last = (WMTSTheme) path.getLastPathComponent();
|
|
492 | 473 |
if (last.getTitle().compareTo(elemento.getTitle()) == 0) { |
493 | 474 |
selectedPaths.remove(path); |
494 | 475 |
} |
... | ... | |
519 | 500 |
*/ |
520 | 501 |
public void refreshData() { |
521 | 502 |
refreshSRS(); |
503 |
refreshImageFormats(); |
|
504 |
refreshInfoFormats(); |
|
522 | 505 |
getLstSelectedLayers().repaint(); |
523 |
refreshStyleTree(); |
|
524 |
refreshDimensions(); |
|
525 |
|
|
506 |
//refreshStyleTree(); |
|
526 | 507 |
} |
527 | 508 |
|
528 | 509 |
/** |
... | ... | |
531 | 512 |
*/ |
532 | 513 |
public void refreshInfo() { |
533 | 514 |
getTabInfo().refresh(explorer, selectedLayersVector(), |
534 |
getStyleTitles(), getFormat(), getSRS(), getDimensions());
|
|
515 |
getStyleTitles(), getImageFormat(), getSRS());
|
|
535 | 516 |
} |
536 | 517 |
|
537 |
private void refreshDimensions() { |
|
538 |
int size = getLstSelectedLayers().getModel().getSize(); |
|
539 |
boolean enable = false; |
|
540 |
for (int i = 0; i < size; i++) { |
|
541 |
RemoteLayerNode node = (RemoteLayerNode) getLstSelectedLayers() |
|
542 |
.getModel().getElementAt(i); |
|
543 |
if (node.getDimensions() == null) { |
|
544 |
continue; |
|
545 |
} |
|
546 |
|
|
547 |
for (int j = 0; j < node.getDimensions().size(); j++) { |
|
548 |
RemoteTimeDimension dim = (RemoteTimeDimension) node |
|
549 |
.getDimensions().get(j); |
|
550 |
|
|
551 |
try { |
|
552 |
getTabDimensions().addDimension(dim); |
|
553 |
enable = true; |
|
554 |
} catch (IllegalArgumentException e) { |
|
555 |
NotificationManager.addWarning( |
|
556 |
"Unrecognized dimension expression: " |
|
557 |
+ dim.getExpression() + " (for " |
|
558 |
+ dim.getName() + " in layer '" |
|
559 |
+ node.getName() + "')", null); |
|
560 |
} |
|
561 |
} |
|
562 |
} |
|
563 |
jTabbedPane.setEnabledAt(dimensionTabIndex, enable); |
|
564 |
|
|
565 |
} |
|
566 |
|
|
567 | 518 |
/** |
568 |
* |
|
569 |
*/ |
|
570 |
private void refreshStyleTree() { |
|
571 |
|
|
572 |
int size = getLstSelectedLayers().getModel().getSize(); |
|
573 |
RemoteLayerNode styleRoot = RasterLocator.getManager().getDataStructFactory().createWMSLayerNode(); |
|
574 |
styleRoot.setTitle(PluginServices.getText(this, "selected_layers")); |
|
575 |
|
|
576 |
StyleTreeModel model = new StyleTreeModel(styleRoot); |
|
577 |
jTabbedPane.setEnabledAt(stylesTabIndex, false); |
|
578 |
for (int i = 0; i < size; i++) { |
|
579 |
RemoteLayerNode node = (RemoteLayerNode) getLstSelectedLayers() |
|
580 |
.getModel().getElementAt(i); |
|
581 |
// If any of the layers defines styles, the tab will be enabled. |
|
582 |
if (model.addLayerBranch(node)) { |
|
583 |
jTabbedPane.setEnabledAt(stylesTabIndex, true); |
|
584 |
} |
|
585 |
} |
|
586 |
|
|
587 |
getStyleTree().setModel(model); |
|
588 |
getStyleTree().expandAll(); |
|
589 |
getStyleTree().repaint(); |
|
590 |
} |
|
591 |
|
|
592 |
/** |
|
593 |
* Takes the array of selected layers and a vector containing the style |
|
594 |
* names and set them as selected in the styles panel |
|
595 |
* |
|
596 |
* @param selectedLayers |
|
597 |
* @param styles |
|
598 |
*/ |
|
599 |
public void setStyleSelections(Vector<RemoteStyle> styles) { |
|
600 |
|
|
601 |
RemoteLayerNode[] layers = selectedLayersToArray(); |
|
602 |
int length = layers.length; |
|
603 |
for (int i = 0; i < length; i++) { |
|
604 |
String styleName = styles.get(i).getName(); |
|
605 |
layers[length - i - 1].setSelectedStyleByName(styleName); |
|
606 |
} |
|
607 |
} |
|
608 |
|
|
609 |
/** |
|
610 | 519 |
* Gets the currently shown style tree. |
611 | 520 |
* |
612 | 521 |
* @return |
... | ... | |
627 | 536 |
return; |
628 | 537 |
} |
629 | 538 |
for (int i = 0; i < selecciones.length; i++) { |
539 |
if(!(selecciones[i].getLastPathComponent() instanceof WMTSTheme)) |
|
540 |
continue; |
|
630 | 541 |
selectedPaths.add(selecciones[i]); |
631 |
RemoteLayerNode nodo = (RemoteLayerNode) selecciones[i]
|
|
632 |
.getLastPathComponent(); |
|
633 |
if (nodo.getName() == null || nodo.getName().equals("")) {
|
|
542 |
WMTSTheme nodo = (WMTSTheme) selecciones[i].getLastPathComponent();
|
|
543 |
|
|
544 |
if (nodo.getTitle() == null || nodo.getTitle().equals("")) {
|
|
634 | 545 |
continue; |
635 | 546 |
} |
636 |
if (nodo.isSizeFixed()) { |
|
637 |
if (sizeFixed == null) { |
|
638 |
sizeFixed = nodo.getFixedSize(); |
|
639 |
} else if ((sizeFixed.getHeight() != nodo.getFixedSize() |
|
640 |
.getHeight()) |
|
641 |
|| (sizeFixed.getWidth() != nodo.getFixedSize() |
|
642 |
.getWidth())) { |
|
643 |
JOptionPane.showMessageDialog((Component) PluginServices |
|
644 |
.getMainFrame(), PluginServices.getText(this, |
|
645 |
"server_cant_render_layers")); |
|
646 |
continue; |
|
647 |
} |
|
648 |
} |
|
649 |
// s'afegeix a la llista de capes seleccionades |
|
547 |
|
|
650 | 548 |
JDnDListModel modelo = (JDnDListModel) lstSelectedLayers.getModel(); |
651 | 549 |
|
652 |
try { |
|
653 |
if (modelo.addElement(0, nodo.clone())) { |
|
654 |
alguno = true; |
|
655 |
} |
|
656 |
} catch (CloneNotSupportedException e) { |
|
550 |
if (modelo.addElement(0, nodo)) { |
|
551 |
alguno = true; |
|
657 | 552 |
} |
658 | 553 |
} |
659 | 554 |
|
... | ... | |
700 | 595 |
if (lstSRSs == null) { |
701 | 596 |
lstSRSs = new JList(); |
702 | 597 |
lstSRSs.setModel(new SRSListModel()); |
703 |
lstSRSs |
|
704 |
.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
705 |
lstSRSs |
|
706 |
.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
707 |
public void valueChanged( |
|
708 |
javax.swing.event.ListSelectionEvent e) { |
|
709 |
int i = lstSRSs.getSelectedIndex(); |
|
710 |
if (i != -1) { |
|
711 |
oldSRS = (String) lstSRSs.getModel() |
|
712 |
.getElementAt(i); |
|
713 |
} |
|
714 |
fireWizardComplete(isCorrectlyConfigured()); |
|
715 |
} |
|
716 |
}); |
|
598 |
lstSRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
599 |
lstSRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
600 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
|
601 |
int i = lstSRSs.getSelectedIndex(); |
|
602 |
if (i != -1) { |
|
603 |
oldSRS = (String) lstSRSs.getModel().getElementAt(i); |
|
604 |
} |
|
605 |
fireWizardComplete(isCorrectlyConfigured()); |
|
606 |
} |
|
607 |
}); |
|
717 | 608 |
} |
718 | 609 |
|
719 | 610 |
return lstSRSs; |
... | ... | |
721 | 612 |
|
722 | 613 |
/** |
723 | 614 |
* This method initializes lstFormats |
724 |
* |
|
725 | 615 |
* @return List |
726 | 616 |
*/ |
727 |
public JList getLstFormats() { |
|
728 |
if (lstFormats == null) { |
|
729 |
lstFormats = new JList(); |
|
730 |
lstFormats |
|
731 |
.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
732 |
lstFormats |
|
733 |
.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
734 |
public void valueChanged( |
|
735 |
javax.swing.event.ListSelectionEvent e) { |
|
736 |
fireWizardComplete(isCorrectlyConfigured()); |
|
737 |
} |
|
738 |
}); |
|
617 |
public JList getLstImageFormats() { |
|
618 |
if (lstImageFormats == null) { |
|
619 |
lstImageFormats = new JList(); |
|
620 |
lstImageFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
621 |
lstImageFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
622 |
public void valueChanged( |
|
623 |
javax.swing.event.ListSelectionEvent e) { |
|
624 |
fireWizardComplete(isCorrectlyConfigured()); |
|
625 |
} |
|
626 |
}); |
|
739 | 627 |
} |
740 |
|
|
741 |
return lstFormats; |
|
628 |
return lstImageFormats; |
|
742 | 629 |
} |
743 |
|
|
630 |
|
|
744 | 631 |
/** |
632 |
* This method initializes lstFormats |
|
633 |
* @return List |
|
634 |
*/ |
|
635 |
public JList getLstInfoFormats() { |
|
636 |
if (lstInfoFormats == null) { |
|
637 |
lstInfoFormats = new JList(); |
|
638 |
lstInfoFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
639 |
lstInfoFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
640 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
|
641 |
fireWizardComplete(isCorrectlyConfigured()); |
|
642 |
} |
|
643 |
}); |
|
644 |
} |
|
645 |
return lstInfoFormats; |
|
646 |
} |
|
647 |
|
|
648 |
/** |
|
649 |
* Refreshes the Information formats list |
|
650 |
*/ |
|
651 |
private void refreshInfoFormats() { |
|
652 |
Object[] selectedValues = lstSelectedLayers.getSelectedValues(); |
|
653 |
if(selectedValues != null && selectedValues.length == 1) { |
|
654 |
|
|
655 |
} |
|
656 |
} |
|
657 |
|
|
658 |
/** |
|
659 |
* Refreshes the Image formats list |
|
660 |
*/ |
|
661 |
private void refreshImageFormats() { |
|
662 |
Object[] selectedValues = lstSelectedLayers.getSelectedValues(); |
|
663 |
if(selectedValues != null && selectedValues.length == 1) { |
|
664 |
|
|
665 |
} |
|
666 |
} |
|
667 |
|
|
668 |
/** |
|
745 | 669 |
* Refreshes the SRS list |
746 | 670 |
*/ |
747 |
@SuppressWarnings("unchecked") |
|
748 | 671 |
private void refreshSRS() { |
749 |
ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel()) |
|
750 |
.getElements(); |
|
751 |
RemoteLayerNode[] layers = (RemoteLayerNode[]) elements |
|
752 |
.toArray(new RemoteLayerNode[0]); |
|
672 |
Object[] selectedValues = lstSelectedLayers.getSelectedValues(); |
|
673 |
if(selectedValues != null && selectedValues.length == 1) { |
|
674 |
|
|
675 |
} |
|
676 |
} |
|
753 | 677 |
|
678 |
/** |
|
679 |
* Refreshes the SRS list |
|
680 |
*/ |
|
681 |
/*private void refreshSRS() { |
|
682 |
ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel()).getElements(); |
|
683 |
WMTSTheme[] theme = (WMTSTheme[]) elements.toArray(new WMTSTheme[0]); |
|
684 |
|
|
754 | 685 |
SRSListModel model = new SRSListModel(); |
755 | 686 |
|
756 |
if (layers.length == 0) {
|
|
687 |
if (theme.length == 0) {
|
|
757 | 688 |
lstSRSs.setModel(model);// new DefaultListModel()); |
758 | 689 |
sizeFixed = null; |
759 | 690 |
} else { |
760 | 691 |
TreeSet srsSet = new TreeSet(); |
761 |
srsSet.addAll(layers[0].getAllSrs());
|
|
692 |
srsSet.addAll(theme[0].getLayer().getSrsList());
|
|
762 | 693 |
model.setAll(srsSet); |
763 |
for (int i = 1; i < layers.length; i++) {
|
|
764 |
model.setAll(model.intersect(layers[i].getAllSrs()));
|
|
694 |
for (int i = 1; i < theme.length; i++) {
|
|
695 |
model.setAll(model.intersect(theme[i].getLayer().getSrsList()));
|
|
765 | 696 |
} |
766 | 697 |
lstSRSs.setModel(model); |
767 | 698 |
} |
... | ... | |
770 | 701 |
getLstSRSs().setSelectedIndex(srsIndex); |
771 | 702 |
} |
772 | 703 |
|
773 |
} |
|
704 |
}*/
|
|
774 | 705 |
|
775 | 706 |
public void setListenerSupport(WizardListenerSupport support) { |
776 | 707 |
listenerSupport = support; |
... | ... | |
782 | 713 |
getLstSelectedLayers().repaint(); |
783 | 714 |
|
784 | 715 |
/*getLstFormats().setModel( |
785 |
new FormatListModel(explorer.getFormats())); |
|
786 |
getTreeLayers().setModel( |
|
787 |
new LayerTreeModel(explorer.getLayerTree()));*/ |
|
788 |
|
|
716 |
new FormatListModel(explorer.getFormats()));*/ |
|
717 |
getTreeLayers().setModel(new LayerTreeModel(explorer.getThemes())); |
|
789 | 718 |
refreshInfo(); |
790 | 719 |
} |
791 | 720 |
|
792 |
@SuppressWarnings("unchecked") |
|
793 | 721 |
private Vector getStyleTitles() { |
794 | 722 |
return getTabStyle().getStyleTree().getStyleSelectionTitles(); |
795 | 723 |
} |
796 | 724 |
|
797 |
/** |
|
798 |
* @return |
|
799 |
*/ |
|
800 |
@SuppressWarnings("unchecked") |
|
801 | 725 |
private Vector selectedLayersVector() { |
802 | 726 |
JDnDListModel mod = (JDnDListModel) getLstSelectedLayers().getModel(); |
803 | 727 |
Vector lyrs = new Vector(); |
... | ... | |
807 | 731 |
return lyrs; |
808 | 732 |
} |
809 | 733 |
|
810 |
public String getFormat() { |
|
811 |
return (String) getLstFormats().getSelectedValue(); |
|
734 |
public String getImageFormat() {
|
|
735 |
return (String) getLstImageFormats().getSelectedValue();
|
|
812 | 736 |
} |
737 |
|
|
738 |
public String getInfoFormat() { |
|
739 |
return (String) getLstInfoFormats().getSelectedValue(); |
|
740 |
} |
|
813 | 741 |
|
814 |
@SuppressWarnings("unchecked") |
|
815 | 742 |
public String getLayersQuery() { |
816 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()) |
|
817 |
.getElements(); |
|
818 |
RemoteLayerNode[] layers = (RemoteLayerNode[]) elements |
|
819 |
.toArray(new RemoteLayerNode[0]); |
|
743 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements(); |
|
744 |
WMTSTheme[] layers = (WMTSTheme[]) elements.toArray(new WMTSTheme[0]); |
|
820 | 745 |
|
821 | 746 |
// Nombre separado por comas de las capas |
822 |
String layersQuery = layers[layers.length - 1].getName();
|
|
747 |
String layersQuery = layers[layers.length - 1].getTitle();
|
|
823 | 748 |
|
824 | 749 |
for (int i = layers.length - 2; i >= 0; i--) { |
825 |
layersQuery += ("," + layers[i].getName());
|
|
750 |
layersQuery += ("," + layers[i].getTitle());
|
|
826 | 751 |
} |
827 | 752 |
|
828 | 753 |
return layersQuery; |
829 |
|
|
830 | 754 |
} |
831 | 755 |
|
832 | 756 |
/** |
... | ... | |
856 | 780 |
} |
857 | 781 |
|
858 | 782 |
/** |
859 |
* The piece of the GetMap request that has the layer names. |
|
860 |
* |
|
861 |
* @return |
|
862 |
*/ |
|
863 |
@SuppressWarnings("unchecked") |
|
864 |
public String getQueryableLayerQuery() { |
|
865 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()) |
|
866 |
.getElements(); |
|
867 |
RemoteLayerNode[] layers = (RemoteLayerNode[]) elements |
|
868 |
.toArray(new RemoteLayerNode[0]); |
|
869 |
// Nombre separado por comas de las capas |
|
870 |
String layersQuery = ""; |
|
871 |
int i; |
|
872 |
|
|
873 |
for (i = 0; i < layers.length; i++) { |
|
874 |
if (layers[i].isQueryable()) { |
|
875 |
layersQuery = layers[i].getName(); |
|
876 |
|
|
877 |
break; |
|
878 |
} |
|
879 |
} |
|
880 |
|
|
881 |
for (int j = i + 1; j < layers.length; j++) { |
|
882 |
if (layers[j].isQueryable()) { |
|
883 |
layersQuery += ("," + layers[j].getName()); |
|
884 |
} |
|
885 |
} |
|
886 |
|
|
887 |
return layersQuery; |
|
888 |
} |
|
889 |
|
|
890 |
/** |
|
891 | 783 |
* Returns the index of the CRS within the CRS list. |
892 | 784 |
* |
893 | 785 |
* Devuelve la posicion que ocupa el CRS en la lista de CRS |
... | ... | |
915 | 807 |
* @return The format's index if it exists, -1 if it not exists. |
916 | 808 |
*/ |
917 | 809 |
public int getFormatIndex(String format) { |
918 |
for (int i = 0; i < getLstFormats().getModel().getSize(); i++) { |
|
919 |
if (format != null |
|
920 |
&& format |
|
921 |
.equals(getLstFormats().getModel().getElementAt(i))) { |
|
810 |
for (int i = 0; i < getLstImageFormats().getModel().getSize(); i++) { |
|
811 |
if (format != null && |
|
812 |
format.equals(getLstImageFormats().getModel().getElementAt(i))) { |
|
922 | 813 |
return i; |
923 | 814 |
} |
924 | 815 |
} |
... | ... | |
945 | 836 |
}); |
946 | 837 |
|
947 | 838 |
StylesPanel sp = getTabStyle(); |
948 |
DimensionPanel dp = getTabDimensions(); |
|
949 | 839 |
|
950 |
jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, |
|
951 |
null); |
|
952 |
jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, |
|
953 |
getTabLayers(), null); |
|
954 |
jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, |
|
955 |
sp, null); |
|
840 |
jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, null); |
|
841 |
jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null); |
|
842 |
jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null); |
|
956 | 843 |
stylesTabIndex = jTabbedPane.getTabCount() - 1; |
957 |
jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"), |
|
958 |
null, dp, null); |
|
959 |
dimensionTabIndex = jTabbedPane.getTabCount() - 1; |
|
960 |
jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, |
|
961 |
getTabFormats(), null); |
|
962 |
jTabbedPane.setEnabledAt(dimensionTabIndex, false); |
|
844 |
jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null,getTabFormats(), null); |
|
963 | 845 |
jTabbedPane.setEnabledAt(stylesTabIndex, false); |
964 | 846 |
} |
965 | 847 |
return jTabbedPane; |
... | ... | |
979 | 861 |
} |
980 | 862 |
return tabLayers; |
981 | 863 |
} |
864 |
|
|
865 |
/** |
|
866 |
* This method initializes jPanelImageFormats |
|
867 |
* @return Panel |
|
868 |
*/ |
|
869 |
private JPanel getJPanelInfoFormats() { |
|
870 |
if (jPanelInfoFormats == null) { |
|
871 |
jPanelInfoFormats = new JPanel(); |
|
872 |
jPanelInfoFormats.setLayout(null); |
|
873 |
jPanelInfoFormats.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
874 |
null, PluginServices.getText(this, "select_info_formats"), |
|
875 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
876 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, |
|
877 |
null)); |
|
878 |
jPanelInfoFormats.setBounds(5, 261, 485, 122); |
|
879 |
jPanelInfoFormats.add(getJScrollInfoFormats(), null); |
|
880 |
jPanelInfoFormats.add(getChkTransparency(), null); |
|
881 |
} |
|
882 |
return jPanelInfoFormats; |
|
883 |
} |
|
982 | 884 |
|
983 | 885 |
/** |
984 |
* This method initializes jPanel1 |
|
985 |
* |
|
886 |
* This method initializes jPanelImageFormats |
|
986 | 887 |
* @return Panel |
987 | 888 |
*/ |
988 |
private JPanel getJPanel1() {
|
|
989 |
if (jPanel1 == null) {
|
|
990 |
jPanel1 = new JPanel();
|
|
991 |
jPanel1.setLayout(null);
|
|
992 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(
|
|
889 |
private JPanel getJPanelImageFormats() {
|
|
890 |
if (jPanelImageFormats == null) {
|
|
891 |
jPanelImageFormats = new JPanel();
|
|
892 |
jPanelImageFormats.setLayout(null);
|
|
893 |
jPanelImageFormats.setBorder(javax.swing.BorderFactory.createTitledBorder(
|
|
993 | 894 |
null, PluginServices.getText(this, "select_formats"), |
994 | 895 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
995 | 896 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, |
996 | 897 |
null)); |
997 |
jPanel1.setBounds(5, 10, 485, 194);
|
|
998 |
jPanel1.add(getJScrollPane6(), null);
|
|
999 |
jPanel1.add(getChkTransparency(), null);
|
|
898 |
jPanelImageFormats.setBounds(5, 10, 485, 122);
|
|
899 |
jPanelImageFormats.add(getJScrollImageFormats(), null);
|
|
900 |
jPanelImageFormats.add(getChkTransparency(), null);
|
|
1000 | 901 |
} |
1001 |
return jPanel1;
|
|
902 |
return jPanelImageFormats;
|
|
1002 | 903 |
} |
1003 | 904 |
|
1004 | 905 |
/** |
... | ... | |
1006 | 907 |
* |
1007 | 908 |
* @return Panel |
1008 | 909 |
*/ |
1009 |
private JPanel getJPanel5() {
|
|
1010 |
if (jPanel5 == null) {
|
|
1011 |
jPanel5 = new JPanel();
|
|
1012 |
jPanel5.setLayout(null);
|
|
1013 |
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(
|
|
910 |
private JPanel getJPanelLstSrs() {
|
|
911 |
if (jPanelLstSrs == null) {
|
|
912 |
jPanelLstSrs = new JPanel();
|
|
913 |
jPanelLstSrs.setLayout(null);
|
|
914 |
jPanelLstSrs.setBorder(javax.swing.BorderFactory.createTitledBorder(
|
|
1014 | 915 |
null, PluginServices.getText(this, "seleccionar_srs"), |
1015 | 916 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
1016 | 917 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, |
1017 | 918 |
null)); |
1018 |
jPanel5.setBounds(5, 205, 485, 173);
|
|
1019 |
jPanel5.add(getJScrollPane2(), null);
|
|
919 |
jPanelLstSrs.setBounds(5, 133, 485, 122);
|
|
920 |
jPanelLstSrs.add(getJScrollLstSrs(), null);
|
|
1020 | 921 |
} |
1021 |
return jPanel5;
|
|
922 |
return jPanelLstSrs;
|
|
1022 | 923 |
} |
1023 | 924 |
|
1024 | 925 |
/** |
... | ... | |
1037 | 938 |
}); |
1038 | 939 |
tabStyle.addFocusListener(new FocusAdapter() { |
1039 | 940 |
public void focusGained(FocusEvent e) { |
1040 |
refreshStyleTree(); |
|
941 |
//refreshStyleTree();
|
|
1041 | 942 |
} |
1042 | 943 |
}); |
1043 | 944 |
} |
... | ... | |
1180 | 1081 |
* |
1181 | 1082 |
* @return Vector |
1182 | 1083 |
*/ |
1183 |
public Vector<RemoteStyle> getStyles() { |
|
1084 |
/*public Vector<RemoteStyle> getStyles() {
|
|
1184 | 1085 |
Vector<RemoteStyle> v = new Vector<RemoteStyle>(); |
1185 | 1086 |
RemoteLayerNode[] layers = selectedLayersToArray(); |
1186 | 1087 |
for (int i = 0; i < layers.length; i++) { |
... | ... | |
1192 | 1093 |
} |
1193 | 1094 |
|
1194 | 1095 |
public Vector<RemoteStyle> getLayerStyle(String layerName) { |
1195 |
Vector<RemoteStyle> v = new Vector<RemoteStyle>();
|
|
1196 |
RemoteLayerNode[] layers = selectedLayersToArray();
|
|
1096 |
Vector<WMTSStyle> v = new Vector<WMTSStyle>();
|
|
1097 |
WMTSTheme[] layers = selectedLayersToArray();
|
|
1197 | 1098 |
for (int i = 0; i < layers.length; i++) { |
1198 |
if (layers[i].getName().equalsIgnoreCase(layerName)) {
|
|
1199 |
RemoteStyle sty = layers[i].getSelectedStyle();
|
|
1099 |
if (layers[i].getTitle().equalsIgnoreCase(layerName)) {
|
|
1100 |
RemoteStyle sty = layers[i].get |
|
1200 | 1101 |
v.add(sty); |
1201 | 1102 |
return v; |
1202 | 1103 |
} |
1203 | 1104 |
} |
1204 | 1105 |
return v; |
1205 |
} |
|
1206 |
|
|
1106 |
}*/
|
|
1107 |
|
|
1207 | 1108 |
/** |
1208 |
* This method initializes tabInfo
|
|
1109 |
* The piece of the GetMap request that has the layer names.
|
|
1209 | 1110 |
* |
1210 |
* @return Panel
|
|
1111 |
* @return |
|
1211 | 1112 |
*/ |
1212 |
private InfoPanel getTabInfo() { |
|
1213 |
if (tabInfo == null) { |
|
1214 |
tabInfo = new InfoPanel(); |
|
1113 |
/*@SuppressWarnings("unchecked") |
|
1114 |
public String getQueryableLayerQuery() { |
|
1115 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements(); |
|
1116 |
WMTSTheme[] layers = (WMTSTheme[]) elements.toArray(new WMTSTheme[0]); |
|
1117 |
|
|
1118 |
// Nombre separado por comas de las capas |
|
1119 |
String layersQuery = ""; |
|
1120 |
int i; |
|
1215 | 1121 |
|
1122 |
for (i = 0; i < layers.length; i++) { |
|
1123 |
if (layers[i].isQueryable()) { |
|
1124 |
layersQuery = layers[i].getTitle(); |
|
1125 |
|
|
1126 |
break; |
|
1127 |
} |
|
1216 | 1128 |
} |
1217 |
return tabInfo; |
|
1129 |
|
|
1130 |
for (int j = i + 1; j < layers.length; j++) { |
|
1131 |
if (layers[j].isQueryable()) { |
|
1132 |
layersQuery += ("," + layers[j].getTitle()); |
|
1133 |
} |
|
1134 |
} |
|
1135 |
|
|
1136 |
return layersQuery; |
|
1218 | 1137 |
} |
1138 |
|
|
1139 |
private void refreshStyleTree() { |
|
1219 | 1140 |
|
1220 |
@SuppressWarnings("unchecked") |
|
1221 |
public void setDimensions(Vector dimensions) { |
|
1222 |
for (int i = 0; i < dimensions.size(); i++) { |
|
1223 |
String st = (String) dimensions.get(i); |
|
1224 |
if (st.split("=").length == 2) { |
|
1225 |
String[] s = st.split("="); |
|
1226 |
getTabDimensions().setDimensionValue(s[0], s[1]); |
|
1141 |
int size = getLstSelectedLayers().getModel().getSize(); |
|
1142 |
RemoteLayerNode styleRoot = RasterLocator.getManager().getDataStructFactory().createWMSLayerNode(); |
|
1143 |
styleRoot.setTitle(PluginServices.getText(this, "selected_layers")); |
|
1144 |
|
|
1145 |
StyleTreeModel model = new StyleTreeModel(styleRoot); |
|
1146 |
jTabbedPane.setEnabledAt(stylesTabIndex, false); |
|
1147 |
for (int i = 0; i < size; i++) { |
|
1148 |
RemoteLayerNode node = (RemoteLayerNode) getLstSelectedLayers() |
|
1149 |
.getModel().getElementAt(i); |
|
1150 |
// If any of the layers defines styles, the tab will be enabled. |
|
1151 |
if (model.addLayerBranch(node)) { |
|
1152 |
jTabbedPane.setEnabledAt(stylesTabIndex, true); |
|
1227 | 1153 |
} |
1228 | 1154 |
} |
1229 | 1155 |
|
1156 |
getStyleTree().setModel(model); |
|
1157 |
getStyleTree().expandAll(); |
|
1158 |
getStyleTree().repaint(); |
|
1230 | 1159 |
} |
1160 |
*/ |
|
1161 |
|
|
1162 |
/** |
|
1163 |
* Takes the array of selected layers and a vector containing the style |
|
1164 |
* names and set them as selected in the styles panel |
|
1165 |
* |
|
1166 |
* @param selectedLayers |
|
1167 |
* @param styles |
|
1168 |
*/ |
|
1169 |
/*public void setStyleSelections(Vector<RemoteStyle> styles) { |
|
1231 | 1170 |
|
1171 |
RemoteLayerNode[] layers = selectedLayersToArray(); |
|
1172 |
int length = layers.length; |
|
1173 |
for (int i = 0; i < length; i++) { |
|
1174 |
String styleName = styles.get(i).getName(); |
|
1175 |
layers[length - i - 1].setSelectedStyleByName(styleName); |
|
1176 |
} |
|
1177 |
}*/ |
|
1178 |
|
|
1232 | 1179 |
/** |
1233 |
* This method initializes tabDimension
|
|
1180 |
* This method initializes tabInfo
|
|
1234 | 1181 |
* |
1235 | 1182 |
* @return Panel |
1236 | 1183 |
*/ |
1237 |
private DimensionPanel getTabDimensions() { |
|
1238 |
if (tabDimensions == null) { |
|
1239 |
tabDimensions = new DimensionPanel(); |
|
1240 |
tabDimensions.setEnabled(false); |
|
1241 |
tabDimensions.addListener(new BeanListener() { |
|
1242 |
@SuppressWarnings("unchecked") |
|
1243 |
public void beanValueChanged(Object value) { |
|
1244 |
Vector myDimensions = (Vector) value; |
|
1245 |
if (value != null |
|
1246 |
&& (oldDimensions == null || !(oldDimensions.size() == myDimensions |
|
1247 |
.size() && oldDimensions |
|
1248 |
.containsAll(myDimensions)))) { |
|
1249 |
oldDimensions = myDimensions; |
|
1250 |
} |
|
1251 |
fireWizardComplete(isCorrectlyConfigured()); |
|
1252 |
} |
|
1253 |
}); |
|
1184 |
private InfoPanel getTabInfo() { |
|
1185 |
if (tabInfo == null) { |
|
1186 |
tabInfo = new InfoPanel(); |
|
1254 | 1187 |
|
1255 | 1188 |
} |
1256 |
return tabDimensions;
|
|
1189 |
return tabInfo;
|
|
1257 | 1190 |
} |
1258 | 1191 |
|
1259 | 1192 |
/** |
... | ... | |
1263 | 1196 |
return getChkTransparency().isSelected(); |
1264 | 1197 |
} |
1265 | 1198 |
|
1266 |
/** |
|
1267 |
* @return |
|
1268 |
*/ |
|
1269 |
@SuppressWarnings("unchecked") |
|
1270 |
public Vector getDimensions() { |
|
1271 |
return getTabDimensions().getDimensions(); |
|
1272 |
} |
|
1273 |
|
|
1274 | 1199 |
public void initWizard() { |
1275 | 1200 |
} |
1276 | 1201 |
|
1277 | 1202 |
public void execute() { |
1278 | 1203 |
} |
1279 | 1204 |
|
1280 |
protected boolean nodeSelected(TreePath[] selection, RemoteLayerNode node) {
|
|
1205 |
protected boolean nodeSelected(TreePath[] selection, WMTSTheme node) {
|
|
1281 | 1206 |
for (int i = 0; i < selection.length; i++) { |
1282 | 1207 |
Object[] components = selection[i].getPath(); |
1283 | 1208 |
for (int j = 0; j < components.length; j++) { |
1284 |
if (components[j] instanceof RemoteLayerNode) {
|
|
1285 |
if (((RemoteLayerNode) components[j]).getTitle().compareTo(
|
|
1209 |
if (components[j] instanceof WMTSTheme) {
|
|
1210 |
if (((WMTSTheme) components[j]).getTitle().compareTo(
|
|
1286 | 1211 |
node.getTitle()) == 0) { |
1287 | 1212 |
return true; |
1288 | 1213 |
} |
... | ... | |
1368 | 1293 |
if (btnDown == null) { |
1369 | 1294 |
btnDown = new JButton(); |
1370 | 1295 |
btnDown.setBounds(438, 215, 30, 30); |
1371 |
btnDown.setToolTipText(PluginServices.getText(this, |
|
1372 |
"move_layer_down")); |
|
1296 |
btnDown.setToolTipText(PluginServices.getText(this, "move_layer_down")); |
|
1373 | 1297 |
btnDown.addActionListener(new java.awt.event.ActionListener() { |
1374 | 1298 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
1375 | 1299 |
LayerList list = getLstSelectedLayers(); |
... | ... | |
1377 | 1301 |
int index = list.getSelectedIndex(); |
1378 | 1302 |
if (selectedIndices != null |
1379 | 1303 |
&& selectedIndices.length == 1 |
1380 |
&& index < getLstSelectedLayers().getModel() |
|
1381 |
.getSize() - 1) { |
|
1304 |
&& index < getLstSelectedLayers().getModel().getSize() - 1) { |
|
1382 | 1305 |
JDnDListModel m = (JDnDListModel) list.getModel(); |
1383 | 1306 |
m.itemsMoved(index + 1, new int[] { index }); |
1384 | 1307 |
list.setSelectedIndex(index + 1); |
1385 | 1308 |
} |
1386 | 1309 |
} |
1387 | 1310 |
}); |
1388 |
btnDown.setIcon(PluginServices.getIconTheme() |
|
1389 |
.get("aplication-preferences-downarrow")); |
|
1311 |
btnDown.setIcon(PluginServices.getIconTheme().get("aplication-preferences-downarrow")); |
|
1390 | 1312 |
} |
1391 | 1313 |
return btnDown; |
1392 | 1314 |
} |
... | ... | |
1395 | 1317 |
sizeFixed = sz; |
1396 | 1318 |
} |
1397 | 1319 |
|
1398 |
@SuppressWarnings("unchecked") |
|
1399 | 1320 |
public ArrayList getSelectedPaths() { |
1400 | 1321 |
return selectedPaths; |
1401 | 1322 |
} |
... | ... | |
1411 | 1332 |
*/ |
1412 | 1333 |
private JCheckBox getChkDisagregate() { |
1413 | 1334 |
if (chkDisagregate == null) { |
1414 |
|
|
1415 | 1335 |
chkDisagregate = new JCheckBox(); |
1416 | 1336 |
chkDisagregate.setBounds(new java.awt.Rectangle(19,276,269,20)); |
1417 |
chkDisagregate.setText(PluginServices.getText(this, |
|
1418 |
"disagregate_layers")); |
|
1337 |
chkDisagregate.setText(PluginServices.getText(this, "disagregate_layers")); |
|
1419 | 1338 |
chkDisagregate.setSelected(false); |
1420 |
|
|
1421 | 1339 |
} |
1422 | 1340 |
return chkDisagregate; |
1423 | 1341 |
} |
... | ... | |
1432 | 1350 |
|
1433 | 1351 |
@Override |
1434 | 1352 |
public DataStoreParameters[] getParameters() { |
1435 |
// TODO Auto-generated method stub |
|
1436 | 1353 |
return null; |
1437 | 1354 |
} |
1438 | 1355 |
|
1439 | 1356 |
@Override |
1440 | 1357 |
public void close() { |
1441 |
// Nothing to do |
|
1442 | 1358 |
} |
1443 | 1359 |
|
1444 | 1360 |
public WMTSServerExplorer getExplorer() { |
Also available in: Unified diff