Revision 2613

View differences:

org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSServerExplorer.java
157 157
		}
158 158
        try {
159 159
        	ogcClient = WMTSOGCLocator.getManager().createWMTSClient(url.toString());
160
        	ogcClient.setForceLongitudeFirstAxisOrder(parameters.isLongitudeFirst());
160
        	ogcClient.setForceChangeAxisOrder(parameters.isLongitudeFirst());
161 161
        	if (!ogcClient.connect(override, cancellable))
162 162
        		throw new ConnectException("Error connecting");
163 163
        } catch (IOException e) {
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSProvider.java
96 96
import org.gvsig.raster.wmts.ogc.exception.DownloadException;
97 97
import org.gvsig.raster.wmts.ogc.exception.ServerErrorException;
98 98
import org.gvsig.raster.wmts.ogc.exception.WMTSException;
99
import org.gvsig.raster.wmts.ogc.struct.WMTSBoundingBox;
100 99
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer;
101 100
import org.gvsig.raster.wmts.ogc.struct.WMTSTile;
102 101
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrix;
......
432 431
	}
433 432
	
434 433
	/**
435
	 * Gets the bounding box in world coordinates. If the layer has grid subsets (TileMatrixLimits) then
434
	 * <p>
435
	 * Gets the bounding box in world coordinates. 
436
	 * If the layer has defined the BoundingBox tag, we will take this bounding box as entire 
437
	 * extension of this layer, else we'll see if the tag WGS84BoundingBox is defined (it can be approximated).
438
	 * In this case we'll take WGS84BoundingBox as entire extension.
439
	 * </p>
440
	 * <br>
441
	 * Note: 
442
	 * <br>
443
	 * <p>
444
	 * If the layer has grid subsets (TileMatrixLimits) then
436 445
	 * this will have a only extent but if the layer doesn't have grid subsets then this will have a different
437 446
	 * extent in each level resolution. In this case we need to know the extent for each level.
447
	 * </p>
438 448
	 * @return Extent
439 449
	 */
440 450
	public Extent getExtent() {
441 451
		WMTSDataParameters p = (WMTSDataParameters)parameters;
442
		if(gridSubsets) {
443
			WMTSLayer layer = p.getLayer();
452
		WMTSLayer layer = p.getLayer();
453

  
454
		if(layer.getBBox() != null)
455
			return new ExtentImpl(layer.getBBox().toRectangle2D());
456
		
457
		if(layer.getWGS84BBox() != null) {
458
			String crsCode = p.getSRSCode();
459
			Rectangle2D r = layer.getWGS84BBoxTransformed(crsCode);
460
			if(r != null)
461
				return new ExtentImpl(r);
462
		}
463
			
464
		if(bbox == null)
465
			getExtentByResolutionLevel();
466
		return bbox;
467
		
468
		/*if(gridSubsets) {
444 469
			WMTSBoundingBox bbox = layer.getWGS84BBox();
445 470
			return new ExtentImpl(bbox.toRectangle2D());
446 471
		} else {
447
			/*WMTSTileMatrixSet tileMatrixSet = getTileMatrixSetLink().getTileMatrixSet();
448
			
449
			//Si ya se han calculado los niveles es q el extent es v?lido sino el nivel ser? el 0
450
			double scale = 0D;
451
			int level = 0;
452
			if(extentByLevel != null && p.getExtent() != null) {
453
				scale = getScale(p.getExtent(), p.getWidth());
454
				try {
455
					level = getLevelFromScale(scale, tileMatrixSet);
456
				} catch (RasterDriverException e) {
457
					e.printStackTrace();
458
				}				
459
			}
460
			
461
			Extent[] ext = getExtentByResolutionLevel();
462
			
463
			if(ext != null && level >= 0 && level < ext.length)
464
				return ext[level];*/
465 472
			if(bbox == null)
466 473
				getExtentByResolutionLevel();
467 474
			return bbox;
468
		}
475
		}*/
469 476
	}
470 477
	
471 478
	/**
......
524 531
				WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixList.get(i);
525 532
		    	if(!p.isProjected()) {
526 533
		    		widthMtsTile = (tileMatrix.getScaleDenominator() * tileMatrix.getTileWidth() * 0.28) / (MTS_X_GRADO * 1000);
527
		    		heightMtsTile = (tileMatrix.getScaleDenominator() * tileMatrix.getTileWidth() * 0.28) / (MTS_X_GRADO * 1000);
534
		    		heightMtsTile = (tileMatrix.getScaleDenominator() * tileMatrix.getTileHeight() * 0.28) / (MTS_X_GRADO * 1000);
528 535
		    	} else {
529 536
		    		widthMtsTile = (tileMatrix.getScaleDenominator() * tileMatrix.getTileWidth() * 0.28) / 1000;
530
		    		heightMtsTile = (tileMatrix.getScaleDenominator() * tileMatrix.getTileWidth() * 0.28) / 1000;
537
		    		heightMtsTile = (tileMatrix.getScaleDenominator() * tileMatrix.getTileHeight() * 0.28) / 1000;
531 538
		    	}
532 539
		    	
533
		    	double h = Math.abs(tileMatrix.getTopLeftCorner()[0] - (tileMatrix.getTopLeftCorner()[0] - (tileMatrix.getMatrixHeight() * heightMtsTile)));
540
		    	//TODO: Revisar!!! Creo que el top left sale al rev?s en el de la nasa
541
		    	
542
		    	double h = Math.abs(tileMatrix.getTopLeftCorner()[1] - (tileMatrix.getTopLeftCorner()[1] - (tileMatrix.getMatrixHeight() * heightMtsTile)));
534 543
		    	Rectangle2D r = new Rectangle2D.Double(
535
		    			tileMatrix.getTopLeftCorner()[1], 
536
		    			tileMatrix.getTopLeftCorner()[0] - h,
537
		    			Math.abs(tileMatrix.getTopLeftCorner()[1] - (tileMatrix.getTopLeftCorner()[1] + (tileMatrix.getMatrixWidth() * widthMtsTile))),
544
		    			tileMatrix.getTopLeftCorner()[0], 
545
		    			tileMatrix.getTopLeftCorner()[1] - h,
546
		    			Math.abs(tileMatrix.getTopLeftCorner()[0] - (tileMatrix.getTopLeftCorner()[0] + (tileMatrix.getMatrixWidth() * widthMtsTile))),
538 547
		    			h);
539 548
		    	extentByLevel[i] = new ExtentImpl(r);
540 549
		    	if(i == 0) {
......
981 990
		status.setTileMatrixSet(tileMatrixSet.getIdentifier());
982 991
		status.setTileMatrix(tileMatrix.getIdentifier());
983 992
		status.setLevel(level - dif);
993
		status.setDimension(p.getDimension());
994
		status.setValueForDimension(p.getDimensionSelectedValue());
984 995
		
985
		wmtsLayer.buildResourceURLListFromTemplate(status, null);
996
		wmtsLayer.buildResourceURLListFromTemplate(status);
986 997
		this.lastStatus = status;
987 998
		
988 999
		return status;
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSDataParameters.java
47 47
	public static final String      FIELD_DELETECACHE     = "deletecache";
48 48
	public static final String      FIELD_STYLE_NAME      = "style";
49 49
	public static final String      FIELD_EXTENT          = "extent";
50
	public static final String      FIELD_DIMENSION       = "dimension";
51
	public static final String      FIELD_DIMENSION_VALUE = "selected_dimension_value";
50 52
	
51 53
	/**
54
	 * Gets the selected dimension
55
	 * @return
56
	 */
57
	public String getDimension();
58
	
59
	/**
60
	 * Sets the selected dimension
61
	 * @param dimension
62
	 */
63
	public void setDimension(String dimension);
64
	
65
	/**
66
	 * Gets the value for the selected dimension
67
	 * @return
68
	 */
69
	public String getDimensionSelectedValue();
70
	
71
	/**
72
	 * Sets the value for the selected dimension
73
	 * @param dimension
74
	 */
75
	public void setDimensionSelectedValue(String dimension);
76
	
77
	/**
52 78
	 * Sets the style selected
53 79
	 * @param layer
54 80
	 */
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSDataParametersImpl.java
118 118
		.setDescription("Bounding box")
119 119
		.setMandatory(false);
120 120
		
121
		definition.addDynFieldString(FIELD_DIMENSION)
122
		.setDescription("Dimensions")
123
		.setMandatory(false);
124
		
125
		definition.addDynFieldString(FIELD_DIMENSION_VALUE)
126
		.setDescription("Value selected for the current dimension")
127
		.setMandatory(false);
128
		
121 129
		return definition;
122 130
	}
123 131
	
124 132
	/**
133
	 * Gets the selected dimension
134
	 * @return
135
	 */
136
	public String getDimension() {
137
		return (String)getDynValue(FIELD_DIMENSION);
138
	}
139
	
140
	/**
141
	 * Sets the selected dimension
142
	 * @param dimension
143
	 */
144
	public void setDimension(String dimension) {
145
		setDynValue(FIELD_DIMENSION, dimension);
146
	}
147
	
148
	/**
149
	 * Gets the value for the selected dimension
150
	 * @return
151
	 */
152
	public String getDimensionSelectedValue() {
153
		return (String)getDynValue(FIELD_DIMENSION_VALUE);
154
	}
155
	
156
	/**
157
	 * Sets the value for the selected dimension
158
	 * @param dimension
159
	 */
160
	public void setDimensionSelectedValue(String dimension) {
161
		setDynValue(FIELD_DIMENSION_VALUE, dimension);
162
	}
163
	
164
	/**
125 165
	 * Gets the bounding box
126 166
	 * @return
127 167
	 */
......
207 247
		}
208 248
 			
209 249
		if(srs.contains("EPSG:") && !srs.startsWith("EPSG:")) {
210
			return "EPSG:" + srs.substring(srs.lastIndexOf("EPSG:") + 1);
250
			return "EPSG:" + srs.substring(srs.lastIndexOf(":") + 1);
211 251
		}
212 252
		return srs;
213 253
	}
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/downloader/TileDownloaderForWMTS.java
97 97
			status.setTileCol(tile.getCol());
98 98
			
99 99
			String urlFromTemplate = status.getResourceURL(tile.getRow() + "" + tile.getCol() + "");
100
			System.out.println(urlFromTemplate);
100 101
			File f = null;
101 102
			if(urlFromTemplate != null)
102 103
				f = getOGCClient().getTile(urlFromTemplate, tile.getCancelled(), tile.getFile());
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.api/src/main/java/org/gvsig/raster/wmts/swing/WmtsGUI.java
70 70
	
71 71
	public abstract void addChangeTabListener(MouseAdapter eventMouse);
72 72
	
73
	/**
74
	 * Listener to report when the wizard is completely configured
75
	 * @param support
76
	 */
77
	public abstract void setListenerSupport(WMTSWizardListener support);
78
	
79 73
	public abstract void updateSelectedInfo(HashMap<String, Object> info);
80 74

  
81 75
}
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.api/src/main/java/org/gvsig/raster/wmts/swing/WMTSWizardListener.java
1 1
package org.gvsig.raster.wmts.swing;
2 2

  
3 3
public interface WMTSWizardListener {
4
	public void callStateChanged(boolean finishable);
4
	public void correctlyConfiguredEvent(boolean finishable);
5
	
6
	public void addLayerEvent();
7
	
8
	public void removeLayerEvent();
5 9
}
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/resources/org/gvsig/raster/wmts/swing/impl/i18n/text.properties
1
WMTSLayer=Capa WMTS
2
select_info_formats=Seleccionar formatos de texto (Info)
3
wmts_properties=Propiedades WMTS
4
wmts_cant_connect=No ha sido posible realizar la conexi\u00f3n con el servidor WMTS
5
wmts_not_queryable=Este servidor no acepta peticiones de este tipo
6
wmts_server_error=Error del servidor WMTS
7
wmts_transparency=Transparencia
8
WMTSLayer=Capa WMTS
9
fit_WMTS_layer=Ajustar capa WMTS
10
invert_axis_order=Invertir orden de los ejes
11
cache_refresh=Este check debe estar activado antes de pulsar el bot?n de conectar.\n Si la capa fue cargada previamente con este check box\n en distinta posici?n es posible que el contenido de la cach? sea erroneo \n. Limpiela antes de continuar.
12
view_type=Tipo de vista
13
layerlist_view_selection=Ver como lista de capas
14
themes_view_selection=Ver como temas 
15
view_not_disposable=No hay themas definidos en este servidor
16
theme_without_reference=Tema sin capa referenciada. \n Selecciona desde la lista de capas.
17
host_unreachable=No se puede conectar con el servidor. Tal vez la red est? desconectada o el servidor apagado.
18
ip_unknown=Direcci?n IP desconocida
19
network_error=Error en la conexi?n a red
20
dimension=Dimensi?n
21
dimensions=Dimensiones
22
value_list=Lista de valores posibles
23
selected_value=Valor seleccionado
0 24

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/resources/org/gvsig/raster/wmts/swing/impl/i18n/text_en.properties
1
WMTSLayer=WMTS Layer
2
select_info_formats=Select text formats for Info by point
3
wmts_properties=WMTS Properties
4
wmts_cant_connect=The connection cannot be established
5
wmts_not_queryable=This server does not accept this kind of requests
6
wmts_server_error=Error in WMTS Server
7
wmts_transparency=Transparency
8
WMTSLayer=WMTS Layer
9
fit_WMTS_layer=Fits to WTMS layer
10
invert_axis_order=Invert the order of the axes
11
cache_refresh=This check has to be enabled before press the connect button.\n  If the layer was loaded with this check in other status it is possible that the cache not to be correct. \n. Clean the cache before continue.
12
view_type=View type
13
layerlist_view_selection=View as layers list
14
themes_view_selection=View as themes
15
view_not_disposable=There are not themes defined in this server
16
theme_without_reference=Theme without layer referenced.\n Select from the list of layers.
17
host_unreachable=The host is unreachable. Maybe the network is not connected or the host off.
18
ip_unknown=IP address unknown 
19
network_error=Error with the network connection
20
dimension=Dimension
21
dimensions=Dimensions
22
value_list=List of possible values
23
selected_value=Selected value
0 24

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/dimension/ValuesDimensionListPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22
package org.gvsig.raster.wmts.swing.impl.panel.dimension;
23

  
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26

  
27
import javax.swing.DefaultListModel;
28
import javax.swing.JLabel;
29
import javax.swing.JList;
30
import javax.swing.JPanel;
31
import javax.swing.JScrollPane;
32

  
33
import org.gvsig.i18n.Messages;
34

  
35
/**
36
 * Panel for possible values of one dimension
37
 * @author Nacho Brodin (nachobrodin@gmail.com)
38
 */
39
public class ValuesDimensionListPanel extends JPanel {
40
	private static final long             serialVersionUID   = 1L;
41
	private JList                         listOfValues        = null;
42
	private JScrollPane                   jScrollPane        = null;
43
	private JPanel                        jPanelTxt          = null;
44
	private JLabel                        lblTitle           = null;
45
	
46
	public ValuesDimensionListPanel() {
47
		init();
48
	}
49
	
50
	public void init() {
51
		setLayout(new GridBagLayout());
52
		
53
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
54
		gridBagConstraints1.fill = GridBagConstraints.BOTH;
55
		gridBagConstraints1.anchor = GridBagConstraints.WEST;
56
		gridBagConstraints1.gridx = 0;
57
		gridBagConstraints1.gridy = 0;
58
		gridBagConstraints1.weightx = 1.0;
59
		gridBagConstraints1.weighty = 1.0;
60
		gridBagConstraints1.insets = new java.awt.Insets(2,2,2,2);
61
		add(getJPanelTxt(), gridBagConstraints1);
62
	}
63
	
64
	private javax.swing.JPanel getJPanelTxt() {
65
		if (jPanelTxt == null) {
66
			jPanelTxt = new javax.swing.JPanel();
67
			jPanelTxt.setLayout(new GridBagLayout());
68
			jPanelTxt.setBorder(javax.swing.BorderFactory.createTitledBorder(
69
					null, Messages.getText("value_list"),
70
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
71
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
72
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
73
			gridBagConstraints1.gridx = 0;
74
			gridBagConstraints1.gridy = 0;
75
			gridBagConstraints1.insets = new java.awt.Insets(2,2,2,2);
76
			gridBagConstraints1.fill = GridBagConstraints.BOTH;
77
			gridBagConstraints1.anchor = GridBagConstraints.CENTER;
78
			gridBagConstraints1.weightx = 1.0;
79
			gridBagConstraints1.weighty = 1.0;
80
			jPanelTxt.add(getJScrollPane(), gridBagConstraints1);
81
		}
82

  
83
		return jPanelTxt;
84
	}
85
	
86
	public void addElement(String value) {
87
		((DefaultListModel)getListOfValues().getModel()).addElement(value);
88
	}
89
	
90
	public void clearList() {
91
		for (int i = getListOfValues().getModel().getSize() - 1; i >= 0 ; i--) {
92
			((DefaultListModel)getListOfValues().getModel()).remove(i);
93
		}
94
	}
95
	
96
	public JList getListOfValues() {
97
		if (listOfValues == null) {
98
			listOfValues = new JList(new DefaultListModel());
99
		}
100
		return listOfValues;
101
	}
102
	
103
	private javax.swing.JScrollPane getJScrollPane() {
104
		if (jScrollPane == null) {
105
			jScrollPane = new javax.swing.JScrollPane();
106
			jScrollPane.setViewportView(getListOfValues());
107
		}
108

  
109
		return jScrollPane;
110
	}
111
	
112
	public javax.swing.JLabel getJLabelTitle() {
113
		if (lblTitle == null) {
114
			lblTitle = new javax.swing.JLabel();
115
			lblTitle.setText("-");
116
		}
117

  
118
		return lblTitle;
119
	}
120
}
0 121

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/dimension/DimensionComboPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22
package org.gvsig.raster.wmts.swing.impl.panel.dimension;
23

  
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26

  
27
import javax.swing.DefaultComboBoxModel;
28
import javax.swing.JComboBox;
29
import javax.swing.JPanel;
30

  
31
import org.gvsig.i18n.Messages;
32

  
33
/**
34
 * Dimension panel
35
 *
36
 * @author Nacho Brodin (nachobrodin@gmail.com)
37
 */
38
public class DimensionComboPanel extends JPanel {
39
	private static final long   serialVersionUID   = 1L;
40
	private JComboBox           cmbHost            = null;
41
	
42
	public DimensionComboPanel() {
43
		init();
44
	}
45
	
46
	public void init() {
47
		setLayout(new GridBagLayout());
48
		setBorder(javax.swing.BorderFactory.createTitledBorder(
49
				null, Messages.getText("dimension"),
50
				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
51
				javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
52
		
53
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
54
		gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
55
		gridBagConstraints1.anchor = GridBagConstraints.WEST;
56
		gridBagConstraints1.gridx = 0;
57
		gridBagConstraints1.gridy = 0;
58
		gridBagConstraints1.weightx = 1.0;
59
		gridBagConstraints1.insets = new java.awt.Insets(0, 2, 2, 0);
60
		add(getDimensionList(), gridBagConstraints1);
61
	}
62
	
63
	/**
64
	 * This method initializes txtHost
65
	 *
66
	 * @return javax.swing.JTextField
67
	 */
68
	public JComboBox getDimensionList() {
69
		if (cmbHost == null) {
70
			cmbHost = new JComboBox();
71
			cmbHost.setModel(new DefaultComboBoxModel());
72
			cmbHost.setPreferredSize(new java.awt.Dimension(350, 20));
73
			cmbHost.setEditable(false);
74
		}
75

  
76
		return cmbHost;
77
	}
78
	
79
	public String getSelectedDimension() {
80
		return (String)getDimensionList().getSelectedItem();
81
	}
82
	
83
	public void clearDimensions() {
84
		getDimensionList().removeAllItems();
85
	}
86
}
0 87

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/dimension/DimensionPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22
package org.gvsig.raster.wmts.swing.impl.panel.dimension;
23

  
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26
import java.util.List;
27

  
28
import javax.swing.JPanel;
29

  
30
import org.gvsig.raster.wmts.ogc.struct.WMTSDimension;
31

  
32
/**
33
 * Dimension tab panel
34
 *
35
 * @author Nacho Brodin (nachobrodin@gmail.com)
36
 */
37
public class DimensionPanel extends JPanel {
38
	private static final long          serialVersionUID          = 1L;
39
	private DimensionComboPanel        dimensionPanel            = null;
40
	private ValuesDimensionListPanel   valuesDimensionListPanel  = null;
41
	private SelectedValuePanel         selectedValuePanel        = null;
42
	private List<WMTSDimension>        dataModel                 = null;
43
	
44
	
45
	public DimensionPanel() {
46
		init();
47
	}
48
	
49
	public void init() {
50
		setLayout(new GridBagLayout());
51
		
52
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
53
		gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
54
		gridBagConstraints1.anchor = GridBagConstraints.CENTER;
55
		gridBagConstraints1.gridx = 0;
56
		gridBagConstraints1.gridy = 0;
57
		gridBagConstraints1.weightx = 1.0;
58
		gridBagConstraints1.weighty = 0.0;
59
		gridBagConstraints1.insets = new java.awt.Insets(2,2,2,2);
60
		add(getDimensionPanel(), gridBagConstraints1);
61
		
62
		gridBagConstraints1.fill = GridBagConstraints.BOTH;
63
		gridBagConstraints1.anchor = GridBagConstraints.CENTER;
64
		gridBagConstraints1.gridx = 0;
65
		gridBagConstraints1.gridy = 1;
66
		gridBagConstraints1.weightx = 1.0;
67
		gridBagConstraints1.weighty = 1.0;
68
		add(getValuesDimensionListPanel(), gridBagConstraints1);
69
		
70
		gridBagConstraints1.fill = GridBagConstraints.BOTH;
71
		gridBagConstraints1.gridx = 0;
72
		gridBagConstraints1.gridy = 2;
73
		gridBagConstraints1.weighty = 0.0;
74
		add(getSelectedValuePanel(), gridBagConstraints1);
75
	}
76
	
77
	public void setDimensions(List<WMTSDimension> dimensions) {
78
		this.dataModel = dimensions;
79
		getDimensionPanel().clearDimensions();
80
		
81
		for (int i = 0; i < dimensions.size(); i++) {
82
			WMTSDimension dim = dimensions.get(i);
83
			getDimensionPanel().getDimensionList().addItem(dim.getIdentifier());
84
		}
85
		fillDefaultValuesOfSelectedDimension();
86
	}
87
	
88
	private void fillDefaultValuesOfSelectedDimension() {
89
		String selectedDimension = getDimensionPanel().getSelectedDimension();
90
		getValuesDimensionListPanel().clearList();
91
		getSelectedValuePanel().getSelectedValue().setText("");
92
		
93
		for (int i = 0; i < dataModel.size(); i++) {
94
			WMTSDimension dim = dataModel.get(i);
95
			if(dim.getIdentifier().equals(selectedDimension)) {
96
				for (int j = 0; j < dim.getValueList().size(); j++) {
97
					getValuesDimensionListPanel().addElement(dim.getValueList().get(j));
98
				}		
99
			}
100
			getSelectedValuePanel().setValue(dim.getDefaultValue());
101
		}
102
	}
103
	
104
	public void clearGraphicComponents() {
105
		getDimensionPanel().getDimensionList().removeAllItems();
106
		getValuesDimensionListPanel().clearList();
107
		getSelectedValuePanel().getSelectedValue().setText("");
108
	}
109
	
110
	public DimensionComboPanel getDimensionPanel() {
111
		if(dimensionPanel == null) {
112
			dimensionPanel = new DimensionComboPanel();
113
		}
114
		return dimensionPanel;
115
	}
116
	
117
	public ValuesDimensionListPanel getValuesDimensionListPanel() {
118
		if(valuesDimensionListPanel == null) {
119
			valuesDimensionListPanel = new ValuesDimensionListPanel();
120
		}
121
		return valuesDimensionListPanel;
122
	}
123
	
124
	public SelectedValuePanel getSelectedValuePanel() {
125
		if (selectedValuePanel == null) {
126
			selectedValuePanel = new SelectedValuePanel();
127
		}
128
		return selectedValuePanel;
129
	}
130

  
131
}
0 132

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/dimension/SelectedValuePanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22
package org.gvsig.raster.wmts.swing.impl.panel.dimension;
23

  
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26

  
27
import javax.swing.JPanel;
28
import javax.swing.JTextField;
29

  
30
import org.gvsig.i18n.Messages;
31

  
32
/**
33
 * Dimension panel
34
 *
35
 * @author Nacho Brodin (nachobrodin@gmail.com)
36
 */
37
public class SelectedValuePanel extends JPanel {
38
	private static final long   serialVersionUID   = 1L;
39
	private JTextField          value              = null;
40
	
41
	public SelectedValuePanel() {
42
		init();
43
	}
44
	
45
	public void init() {
46
		setLayout(new GridBagLayout());
47
		setBorder(javax.swing.BorderFactory.createTitledBorder(
48
				null, Messages.getText("selected_value"),
49
				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
50
				javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
51
		
52
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
53
		gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
54
		gridBagConstraints1.anchor = GridBagConstraints.WEST;
55
		gridBagConstraints1.gridx = 0;
56
		gridBagConstraints1.gridy = 0;
57
		gridBagConstraints1.weightx = 1.0;
58
		gridBagConstraints1.insets = new java.awt.Insets(0, 2, 2, 0);
59
		add(getSelectedValue(), gridBagConstraints1);
60
	}
61
	
62
	/**
63
	 * This method initializes txtHost
64
	 *
65
	 * @return javax.swing.JTextField
66
	 */
67
	public JTextField getSelectedValue() {
68
		if (value == null) {
69
			value = new JTextField();
70
			value.setPreferredSize(new java.awt.Dimension(350, 20));
71
		}
72

  
73
		return value;
74
	}
75
	
76
	public void setValue(String value) {
77
		getSelectedValue().setText(value);
78
	}
79
}
0 80

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/format/IFormatsPanel.java
29 29
import javax.swing.JPanel;
30 30
import javax.swing.JScrollPane;
31 31

  
32
import org.gvsig.andami.PluginServices;
32
import org.gvsig.i18n.Messages;
33 33
import org.gvsig.raster.wmts.swing.impl.wizard.WMTSParametersListModel;
34 34

  
35 35
/**
......
81 81
			jPanelInfoFormats = new JPanel();
82 82
			jPanelInfoFormats.setLayout(new GridBagLayout());
83 83
			jPanelInfoFormats.setBorder(javax.swing.BorderFactory.createTitledBorder(
84
					null, PluginServices.getText(this, "select_info_formats"),
84
					null, Messages.getText("select_info_formats"),
85 85
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
86 86
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
87 87
					null));
......
106 106
			jPanelLstSrs = new JPanel();
107 107
			jPanelLstSrs.setLayout(new GridBagLayout());
108 108
			jPanelLstSrs.setBorder(javax.swing.BorderFactory.createTitledBorder(
109
					null, PluginServices.getText(this, "seleccionar_srs"),
109
					null, Messages.getText("seleccionar_srs"),
110 110
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
111 111
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
112 112
					null));
......
130 130
			jPanelImageFormats = new JPanel();
131 131
			jPanelImageFormats.setLayout(new GridBagLayout());
132 132
			jPanelImageFormats.setBorder(javax.swing.BorderFactory.createTitledBorder(
133
					null, PluginServices.getText(this, "select_formats"),
133
					null, Messages.getText("select_formats"),
134 134
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
135 135
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
136 136
					null));
......
233 233
	public JCheckBox getChkTransparency() {
234 234
		if (chkTransparency == null) {
235 235
			chkTransparency = new JCheckBox();
236
			chkTransparency.setText(PluginServices.getText(this,
237
					"wms_transparency"));
236
			chkTransparency.setText(Messages.getText("wms_transparency"));
238 237
			chkTransparency.setSelected(true);
239 238
		}
240 239
		return chkTransparency;
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/layer/ILayerPanel.java
159 159
			jPanelSelectLayers = new JPanel();
160 160
			jPanelSelectLayers.setLayout(new GridBagLayout());
161 161
			jPanelSelectLayers.setBorder(javax.swing.BorderFactory.createTitledBorder(
162
					null, PluginServices.getText(this, "select_layers"),
162
					null, Messages.getText("select_layers"),
163 163
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
164 164
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
165 165
					null));
......
224 224
	public JCheckBox getChkExtendedNames() {
225 225
		if (chkExtendedNames == null) {
226 226
			chkExtendedNames = new JCheckBox();
227
			chkExtendedNames.setText(PluginServices.getText(this, "show_layer_names"));
227
			chkExtendedNames.setText(Messages.getText("show_layer_names"));
228 228
		}
229 229
		return chkExtendedNames;
230 230
	}
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/layer/LayersSelectedPanel.java
31 31
import javax.swing.JScrollPane;
32 32

  
33 33
import org.gvsig.andami.IconThemeHelper;
34
import org.gvsig.andami.PluginServices;
35 34
import org.gvsig.gui.beans.controls.dnd.JDnDListModel;
35
import org.gvsig.i18n.Messages;
36 36

  
37 37
/**
38 38
 * Layer list panel
......
130 130
		if (btnUp == null) {
131 131
			btnUp = new JButton();
132 132
			btnUp.setPreferredSize(new Dimension(30, 30));
133
			btnUp.setToolTipText(PluginServices.getText(this, "move_layer_up"));
133
			btnUp.setToolTipText(Messages.getText("move_layer_up"));
134 134
			btnUp.setIcon(loadIcon("aplication-preferences-uparrow"));
135 135
		}
136 136
		return btnUp;
......
144 144
		if (btnDown == null) {
145 145
			btnDown = new JButton();
146 146
			btnDown.setPreferredSize(new Dimension(30, 30));
147
			btnDown.setToolTipText(PluginServices.getText(this, "move_layer_down"));
147
			btnDown.setToolTipText(Messages.getText("move_layer_down"));
148 148
			btnDown.setIcon(loadIcon("aplication-preferences-downarrow"));
149 149
		}
150 150
		return btnDown;
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/layer/AddDelLayerPanel.java
27 27
import javax.swing.JButton;
28 28
import javax.swing.JPanel;
29 29

  
30
import org.gvsig.andami.PluginServices;
30
import org.gvsig.i18n.Messages;
31 31

  
32 32
/**
33 33
 * Layer list panel
......
92 92
		if (btnAdd == null) {
93 93
			btnAdd = new JButton();
94 94
			btnAdd.setPreferredSize(new java.awt.Dimension(100, 20));
95
			btnAdd.setText(PluginServices.getText(this, "add"));
95
			btnAdd.setText(Messages.getText("add"));
96 96
		}
97 97
		return btnAdd;
98 98
	}
......
106 106
			btnRemove = new JButton();
107 107
			btnRemove.setEnabled(false);
108 108
			btnRemove.setPreferredSize(new java.awt.Dimension(100, 20));
109
			btnRemove.setText(PluginServices.getText(this, "remove"));
109
			btnRemove.setText(Messages.getText("remove"));
110 110
		}
111 111
		return btnRemove;
112 112
	}
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/layer/LayerTree.java
29 29
import javax.swing.ToolTipManager;
30 30
import javax.swing.tree.DefaultTreeCellRenderer;
31 31

  
32
import org.gvsig.andami.PluginServices;
33 32
import org.gvsig.gui.beans.controls.MultiLineToolTip;
33
import org.gvsig.i18n.Messages;
34 34
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer;
35 35

  
36 36

  
......
74 74
                    myAbstract = format(myAbstract.trim(), 100);
75 75
                
76 76
                String text =
77
                    PluginServices.getText(this, "abstract") + ":\n" + myAbstract + "\n\n";
77
                    Messages.getText("abstract") + ":\n" + myAbstract + "\n\n";
78 78
                
79 79
                setToolTipText(text);
80 80
                
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/main/ConnectPanel.java
29 29
import javax.swing.JCheckBox;
30 30
import javax.swing.JPanel;
31 31

  
32
import org.gvsig.andami.PluginServices;
32
import org.gvsig.i18n.Messages;
33 33
import org.gvsig.utils.swing.jcomboServer.JComboServer;
34 34

  
35 35
/**
......
53 53
	public void init() {
54 54
		setLayout(new GridBagLayout());
55 55
		setBorder(javax.swing.BorderFactory.createTitledBorder(
56
				null, PluginServices.getText(this, "server"),
56
				null, Messages.getText("server"),
57 57
				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
58 58
				javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
59 59
		
......
113 113
		if (btnConnect == null) {
114 114
			btnConnect = new JButton();
115 115
			btnConnect.setPreferredSize(new java.awt.Dimension(110, 20));
116
			btnConnect.setText(PluginServices.getText(this, "conectar"));
116
			btnConnect.setText(Messages.getText("conectar"));
117 117
		}
118 118
		return btnConnect;
119 119
	}
......
127 127
			btnCancel = new JButton();
128 128
			btnCancel.setEnabled(false);
129 129
			btnCancel.setPreferredSize(new java.awt.Dimension(110, 20));
130
			btnCancel.setText(PluginServices.getText(this, "cancel"));
130
			btnCancel.setText(Messages.getText("cancel"));
131 131
		}
132 132
		return btnCancel;
133 133
	}
......
156 156
	public JCheckBox getChkCaching() {
157 157
		if (chkCaching == null) {
158 158
			chkCaching = new JCheckBox();
159
			chkCaching.setText(PluginServices.getText(this, "refresh_capabilities"));
160
			chkCaching.setToolTipText(PluginServices.getText(this, "refresh_capabilities_tooltip"));
159
			chkCaching.setText(Messages.getText("refresh_capabilities"));
160
			chkCaching.setToolTipText(Messages.getText("refresh_capabilities_tooltip"));
161 161
		}
162 162
		return chkCaching;
163 163
	}
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/main/NextPrevPanelImpl.java
27 27
import javax.swing.JButton;
28 28
import javax.swing.JLabel;
29 29

  
30
import org.gvsig.andami.PluginServices;
30
import org.gvsig.i18n.Messages;
31 31
import org.gvsig.raster.wmts.swing.NextPrevPanel;
32 32

  
33 33
/**
......
79 79
		if (btnSiguiente == null) {
80 80
			btnSiguiente = new JButton();
81 81
			btnSiguiente.setPreferredSize(new java.awt.Dimension(110, 20));
82
			btnSiguiente.setText(PluginServices.getText(this, "siguiente"));
82
			btnSiguiente.setText(Messages.getText("siguiente"));
83 83
		}
84 84
		return btnSiguiente;
85 85
	}
......
93 93
		if (btnAnterior == null) {
94 94
			btnAnterior = new JButton();
95 95
			btnAnterior.setPreferredSize(new java.awt.Dimension(110, 20));
96
			btnAnterior.setText(PluginServices.getText(this, "anterior"));
96
			btnAnterior.setText(Messages.getText("anterior"));
97 97
		}
98 98
		return btnAnterior;
99 99
	}
......
107 107
		if (lblServerType == null) {
108 108
			lblServerType = new JLabel();
109 109
			lblServerType.setFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 11));
110
			lblServerType.setText(PluginServices.getText(this, "server_type")+":");
110
			lblServerType.setText(Messages.getText("server_type")+":");
111 111
		}
112 112

  
113 113
		return lblServerType;
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/main/IServerPanel.java
33 33
import javax.swing.JOptionPane;
34 34
import javax.swing.JPanel;
35 35

  
36
import org.gvsig.andami.PluginServices;
36
import org.gvsig.i18n.Messages;
37 37
import org.gvsig.raster.wmts.swing.AddServerPanel;
38 38
import org.gvsig.utils.swing.jcomboServer.JComboServer;
39 39

  
......
113 113
	public JCheckBox getChkInvertAxisOrder() {
114 114
		if (chkInvertAxisOrder == null) {
115 115
			chkInvertAxisOrder = new JCheckBox();
116
			chkInvertAxisOrder.setText(PluginServices.getText(this, "invert_axis_order"));
116
			chkInvertAxisOrder.setText(Messages.getText("invert_axis_order"));
117 117
			chkInvertAxisOrder.setSelected(false);
118 118
			chkInvertAxisOrder.addActionListener(this);
119 119
		}
......
181 181

  
182 182
	public void actionPerformed(ActionEvent e) {
183 183
		if(e.getSource() == getChkInvertAxisOrder()) {
184
			String string = PluginServices.getText(this, "accept");
184
			String string = Messages.getText("accept");
185 185
			Object[] options = {string};
186 186
			JOptionPane.showOptionDialog((Component)/*PluginServices.getMainFrame()*/this,
187
						"<html>" + PluginServices.getText(this, "cache_refresh").replaceAll("\n", "<br>") + "</html>",
188
						PluginServices.getText(this, "confirmacion"),
187
						"<html>" + Messages.getText("cache_refresh").replaceAll("\n", "<br>") + "</html>",
188
						Messages.getText("confirmacion"),
189 189
						JOptionPane.OK_OPTION,
190 190
						JOptionPane.INFORMATION_MESSAGE,
191 191
						null,
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/panel/main/DescriptionPanel.java
30 30
import javax.swing.JScrollPane;
31 31
import javax.swing.JTextArea;
32 32

  
33
import org.gvsig.andami.PluginServices;
33
import org.gvsig.i18n.Messages;
34 34

  
35 35
/**
36 36
 * Connect panel
......
93 93
			jPanelTxt = new javax.swing.JPanel();
94 94
			jPanelTxt.setLayout(new GridBagLayout());
95 95
			jPanelTxt.setBorder(javax.swing.BorderFactory.createTitledBorder(
96
					null, PluginServices.getText(this, "description"),
96
					null, Messages.getText("description"),
97 97
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
98 98
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
99 99
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
......
168 168
	private javax.swing.JLabel getJLabelName() {
169 169
		if (jLabelName == null) {
170 170
			jLabelName = new javax.swing.JLabel();
171
			jLabelName.setText(PluginServices.getText(this, "name") + ":");
171
			jLabelName.setText(Messages.getText("name") + ":");
172 172
		}
173 173

  
174 174
		return jLabelName;
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/wizard/InfoPanel.java
29 29
import javax.swing.JPanel;
30 30
import javax.swing.JScrollPane;
31 31

  
32
import org.gvsig.andami.PluginServices;
32
import org.gvsig.i18n.Messages;
33 33
import org.gvsig.raster.wmts.io.WMTSServerExplorer;
34 34
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification;
35 35
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme;
......
46 46
    //private final String bgColor2 = "\"#F2FEFF\""; // light blue
47 47
    private final String bgColor3 = "\"#FBFFE1\""; // light yellow
48 48

  
49
    private final String service_title       = PluginServices.getText(this, "service_info");
50
    private final String server              = PluginServices.getText(this, "server");
51
    private final String server_type         = PluginServices.getText(this, "server_type");
52
    private final String server_abstract     = PluginServices.getText(this, "server_abstract");
53
    private final String server_title        = PluginServices.getText(this, "server_title");
54
    private final String layers_title        = PluginServices.getText(this, "selected_layers");
55
    private final String layer_title         = PluginServices.getText(this, "layer_title");
56
    private final String layer_abstract      = PluginServices.getText(this, "layer_abstract");
57
    private final String selected_dimensions = PluginServices.getText(this, "selected_dimensions");
58
    private final String style               = PluginServices.getText(this, "style");
59
    private final String format_title        = PluginServices.getText(this, "format");
49
    private final String service_title       = Messages.getText("service_info");
50
    private final String server              = Messages.getText("server");
51
    private final String server_type         = Messages.getText("server_type");
52
    private final String server_abstract     = Messages.getText("server_abstract");
53
    private final String server_title        = Messages.getText("server_title");
54
    private final String layers_title        = Messages.getText("selected_layers");
55
    private final String layer_title         = Messages.getText("layer_title");
56
    private final String layer_abstract      = Messages.getText("layer_abstract");
57
    private final String selected_dimensions = Messages.getText("selected_dimensions");
58
    private final String style               = Messages.getText("style");
59
    private final String format_title        = Messages.getText("format");
60 60
    private final String srs_title           = "SRS";
61
    private final String properties			 = PluginServices.getText(this, "properties");
62
    private final String layer_name			 = PluginServices.getText(this, "name");
61
    private final String properties			 = Messages.getText("properties");
62
    private final String layer_name			 = Messages.getText("name");
63 63
	private JEditorPane editor = null;
64 64

  
65 65

  
......
115 115
            server_abstract_text = "-";
116 116

  
117 117
        if (format == null)
118
            format = PluginServices.getText(this, "none_selected");
118
            format = Messages.getText("none_selected");
119 119
        if (srs == null)
120
            srs = PluginServices.getText(this, "none_selected");
120
            srs = Messages.getText("none_selected");
121 121

  
122 122
        String layers_html = "";
123 123
        for (int i = 0; i < layers.size(); i++) {
124 124
        	WMTSTheme layer = ((LayerUI) layers.get(i)).theme;
125 125
            String layer_name_text = layer.getTitle();
126
            String style_title = (((LayerUI) layers.get(i)).styleSelected == null) ? PluginServices.getText(this, "not_available") : ((LayerUI) layers.get(i)).styleSelected.getTitle();
126
            String style_title = (((LayerUI) layers.get(i)).styleSelected == null) ? Messages.getText("not_available") : ((LayerUI) layers.get(i)).styleSelected.getTitle();
127 127
            String layer_abstract_text = layer.getAbstract();
128 128
            String layer_title_text = layer.getTitle();
129 129

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/wizard/WMTSParamsPanel.java
52 52
import javax.swing.event.TreeSelectionListener;
53 53
import javax.swing.tree.TreePath;
54 54

  
55
import org.gvsig.andami.PluginServices;
56 55
import org.gvsig.fmap.dal.DataParameters;
57 56
import org.gvsig.fmap.dal.DataStoreParameters;
58 57
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
......
63 62
import org.gvsig.gui.beans.listeners.BeanListener;
64 63
import org.gvsig.raster.wmts.io.WMTSDataParameters;
65 64
import org.gvsig.raster.wmts.io.WMTSServerExplorer;
65
import org.gvsig.raster.wmts.ogc.struct.WMTSDimension;
66 66
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle;
67 67
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme;
68 68
import org.gvsig.raster.wmts.swing.WMTSWizardListener;
69 69
import org.gvsig.raster.wmts.swing.WmtsGUI;
70
import org.gvsig.raster.wmts.swing.impl.panel.dimension.DimensionPanel;
70 71
import org.gvsig.raster.wmts.swing.impl.panel.format.IFormatsPanel;
71 72
import org.gvsig.raster.wmts.swing.impl.panel.layer.ILayerPanel;
72 73
import org.gvsig.raster.wmts.swing.impl.panel.layer.LayerList;
......
87 88
 * @author Nacho Brodin (nachobrodin@gmail.com)
88 89
 */
89 90
public class WMTSParamsPanel extends WmtsGUI implements ActionListener, ItemListener, KeyListener, ListSelectionListener, MouseListener, TreeSelectionListener {
90
	private static final long      serialVersionUID           = 1L;
91
	private static final long        serialVersionUID           = 1L;
91 92

  
92
	private InfoPanel              tabInfo                    = null;
93
	private ILayerPanel            layerPanel                 = null;
94
	private StylesPanel            tabStyle                   = null;
95
	private IFormatsPanel          formatsPanel               = null;
93
	private InfoPanel                tabInfo                    = null;
94
	private ILayerPanel              layerPanel                 = null;
95
	private StylesPanel              tabStyle                   = null;
96
	private IFormatsPanel            formatsPanel               = null;
97
	private DimensionPanel           dimensionPanel             = null;
96 98

  
97
	private ArrayList<TreePath>    selectedPaths              = new ArrayList<TreePath>();
98
	private WMTSWizardListener     listenerSupport            = null;
99
	private JTabbedPane            jTabbedPane                = null;
100
	private int                    dimensionTabIndex;
101
	private int                    stylesTabIndex;
102
	protected WMTSServerExplorer   explorer                   = null;
103
	public static Preferences      fPrefs                     = Preferences.userRoot().node("gvsig.wmts-wizard");
104
	private boolean                deleteCache                = false;
99
	private ArrayList<TreePath>      selectedPaths              = new ArrayList<TreePath>();
100
	private WMTSWizardListener       listenerSupport            = null;
101
	private JTabbedPane              jTabbedPane                = null;
102
	protected WMTSServerExplorer     explorer                   = null;
103
	public static Preferences        fPrefs                     = Preferences.userRoot().node("gvsig.wmts-wizard");
104
	private boolean                  deleteCache                = false;
105
	private HashMap<Object, Integer> tabsIndexes                = new HashMap<Object, Integer>();
106
	//private Logger                   log                        = LoggerFactory.getLogger(WMTSParamsPanel.class);
105 107

  
106 108
	/**
107 109
	 * Layer to add to the selected layers box 
......
132 134
		initialize();
133 135
	}
134 136

  
135
	// TODO: crear nuevo constructor para a?adir los panels que quieras...
136 137
	public WMTSParamsPanel(WMTSServerExplorer data) {
137 138
		super();
138 139
		setWizardData(data);
......
141 142
		if (jTabbedPane == null) {
142 143
			jTabbedPane = new JTabbedPane();
143 144
			jTabbedPane.setBounds(4, 4, 502, 415);
144
			StylesPanel sp = getTabStyle();
145 145

  
146
			jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getLayerPanel(), null);
147
			jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null);
148
			stylesTabIndex = jTabbedPane.getTabCount() - 1;
149
			dimensionTabIndex = jTabbedPane.getTabCount() - 1;
150
			jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getJPanelFormatsAndSrs(), null);
151
			jTabbedPane.setEnabledAt(dimensionTabIndex, false);
152
			jTabbedPane.setEnabledAt(stylesTabIndex, false);
146
			jTabbedPane.addTab(Messages.getText("capas"), null, getLayerPanel(), null);
147
			jTabbedPane.addTab(Messages.getText("estilos"), null, getTabStyle(), null);
148
			jTabbedPane.addTab(Messages.getText("dimensions"), null, getJPanelDimension(), null);
149
			jTabbedPane.addTab(Messages.getText("formatos"), null, getJPanelFormatsAndSrs(), null);
150
			
151
			tabsIndexes.put(getLayerPanel(), 0);
152
			tabsIndexes.put(getTabStyle(), 1);
153
			tabsIndexes.put(getJPanelDimension(), 2);
154
			tabsIndexes.put(getJPanelFormatsAndSrs(), 3);
153 155
		}
154 156
		this.add(jTabbedPane, null);
157
		
158
		jTabbedPane.setEnabledAt(1, false);
159
		jTabbedPane.setEnabledAt(2, false);
160
		jTabbedPane.setEnabledAt(3, false);
155 161
	}
156 162

  
157 163
	/**
......
177 183
			InfoPanel ip = getTabInfo();
178 184
			ip.addFocusListener(new FocusListener() {
179 185
				public void focusGained(FocusEvent e) {
180
					refreshInfo();
186
					refreshInfoPanel();
181 187
				}
182 188

  
183 189
				public void focusLost(FocusEvent e) {
184 190
				}
185 191
			});
186 192

  
187
			jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, null);
188
			jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getLayerPanel(), null);
189
			jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, getTabStyle(), null);
190
			stylesTabIndex = jTabbedPane.getTabCount() - 1;
191
			jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getJPanelFormatsAndSrs(), null);
192
			jTabbedPane.setEnabledAt(stylesTabIndex, false);
193
			jTabbedPane.addTab(Messages.getText("info"), null, ip, null);
194
			jTabbedPane.addTab(Messages.getText("capas"), null, getLayerPanel(), null);
195
			jTabbedPane.addTab(Messages.getText("estilos"), null, getTabStyle(), null);
196
			jTabbedPane.addTab(Messages.getText("dimensions"), null, getJPanelDimension(), null);
197
			jTabbedPane.addTab(Messages.getText("formatos"), null, getJPanelFormatsAndSrs(), null);
198
			
199
			tabsIndexes.clear();
200
			tabsIndexes.put(ip, 0);
201
			tabsIndexes.put(getLayerPanel(), 1);
202
			tabsIndexes.put(getTabStyle(), 2);
203
			tabsIndexes.put(getJPanelDimension(), 3);
204
			tabsIndexes.put(getJPanelFormatsAndSrs(), 4);
205
			
206
			jTabbedPane.setEnabledAt(2, false);
207
			jTabbedPane.setEnabledAt(3, false);
208
			jTabbedPane.setEnabledAt(4, false);
193 209
		}
194 210
		return jTabbedPane;
195 211
	}
......
238 254
			tabStyle.setEnabled(false);
239 255
			tabStyle.addListener(new BeanListener() {
240 256
				public void beanValueChanged(Object value) {
241
					fireWizardComplete(isCorrectlyConfigured());
257
					fireWizardComplete();
242 258
				};
243 259
			});
244 260
			tabStyle.addFocusListener(new FocusAdapter() {
......
264 280
		}
265 281
		return formatsPanel;
266 282
	}
283
	
284
	/**
285
	 * This method initializes the panel with the formats and SRSs
286
	 * @return Panel
287
	 */
288
	private DimensionPanel getJPanelDimension() {
289
		if (dimensionPanel == null) {
290
			dimensionPanel = new DimensionPanel();
291
		}
292
		return dimensionPanel;
293
	}
294
	
295
	/**
296
	 * Fires a notification to this wizard listeners telling them if the
297
	 * configuration is fair enough to send a GetMap request.
298
	 *
299
	 * @param b
300
	 */
301
	private void fireWizardComplete() {
302
		listenerSupport.correctlyConfiguredEvent(isCorrectlyConfigured());
303
	}
304
	
305
	public void setListenerSupport(WMTSWizardListener support) {
306
		listenerSupport = support;
307
	}
267 308

  
268 309
	/**
269 310
	 * Returns the index of the CRS within the CRS list.
......
338 379
			getInfoFormats().setSelectedIndex(index);
339 380
		}
340 381

  
341
		refreshInfo();
382
		refreshInfoPanel();
342 383
	}
343 384

  
344 385
	private void setSelectedLayer(String name) {
......
354 395

  
355 396
	/**
356 397
	 * Gets the available layers in WMTS maintaining the tree structure
357
	 *
358 398
	 * @return
359 399
	 */
360 400
	public LayerTree getLayerStructure() {
......
365 405
	 * Gets the list of the styles
366 406
	 * @return
367 407
	 */
408
	@SuppressWarnings("rawtypes")
368 409
	public Vector getStyleTitles() {
369 410
		return getTabStyle().getStyleTree().getStyleSelectionTitles();
370 411
	}
......
373 414
	 * Gets the list of the selected layers
374 415
	 * @return
375 416
	 */
417
	@SuppressWarnings({ "rawtypes", "unchecked" })
376 418
	public Vector getSelectedLayersVector() {
377 419
		JDnDListModel mod = (JDnDListModel) getLayerPanel().getLstSelectedLayers().getModel();
378 420
		Vector lyrs = new Vector();
......
394 436
	 * Gets an array with the list of layers
395 437
	 * @return
396 438
	 */
439
	@SuppressWarnings({ "unchecked", "rawtypes" })
397 440
	public LayerUI[] selectedLayersToArray() {
398 441
		JDnDListModel modelo = ((JDnDListModel) getLayerPanel().getLstSelectedLayers().getModel());
399 442
		ArrayList elements = modelo.getElements();
......
439 482
		getLayerPanel().getBtnDel().setEnabled(values != null && values.length > 0);
440 483
		return (values == null || values.length == 0) ? false : true;
441 484
	}
442

  
485
	
443 486
	/**
444
	 * DOCUMENT ME!
487
	 * Method called when pressing the Add layer button or when double-clicking
488
	 * on a layer from the server's layer tree.
445 489
	 */
446
	private void delLayer() {
447
		int[] indices = getLayerPanel().getLstSelectedLayers().getSelectedIndices();
490
	public void addLayer() {
491
		boolean alguno = false;
448 492

  
493
		TreePath[] selecciones = getLayerPanel().getTreeLayers().getSelectionPaths();
494
		if (selecciones == null) {
495
			return;
496
		}
497

  
498
		//**************
499
		//Limpiar la lista. 
500
		//Quitar este bloque si se quiere a?adir una lista de elementos y no solo uno
449 501
		try {
450
			ArrayList removeList = new ArrayList();
451 502
			LayerUI[] infos = selectedLayersToArray();
452 503
			JDnDListModel modelo = ((JDnDListModel) getLayerPanel().getLstSelectedLayers().getModel());
453
			for (int i = 0; i < indices.length; i++) {
454
				removeList.add(infos[indices[i]]);
455
			}
456
			modelo.delIndices(indices);
504
			modelo.delIndices(new int[infos.length]);
457 505
			layerPanel.getLstSelectedLayers().clearSelection();
458
			fireWizardComplete(isCorrectlyConfigured());
506
			selectedPaths.clear();
507
		} catch (ArrayIndexOutOfBoundsException ex) {
508
			ex.printStackTrace();
509
		}
510
		//**************
459 511

  
460
			// delete from selectedPaths as well
461
			WMTSTheme elemento = null;
462
			WMTSTheme last = null;
463
			TreePath path = null;
464
			for (int i = removeList.size() - 1; i >= 0; i--) {
465
				elemento = ((LayerUI)removeList.get(i)).theme;
466
				for (int j = 0; j < selectedPaths.size(); j++) {
467
					path = (TreePath) selectedPaths.get(j);
468
					last = (WMTSTheme) path.getLastPathComponent();
469
					if (last.getTitle().compareTo(elemento.getTitle()) == 0) {
470
						selectedPaths.remove(path);
471
					}
472
				}
512
		for (int i = 0; i < selecciones.length && i < 1 /*Se a?ade solo uno: quitar para lista*/; i++) {
513
			if(!(selecciones[i].getLastPathComponent() instanceof WMTSTheme))
514
				continue;
515
			selectedPaths.add(selecciones[i]);
516
			WMTSTheme nodo = (WMTSTheme) selecciones[i].getLastPathComponent();
517

  
518
			if (nodo.getTitle() == null || nodo.getTitle().equals("")) {
519
				continue;
473 520
			}
474 521

  
522
			JDnDListModel modelo = (JDnDListModel) getLayerPanel().getLstSelectedLayers().getModel();
523
			if(getLayerPanel().getThemesViewSelection().isSelected() && nodo.getLayerRef().size() == 0) {
524
				JOptionPane.showOptionDialog(this,
525
						Messages.getText("theme_without_reference"),
526
						Messages.getText("confirmacion"),
527
						JOptionPane.OK_OPTION,
528
						JOptionPane.INFORMATION_MESSAGE,
529
						null,
530
						new Object[]{Messages.getText("accept")},
531
						Messages.getText("accept"));
532
				return;
533
			}
534
				
535
			if (modelo.addElement(0, new LayerUI(nodo))) {
536
				alguno = true;
537
			}
538
			getLayerPanel().getLstSelectedLayers().setSelectedIndex(0);
539
		}
540

  
541
		if (alguno) {
475 542
			refreshSelectedLayerData();
476
			refreshInfo();
477
		} catch (ArrayIndexOutOfBoundsException ex) {
478
			// if you reach this, please, tell me how you did it.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff