Revision 4258

View differences:

org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4
	<artifactId>org.gvsig.raster.wms</artifactId>
5
	<packaging>pom</packaging>
6
	<version>2.2.20</version>
7
	<name>${project.artifactId}</name>
8
	<description>wms client</description>
9
	<inceptionYear>2011</inceptionYear>
10
	
11
	<parent>
12
      <groupId>org.gvsig</groupId>
13
      <artifactId>org.gvsig.desktop</artifactId>
14
      <version>2.0.113</version>
15
  </parent>
16

  
17
        <properties>
18
            <!-- El plugin versions:use-latest-versions falla con scope import -->
19
            <!-- asi que toca usar el versions:update-properties que si que funciona -->
20
            <org.gvsig.raster.version>2.2.24</org.gvsig.raster.version>
21
        </properties>
22
    
23
    <repositories>
24
      <repository>
25
        <id>gvsig-public-http-repository</id>
26
        <name>gvSIG maven public HTTP repository</name>
27
        <url>http://devel.gvsig.org/m2repo/j2se</url>
28
        <releases>
29
          <enabled>true</enabled>
30
          <updatePolicy>daily</updatePolicy>
31
          <checksumPolicy>warn</checksumPolicy>
32
        </releases>
33
        <snapshots>
34
          <enabled>true</enabled>
35
          <updatePolicy>daily</updatePolicy>
36
          <checksumPolicy>warn</checksumPolicy>
37
        </snapshots>
38
      </repository>
39
    </repositories>
40
    
41
    <scm>
42
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20</connection>
43
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20</developerConnection>
44
        <url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20</url>
45
    </scm>
46
    
47
    <build>
48
        <plugins>
49
            <plugin>
50
                <groupId>org.apache.maven.plugins</groupId>
51
                <artifactId>maven-release-plugin</artifactId>
52
                <configuration>
53
                    <tagBase>https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wms/tags/</tagBase>
54
                    <goals>deploy</goals>
55
                </configuration>
56
            </plugin>
57
        </plugins>
58
    </build>
59
    
60
    <dependencyManagement>
61
		<dependencies>
62
                        <dependency>
63
                                <groupId>org.gvsig</groupId>
64
                                <artifactId>org.gvsig.raster</artifactId>
65
                                <version>${org.gvsig.raster.version}</version>
66
                                <type>pom</type>
67
                                <scope>import</scope>
68
                        </dependency>
69

  
70
			<dependency>
71
				<groupId>org.gvsig</groupId>
72
				<artifactId>org.gvsig.raster.wms.io</artifactId>
73
				<version>2.2.20</version>
74
			</dependency>
75
			<dependency>
76
				<groupId>org.gvsig</groupId>
77
				<artifactId>org.gvsig.raster.wms.remoteclient</artifactId>
78
				<version>2.2.20</version>
79
			</dependency>
80
			<dependency>
81
				<groupId>org.gvsig</groupId>
82
				<artifactId>org.gvsig.raster.wms.app.wmsclient</artifactId>
83
				<version>2.2.20</version>
84
			</dependency>
85

  
86
		</dependencies>
87
	</dependencyManagement>
88

  
89
	<modules>
90
		<module>org.gvsig.raster.wms.remoteclient</module>
91
		<module>org.gvsig.raster.wms.io</module>
92
		<module>org.gvsig.raster.wms.app.wmsclient</module>
93
	</modules>
94
</project>
95

  
0 96

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20/org.gvsig.raster.wms.app.wmsclient/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
    <modelVersion>4.0.0</modelVersion>
5
    <artifactId>org.gvsig.raster.wms.app.wmsclient</artifactId>
6
    <packaging>jar</packaging>
7
    <name>${project.artifactId}</name>
8
    <description>Web Map Service support</description>
9
	
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>org.gvsig.raster.wms</artifactId>
13
        <version>2.2.20</version>
14
    </parent>
15
	
16
    <dependencies>
17
        <dependency>
18
            <groupId>org.gvsig</groupId>
19
            <artifactId>org.gvsig.raster.swing.api</artifactId>
20
            <scope>compile</scope>
21
        </dependency>
22
        <dependency>
23
            <groupId>org.gvsig</groupId>
24
            <artifactId>org.gvsig.raster.swing.impl</artifactId>
25
            <scope>runtime</scope>
26
        </dependency>
27
        <dependency>
28
            <groupId>org.gvsig</groupId>
29
            <artifactId>org.gvsig.raster.wms.io</artifactId>
30
            <scope>compile</scope>
31
        </dependency>
32
        <dependency>
33
            <groupId>org.gvsig</groupId>
34
            <artifactId>org.gvsig.raster.wms.remoteclient</artifactId>
35
            <scope>compile</scope>
36
        </dependency>
37
        <dependency>
38
            <groupId>org.gvsig</groupId>
39
            <artifactId>org.gvsig.remoteclient</artifactId>
40
            <scope>compile</scope>
41
        </dependency>
42
        <dependency>
43
            <groupId>org.gvsig</groupId>
44
            <artifactId>org.gvsig.app.mainplugin</artifactId>
45
            <scope>compile</scope>
46
        </dependency>
47
        <dependency>
48
            <groupId>org.gvsig</groupId>
49
            <artifactId>org.gvsig.raster.lib.api</artifactId>
50
            <scope>compile</scope>
51
        </dependency>
52
        <dependency>
53
            <groupId>org.gvsig</groupId>
54
            <artifactId>org.gvsig.raster.fmap</artifactId>
55
            <scope>compile</scope>
56
        </dependency>
57
        <dependency>
58
            <groupId>org.gvsig</groupId>
59
            <artifactId>org.gvsig.fmap.control</artifactId>
60
            <scope>compile</scope>
61
        </dependency>
62
        <dependency>
63
            <groupId>org.gvsig</groupId>
64
            <artifactId>org.gvsig.utils</artifactId>
65
            <scope>compile</scope>
66
        </dependency>
67
        <dependency>
68
            <groupId>org.gvsig</groupId>
69
            <artifactId>org.gvsig.ui</artifactId>
70
            <scope>compile</scope>
71
        </dependency>
72
        <dependency>
73
            <groupId>org.gvsig</groupId>
74
            <artifactId>org.gvsig.symbology.lib.api</artifactId>
75
            <scope>compile</scope>
76
        </dependency>
77
        <dependency>
78
            <groupId>org.gvsig</groupId>
79
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
80
            <scope>compile</scope>
81
        </dependency>
82
        <dependency>
83
            <groupId>org.gvsig</groupId>
84
            <artifactId>org.gvsig.raster.cache.lib.api</artifactId>
85
            <scope>compile</scope>
86
        </dependency>
87
		
88
        <dependency>
89
            <groupId>org.gvsig</groupId>
90
            <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
91
            <scope>compile</scope>
92
        </dependency>
93
        <dependency>
94
            <groupId>org.gvsig</groupId>
95
            <artifactId>org.gvsig.fmap.mapcontext.impl</artifactId>
96
            <scope>runtime</scope>
97
        </dependency>
98
        <dependency>
99
            <groupId>org.gvsig</groupId>
100
            <artifactId>org.gvsig.fmap.mapcontext.operation</artifactId>
101
            <scope>runtime</scope>
102
        </dependency>
103
        <dependency>
104
            <groupId>org.gvsig</groupId>
105
            <artifactId>org.gvsig.projection.api</artifactId>
106
            <scope>compile</scope>
107
        </dependency>
108
        <dependency>
109
            <groupId>org.gvsig</groupId>
110
            <artifactId>org.gvsig.projection.cresques.impl</artifactId>
111
            <scope>runtime</scope>
112
        </dependency>
113
        <dependency>
114
            <groupId>org.gvsig</groupId>
115
            <artifactId>org.gvsig.compat.api</artifactId>
116
            <scope>compile</scope>
117
        </dependency>
118
        <dependency>
119
            <groupId>org.gvsig</groupId>
120
            <artifactId>org.gvsig.compat.se</artifactId>
121
            <scope>compile</scope>
122
        </dependency>
123
        <dependency>
124
            <groupId>org.gvsig</groupId>
125
            <artifactId>org.gvsig.fmap.dal.api</artifactId>
126
            <scope>compile</scope>
127
        </dependency>
128
        <dependency>
129
            <groupId>org.gvsig</groupId>
130
            <artifactId>org.gvsig.fmap.dal.impl</artifactId>
131
            <scope>compile</scope>
132
        </dependency>
133
        <dependency>
134
            <groupId>org.gvsig</groupId>
135
            <artifactId>org.gvsig.fmap.dal.spi</artifactId>
136
            <scope>compile</scope>
137
        </dependency>
138
        <dependency>
139
            <groupId>org.gvsig</groupId>
140
            <artifactId>org.gvsig.fmap.geometry.api</artifactId>
141
            <scope>compile</scope>
142
        </dependency>
143
    <!--
144
        <dependency>
145
            <groupId>org.gvsig</groupId>
146
            <artifactId>org.gvsig.fmap.geometry.generalpath</artifactId>
147
            <scope>runtime</scope>
148
        </dependency>
149
        <dependency>
150
            <groupId>org.gvsig</groupId>
151
            <artifactId>org.gvsig.fmap.geometry.operation</artifactId>
152
            <scope>runtime</scope>
153
        </dependency>
154
    -->
155
    </dependencies>
156
	
157
    <properties>
158
        <gvsig.package.info.name>Formats: WMS support</gvsig.package.info.name>
159
        <gvsig.package.info.state>final</gvsig.package.info.state>
160
        <gvsig.package.info.dependencies>required: org.gvsig.raster.tilecache.app -ge 2, required: org.gvsig.raster.mainplugin -ge 2</gvsig.package.info.dependencies>
161
        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/Raster/pool</gvsig.package.info.poolURL>
162
        <gvsig.package.info.categories>OGC,Remote Services,Raster</gvsig.package.info.categories>
163
        <gvsig.package.info.official>true</gvsig.package.info.official>
164
    </properties>
165
</project>
0 166

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20/org.gvsig.raster.wms.app.wmsclient/buildNumber.properties
1
#Mon Nov 30 21:49:41 CET 2015
2
buildNumber=75
0 3

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/WMSClientExtension.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
 
23
package org.gvsig.raster.wms.app.wmsclient;
24

  
25
import org.gvsig.andami.IconThemeHelper;
26
import org.gvsig.andami.plugins.Extension;
27
import org.gvsig.app.extension.AddLayer;
28
import org.gvsig.raster.wms.app.wmsclient.gui.toc.WMSPropsTocMenuEntry;
29
import org.gvsig.raster.wms.app.wmsclient.gui.wizard.WMSWizard;
30
import org.gvsig.raster.wms.app.wmsclient.layer.DynObjectSetWMSInfo;
31
import org.gvsig.raster.wms.app.wmsclient.layer.FLyrWMS;
32
import org.gvsig.tools.ToolsLocator;
33
import org.gvsig.tools.extensionpoint.ExtensionPoint;
34

  
35

  
36
/**
37
 * Extension for adding WMS support to gvSIG.
38
 *
39
 * @author jaume dominguez faus - jaume.dominguez@iver.es
40
 */
41
public class WMSClientExtension extends Extension {
42

  
43
    public void initialize() {
44
    	
45
    	// Adds an entry to the TOC's floating menu to those layers defined in this extension
46
		ExtensionPoint exPoint = ToolsLocator.getExtensionPointManager().add(
47
				"View_TocActions");
48

  
49
		exPoint.append("WMSProperties", "", new WMSPropsTocMenuEntry());
50

  
51
        // Adds a new tab to the "add layer" wizard for WMS layer creation
52
    	AddLayer.addWizard(WMSWizard.class);
53

  
54
    	ToolsLocator.getExtensionPointManager().add("CatalogLayers").append(
55
				"OGC:WMS", "", FLyrWMS.class);
56
    	initilizeIcons();
57
    	DynObjectSetWMSInfo.registerDynClass();
58
    }
59
    
60
	public void postInitialize() {
61
		FLyrWMS.registerPersistent();
62
	}
63

  
64
    public void execute(String actionCommand) {
65
    	// no commands, no code.
66
    }
67

  
68
    public boolean isEnabled() {
69
    	// may return whatever
70
        return false;
71
    }
72

  
73
    public boolean isVisible() {
74
    	// may return whatever
75
        return false;
76
    }
77

  
78
    void initilizeIcons(){
79
		IconThemeHelper.registerIcon(null, "aplication-preferences-uparrow", this);
80
		IconThemeHelper.registerIcon(null, "aplication-preferences-downarrow", this);
81
		IconThemeHelper.registerIcon(null, "icon-layer-wms", this);
82
    }
83
}
0 84

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/gui/dialog/WMSPropsDialog.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
 
23
package org.gvsig.raster.wms.app.wmsclient.gui.dialog;
24

  
25
import java.awt.Dimension;
26
import java.awt.event.ActionEvent;
27
import java.awt.event.ActionListener;
28
import java.util.HashMap;
29
import java.util.List;
30
import java.util.Vector;
31

  
32
import javax.swing.JButton;
33
import javax.swing.JDialog;
34
import javax.swing.JOptionPane;
35
import javax.swing.JPanel;
36
import javax.swing.tree.TreePath;
37

  
38
import org.gvsig.andami.PluginServices;
39
import org.gvsig.andami.ui.mdiManager.IWindow;
40
import org.gvsig.andami.ui.mdiManager.WindowInfo;
41
import org.gvsig.app.gui.wizards.WizardListener;
42
import org.gvsig.app.gui.wizards.WizardListenerSupport;
43
import org.gvsig.fmap.dal.coverage.exception.ConnectException;
44
import org.gvsig.fmap.dal.exception.InitializeException;
45
import org.gvsig.fmap.mapcontext.MapContext;
46
import org.gvsig.fmap.mapcontext.exceptions.ConnectionErrorLayerException;
47
import org.gvsig.fmap.mapcontext.exceptions.DriverLayerException;
48
import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
49
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
50
import org.gvsig.fmap.mapcontext.exceptions.NameLayerException;
51
import org.gvsig.fmap.mapcontext.exceptions.ProjectionLayerException;
52
import org.gvsig.fmap.mapcontext.exceptions.TypeLayerException;
53
import org.gvsig.fmap.mapcontext.exceptions.URLLayerException;
54
import org.gvsig.fmap.mapcontext.exceptions.UnsupportedVersionLayerException;
55
import org.gvsig.fmap.mapcontext.layers.FLayer;
56
import org.gvsig.fmap.mapcontext.layers.FLayers;
57
import org.gvsig.fmap.mapcontrol.MapControl;
58
import org.gvsig.raster.fmap.layers.FLyrRaster;
59
import org.gvsig.raster.swing.RasterSwingLibrary;
60
import org.gvsig.raster.util.CancelTaskImpl;
61
import org.gvsig.raster.wms.app.wmsclient.gui.panel.WMSParamsPanel;
62
import org.gvsig.raster.wms.app.wmsclient.gui.wizard.LayerTreeModel;
63
import org.gvsig.raster.wms.app.wmsclient.layer.FLyrWMS;
64
import org.gvsig.raster.wms.io.RemoteWMSStyle;
65
import org.gvsig.raster.wms.io.WMSLayerNode;
66
import org.gvsig.raster.wms.io.WMSServerExplorer;
67
import org.slf4j.Logger;
68
import org.slf4j.LoggerFactory;
69

  
70

  
71
/**
72
 * The TOC WMS properties panel container.
73
 *
74
 * @author jaume - 
75
 *
76
 */
77
public class WMSPropsDialog extends JPanel implements IWindow {
78

  
79
	private static final long         serialVersionUID    = 1L;
80
	private Logger                   logger              = LoggerFactory.getLogger(WMSPropsDialog.class);
81
	JDialog                           dlg                 = null;  
82
	private JPanel                    buttonsPanel        = null;
83
	private FLyrRaster                fLayer              = null;
84
	boolean                           applied             = false;;
85
	private WindowInfo                m_ViewInfo          = null;
86

  
87
	private JButton                   btnApply            = null;
88
	private JButton                   btnOk               = null;
89
	private JButton                   btnCancel           = null;
90
	private WMSParamsPanel            wmsParamsTabbedPane;
91
    private CommandListener           m_actionListener;
92
    private WMSServerExplorer         explorer            = null;
93

  
94
    public WMSPropsDialog(FLayer layer) {
95
		super();
96
		if(layer instanceof FLyrRaster)
97
			initialize((FLyrRaster)layer);
98
	}
99

  
100

  
101
	private void initialize(FLyrRaster layer) {
102
		setLayout(null);
103

  
104
        setFLayer(layer);
105
        wmsParamsTabbedPane = getParamsPanel(((FLyrWMS) layer).getProperties());
106
        wmsParamsTabbedPane.addWizardListener(new WizardListener(){
107
			public void wizardStateChanged(boolean finishable) {
108
				getBtnOk().setEnabled(finishable);
109
				getBtnApply().setEnabled(finishable);
110
			}
111

  
112
			public void error(Exception e) {
113
			}
114

  
115
        })  ;
116
        wmsParamsTabbedPane.disableDisagregatedLayers();
117
        this.add(wmsParamsTabbedPane);
118
        this.add(getButtonsPanel(), null);
119

  
120
	}
121

  
122

  
123
	public void setFLayer(FLyrRaster f) {
124
		fLayer = f;
125
	}
126

  
127
	/**
128
	 * With getParamsPanel we have access to the map config TabbedPane.
129
	 * If this panel doesn't exist yet (which can occur when an existing project is
130
	 * recovered) it is been automatically constructed by connecting to the server,
131
	 * reloading the necessary data, filling up the content and setting the selected
132
	 * values that were selected when the projet was saved.
133
	 *
134
	 *
135
	 * Since a connection to the server is needed when rebuiliding the panel, this
136
	 * causes a delay for the panel's showing up or a nullPointer error if there is
137
	 * no path to the server.
138
	 *
139
	 *
140
	 * Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n
141
	 * del mapa. Si este panel todav?a no existe (como puede ser cuando
142
	 * recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando
143
	 * al servidor, recuperando los datos necesarios, rellenando el contenido y
144
	 * dejando seleccionados los valores que estaban seleccionados cuando se
145
	 * guarda el proyecto.
146
	 *
147
	 *
148
	 * Como para reconstruirse requiere una conexi?n con el servidor esto causa
149
	 * un retardo en la aparici?n en el toc o un error de nullPointer si no
150
	 * hay conexi?n hasta el servidor.
151
	 *
152
	 *
153
	 * @return WMSParamsPanel
154
	 */
155
	@SuppressWarnings({ "unchecked" })
156
	public WMSParamsPanel getParamsPanel(HashMap info) {
157
	    if (info != null) {
158
	    	try {
159
	    		if(explorer == null) {
160
					explorer = ((FLyrWMS)fLayer).getExplorer();
161
					
162
					try {
163
			    		explorer.connect(new CancelTaskImpl(), true);
164
					} catch (ConnectException e) {
165
						RasterSwingLibrary.messageBoxError("The connection cannot be established", this, e);
166
						return null;
167
					} 
168
	    		}
169
	    	} catch (Exception e) {
170
	    		explorer = null;
171
	    		JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE);
172
	    	}
173
	    	try {
174
	        	
175
                // name
176
	            WMSParamsPanel toc = new WMSParamsPanel();
177
	            toc.setLayerName((String)info.get("name"));
178
	            toc.setWizardData(explorer);
179

  
180
	            toc.setVisible(true);
181
	            toc.setListenerSupport(new WizardListenerSupport());
182

  
183
	            WMSLayerNode[] selectedLayers = (WMSLayerNode[]) ((Vector) info.get("selectedLayers")).toArray(new WMSLayerNode[0]);
184
	            for (int i = 0; i < selectedLayers.length; i++) {
185
	            	toc.getJustTreeLayer().clearSelection();
186
	            	//  Se a?ade a la lista de layers seleccionados
187
	            	TreePath path = new TreePath(((LayerTreeModel)toc.getJustTreeLayer()
188
	            						.getModel()).getNodeByName(selectedLayers[i].getName()));
189
	            	toc.getJustTreeLayer().addSelectionPath(path);
190
	            	toc.addLayer();
191
                }
192

  
193
                // srs
194
                String srs = (String) info.get("srs");
195
                int index = toc.getSRSIndex( srs );
196
	            if (index != -1) {
197
					toc.getLstSRSs().setSelectedIndex(index);
198
				}
199

  
200
                // format
201
	            String format = (String) info.get("format");
202
	            index = toc.getFormatIndex(format);
203
	            if (index != -1) {
204
					toc.getLstFormats().setSelectedIndex(index);
205
				}
206
	            
207
	            //info format
208
	            String infoFormat = (String) info.get("infoformat");
209
	            index = toc.getInfoFormatIndex(infoFormat);
210
	            if (index != -1) {
211
					toc.getLstInfoFormats().setSelectedIndex(index);
212
				}
213

  
214
	            // transparency
215
                toc.setTransparent(((Boolean) info.get("wmsTransparency")).booleanValue());
216

  
217
                // styles
218
                List<RemoteWMSStyle> l = (List<RemoteWMSStyle>) info.get("styles");
219
                if (l != null && l.size() > 0) {
220
					toc.setStyleSelections(l);
221
				}
222

  
223
                // dimensions
224
                Vector v = (Vector) info.get("dimensions");
225
                if (v != null) {
226
					toc.setDimensions(v);
227
				}
228

  
229
                // fixed sizes
230
                Dimension sz = (Dimension) info.get("fixedSize");
231
                if (sz != null) {
232
					toc.setFixedSize(sz);
233
				}
234
                toc.refreshInfo();
235
                applied = false;
236
	            return toc;
237
	        } catch (Exception e) {
238
	        	JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE);
239
	        }
240
	    }
241
	    return null;
242
	}
243

  
244

  
245
	public JPanel getButtonsPanel() {
246
		if (buttonsPanel == null) {
247
			m_actionListener = new CommandListener(this);
248
			buttonsPanel = new JPanel();
249
	        buttonsPanel.setBounds(5, wmsParamsTabbedPane.getHeight(), 471, 40);
250
			buttonsPanel.setLayout(null);
251
			buttonsPanel.setName("buttonPanel");
252

  
253
	        buttonsPanel.add(getBtnOk(), null);
254
	        buttonsPanel.add(getBtnApply(), null);
255
	        buttonsPanel.add(getBtnCancel(), null);
256
		}
257
		return buttonsPanel;
258
	}
259

  
260
	public JButton getBtnOk() {
261
		if (btnOk == null) {
262
	        btnOk = new JButton("ok");
263
	        btnOk.setText(PluginServices.getText(this,"ok"));
264
	        btnOk.setActionCommand("OK");
265
	        btnOk.addActionListener(m_actionListener);
266
	        btnOk.setBounds(367, 9, 90, 25);
267
		}
268
		return btnOk;
269
	}
270

  
271
	public JButton getBtnApply() {
272
		if (btnApply == null) {
273
	        btnApply = new JButton("apply");
274
	        btnApply.setText(PluginServices.getText(this,"apply"));
275
	        btnApply.setEnabled(false);
276
	        btnApply.setActionCommand("APPLY");
277
	        btnApply.addActionListener(m_actionListener);
278
	        btnApply.setBounds(267, 9, 90, 25);
279
		}
280
		return btnApply;
281
	}
282

  
283
	public JButton getBtnCancel() {
284
		if (btnCancel == null) {
285
	        btnCancel = new JButton("cancel");
286
	        btnCancel.setText(PluginServices.getText(this,"cancel"));
287
	        btnCancel.setActionCommand("CANCEL");
288
	        btnCancel.addActionListener(m_actionListener);
289
	        btnCancel.setBounds(137, 9, 90, 25);
290
		}
291
		return btnCancel;
292
	}
293

  
294
    private class CommandListener implements ActionListener {
295

  
296
        /**
297
         * Creates a new ComandosListener object.
298
         *
299
         * @param lg DOCUMENT ME!
300
         */
301
        public CommandListener(WMSPropsDialog tp) {
302
            //m_tp = tp;
303
        }
304

  
305
		@SuppressWarnings({ "unchecked" })
306
		public void actionPerformed(ActionEvent e) {
307
            if (e.getActionCommand() == "CANCEL") {
308
				close();
309
			} else {
310
            	/*try {
311
					((FLyrWMS) fLayer).setFullExtent(wmsParamsTabbedPane.getLayersRectangle());
312
				} catch (ProjectionLayerException ex) {
313
					ex.printStackTrace();
314
			        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), ex.getMessage());
315
			        return;
316
				}*/
317
				((FLyrWMS) fLayer).getParameters().setFormat(wmsParamsTabbedPane.getFormat());
318
				((FLyrWMS) fLayer).getParameters().setInfoFormat(wmsParamsTabbedPane.getInfoFormat());
319
                try {
320
                if (!wmsParamsTabbedPane.getDisagregatedLayers()) {
321
					((FLyrWMS) fLayer).getParameters().setLayerQuery(wmsParamsTabbedPane.getLayersQuery());
322
				}
323
                ((FLyrWMS) fLayer).getParameters().setInfoLayerQuery(wmsParamsTabbedPane.getQueryableLayerQuery());
324
                ((FLyrWMS) fLayer).getParameters().setSRS(wmsParamsTabbedPane.getSRS());
325
                ((FLyrWMS) fLayer).getParameters().setName(wmsParamsTabbedPane.getLayerName());
326
                ((FLyrWMS) fLayer).getParameters().setWmsTransparency(wmsParamsTabbedPane.getTransparency());
327
                ((FLyrWMS) fLayer).getParameters().setStyles(wmsParamsTabbedPane.getStyles());
328
                ((FLyrWMS) fLayer).getParameters().setDimensions(wmsParamsTabbedPane.getDimensions());
329
                ((FLyrWMS) fLayer).getParameters().setFixedSize(wmsParamsTabbedPane.getFixedSize());
330

  
331
            	//fLayer = wmsParamsTabbedPane.getLayer();
332
            	FLayers parent = ((FLayer)fLayer).getParentLayer();
333

  
334
                if (e.getActionCommand() == "APPLY"){
335
                	MapControl mapCtrl = null;
336
                	
337
                	IWindow[] w = PluginServices.getMDIManager().getAllWindows();
338
                	for (int i = 0; i < w.length; i++) {
339
						if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) {
340
							MapContext mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext();
341
							if(mapContext == fLayer.getMapContext())
342
								mapCtrl = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl();
343
						}
344
					} 
345

  
346
                    if (parent != null) {
347
                    	if ( wmsParamsTabbedPane.getLayer() instanceof FLayers){
348
							mapCtrl.getMapContext().getLayers().
349
							replaceLayer(parent.getName(),mergeFLayers(parent,(FLayers)wmsParamsTabbedPane.getLayer()));
350
                    	}
351
                    }
352
                    else {
353
                    	mapCtrl.getMapContext().getLayers().replaceLayer(fLayer.getName(), wmsParamsTabbedPane.getLayer());
354
                    }
355
                    //mapCtrl.getMapContext().getLayers().addLayer( fLayer );
356
                    mapCtrl.getMapContext().invalidate();
357
                    applied = true;
358
                    getBtnApply().setEnabled(!applied);
359
                }
360
                if (e.getActionCommand() == "OK") {
361
                    if (!applied) {
362

  
363
                        org.gvsig.app.project.documents.view.gui.AbstractViewPanel vista = (org.gvsig.app.project.documents.view.gui.AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
364
                        MapControl mapCtrl = vista.getMapControl();
365

  
366
                        if (parent != null){
367
                        	if ( wmsParamsTabbedPane.getLayer() instanceof FLayers){
368
                        		mapCtrl.getMapContext().getLayers().
369
                        		replaceLayer(parent.getName(),mergeFLayers(parent,(FLayers)wmsParamsTabbedPane.getLayer()));
370
                        	}
371
                        }
372
                        else {
373
                        	mapCtrl.getMapContext().getLayers().replaceLayer(fLayer.getName(), wmsParamsTabbedPane.getLayer());
374
                        }                        mapCtrl.getMapContext().invalidate();
375
                    }
376
                    close();
377
                }
378
                } catch (ConnectionErrorLayerException e1) {
379
                	logger.info("", e1);
380
    			} catch (DriverLayerException e1) {
381
    				logger.info("", e1);
382
    			} catch (LegendLayerException e1) {
383
    				logger.info("", e1);
384
    			} catch (NameLayerException e1) {
385
    				logger.info("", e1);
386
    			} catch (ProjectionLayerException e1) {
387
    				logger.info("", e1);
388
    			} catch (TypeLayerException e1) {
389
    				logger.info("", e1);
390
    			} catch (UnsupportedVersionLayerException e1) {
391
    				logger.info("", e1);
392
    			} catch (URLLayerException e1) {
393
    				logger.info("", e1);
394
    			} catch (LoadLayerException e1) {
395
    				logger.info("", e1);
396
    			} catch (InitializeException e1) {
397
					logger.info("", e1);
398
				}
399
            }
400
		}
401
    }
402
    /**
403
     * Merge two FLayers in one
404
     * @param group1
405
     * @param group2
406
     * @return
407
     */
408
    private FLayers mergeFLayers(FLayers group1, FLayers group2)
409
    {
410
    	//FLayers agrupation = new FLayers(group1.getFMap(), group1.getParentLayer());
411
    	FLayer layer;
412
    	for(int i = 0; i < group2.getLayersCount(); i++)
413
    	{
414
    		layer = group2.getLayer( i );
415
    		if(group1.getLayer( layer.getName()) == null ){
416
    			group1.addLayer( layer );
417
    		}
418
    	}
419

  
420
    	return group1;
421
    }
422

  
423

  
424

  
425
	public WindowInfo getWindowInfo() {
426
		if (m_ViewInfo==null){
427
			m_ViewInfo=new WindowInfo(WindowInfo.MODALDIALOG);
428
			m_ViewInfo.setTitle(PluginServices.getText(this,"fit_WMS_layer"));
429
	        m_ViewInfo.setWidth(wmsParamsTabbedPane.getWidth()+10);
430
	        m_ViewInfo.setHeight(wmsParamsTabbedPane.getHeight()+40);
431

  
432
		}
433
		return m_ViewInfo;
434
	}
435

  
436
	public void close() {
437
		PluginServices.getMDIManager().closeWindow(this);
438
	}
439

  
440

  
441
	public Object getWindowProfile() {
442
		return WindowInfo.DIALOG_PROFILE;
443
	}
444

  
445
}  //  @jve:decl-index=0:visual-constraint="10,10"
0 446

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/gui/panel/LayerList.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
 
23
package org.gvsig.raster.wms.app.wmsclient.gui.panel;
24

  
25
import java.awt.Component;
26
import java.awt.Dimension;
27

  
28
import javax.swing.DefaultListCellRenderer;
29
import javax.swing.JList;
30

  
31
import org.gvsig.gui.beans.controls.dnd.JDnDList;
32
import org.gvsig.raster.wms.io.WMSLayerNode;
33

  
34

  
35
/**
36
 * Class implementing a JList component adapted to the WMSLayerNode
37
 * needs (use it as a JList with drag'n'drop capabilities).
38
 * 
39
 * @author jaume dominguez faus - jaume.dominguez@iver.es
40
 *
41
 */
42
public class LayerList extends JDnDList {
43
	public boolean showLayerNames = false;
44
	private int count = 0; 
45
	public LayerList() {
46
		super();
47
		setCellRenderer(new MyRenderer());
48
	}
49
	
50
	private class MyRenderer extends DefaultListCellRenderer {
51
		public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
52
			super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
53
			if (value instanceof WMSLayerNode){
54
				WMSLayerNode layer = (WMSLayerNode) value;
55
                
56
                if (!showLayerNames) {
57
                	if (layer.getName() != null || layer.getName() == "") {
58
                		String text = layer.toString();
59
                		text = text.substring(text.indexOf(']')+2, text.length());
60
                		setText(text);
61
                	}
62
                }
63
                
64
                Dimension sz  = getPreferredSize();
65
                sz.setSize((sz.getWidth()+50) - (50*count), sz.getHeight());
66
                setPreferredSize(sz);
67
                count++;
68
            }  
69
			return this;
70
		}
71
	}
72
}
0 73

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.20/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/gui/panel/WMSParamsPanel.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

  
23
package org.gvsig.raster.wms.app.wmsclient.gui.panel;
24

  
25
import java.awt.Component;
26
import java.awt.Dimension;
27
import java.awt.event.FocusAdapter;
28
import java.awt.event.FocusEvent;
29
import java.awt.event.FocusListener;
30
import java.awt.event.MouseAdapter;
31
import java.awt.event.MouseEvent;
32
import java.lang.reflect.InvocationTargetException;
33
import java.net.URI;
34
import java.net.URISyntaxException;
35
import java.util.AbstractCollection;
36
import java.util.ArrayList;
37
import java.util.Hashtable;
38
import java.util.List;
39
import java.util.TreeSet;
40
import java.util.Vector;
41
import java.util.prefs.Preferences;
42

  
43
import javax.swing.JButton;
44
import javax.swing.JCheckBox;
45
import javax.swing.JList;
46
import javax.swing.JOptionPane;
47
import javax.swing.JPanel;
48
import javax.swing.JScrollPane;
49
import javax.swing.JTabbedPane;
50
import javax.swing.JTextField;
51
import javax.swing.tree.TreePath;
52

  
53
import org.gvsig.andami.IconThemeHelper;
54
import org.gvsig.andami.PluginServices;
55
import org.gvsig.andami.messages.NotificationManager;
56
import org.gvsig.app.gui.WizardPanel;
57
import org.gvsig.app.gui.wizards.FormatListModel;
58
import org.gvsig.app.gui.wizards.WizardListenerSupport;
59
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
60
import org.gvsig.fmap.dal.DALLocator;
61
import org.gvsig.fmap.dal.DataManager;
62
import org.gvsig.fmap.dal.DataParameters;
63
import org.gvsig.fmap.dal.DataServerExplorerParameters;
64
import org.gvsig.fmap.dal.DataStoreParameters;
65
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
66
import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters;
67
import org.gvsig.fmap.dal.exception.InitializeException;
68
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
69
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
70
import org.gvsig.fmap.mapcontext.layers.FLayer;
71
import org.gvsig.fmap.mapcontext.layers.FLayers;
72
import org.gvsig.gui.beans.controls.dnd.JDnDListModel;
73
import org.gvsig.gui.beans.listeners.BeanListener;
74
import org.gvsig.raster.wms.app.wmsclient.gui.wizard.LayerTreeModel;
75
import org.gvsig.raster.wms.app.wmsclient.gui.wizard.SRSListModel;
76
import org.gvsig.raster.wms.app.wmsclient.layer.FLyrWMS;
77
import org.gvsig.raster.wms.io.RemoteWMSStyle;
78
import org.gvsig.raster.wms.io.WMSDataParameters;
79
import org.gvsig.raster.wms.io.WMSLayerNode;
80
import org.gvsig.raster.wms.io.WMSServerExplorer;
81
import org.gvsig.raster.wms.io.WMSServerExplorerParameters;
82
import org.gvsig.raster.wms.io.time.RemoteTimeDimension;
83

  
84

  
85
/**
86
 * This class implements the map option panel.
87
 *
88
 * It includes a set of Listeners that implement some control rules which
89
 * refresh the component values that depends on those selected in the other
90
 * components to avoid to choose an invalid set of options. It also includes a
91
 * method (isCorrectlyConfigured()) that checks if the current set of values is
92
 * enough to correctly launch a GetMap request.
93
 *
94
 * The information is obtained from a WMSWizardDataSource object.
95
 *
96
 *
97
 * Esta clase implementa el panel de opciones disponibles sobre el mapa
98
 *
99
 * Incluye una serie de Listeners que implementan unas reglas de control que
100
 * refrescan los valores de componentes cuyos valores dependen de aqu๏ฟฝllos
101
 * seleccionados en otros componentes para evitar que se escoja una combinaci๏ฟฝn
102
 * de opciones err๏ฟฝnea as๏ฟฝ como una funci๏ฟฝn (isCorrectlyConfigured()) que
103
 * comprueba si la combinaci๏ฟฝn escogida actualmente es suficiente para lanzar
104
 * una operaci๏ฟฝn GetMap correctamente.
105
 *
106
 * La informaci๏ฟฝn obtiene a partir de un objeto WMSWizardDataSource.
107
 *
108
 * @author jaume - jaume dominguez faus
109
 *
110
 */
111
@SuppressWarnings("unchecked")
112
public class WMSParamsPanel extends WizardPanel {
113
	private static final long       serialVersionUID       = 1L;
114
	private JScrollPane             jScrollPane1           = null;
115
	private JScrollPane             jScrollPane2           = null;
116
	private JScrollPane             jScrollPane3           = null;
117
	private JScrollPane             jScrollPane5           = null;
118
	private JButton                 btnAdd                 = null;
119
	private JButton                 btnDel                 = null;
120
	private JScrollPane             jScrollPane6           = null;
121
	private JPanel                  jPanel2                = null;
122
	private JPanel                  tabFormats             = null;
123
	private JPanel                  jPanel4                = null;
124
	private JTextField              jTxtNomCapa            = null;
125
	private LayerList               lstSelectedLayers      = null;
126
	private ArrayList<TreePath>     selectedPaths          = new ArrayList<TreePath>();
127
	private JList                   lstSRSs                = null;
128
	private JList                   lstInfoFormats         = null;
129
	private LayerTree               treeLayers             = null;
130
	private JList                   lstFormats             = null;
131
	private WizardListenerSupport   listenerSupport;
132
	private JTabbedPane             jTabbedPane            = null;
133
	private JPanel                  tabLayers              = null;
134
	private JPanel                  jPanelFormats          = null;
135
	private JPanel                  jPanelAxisOrder        = null;
136
	private JPanel                  jPanelSrsSelection     = null;
137
	private JPanel                  jPanelInfoByPointFormat = null;
138
	private StylesPanel             tabStyle               = null;
139
	private JCheckBox               chkTransparency        = null;
140
	private JCheckBox               chkAxisOrder           = null;
141
	private InfoPanel               tabInfo                = null;
142
	private DimensionPanel          tabDimensions          = null;
143
	private int                     dimensionTabIndex;
144
	private int                     stylesTabIndex;
145
	private String                  oldSRS                 = null;
146
	private AbstractCollection      oldDimensions          = null;
147
	private Dimension               sizeFixed;
148
	private JCheckBox               chkExtendedNames       = null;
149
	private JButton                 btnUp                  = null;
150
	private JButton                 btnDown                = null;
151
	protected WMSServerExplorer     explorer               = null;
152
	private boolean                 updating               = fPrefs.getBoolean("refresh_capabilities", false);
153
	public static Preferences       fPrefs                 = Preferences.userRoot().node("gvsig.wms-wizard");
154
	//private Logger                  log                    = LoggerFactory.getLogger(WMSParamsPanel.class);
155
	private JCheckBox               chkDisagregate         = null;
156
	private boolean                 lastCached;
157
	private String                  groupName              = "WMS Group";
158

  
159
	public WMSParamsPanel() {
160
		super();
161
		initialize();
162
	}
163

  
164
	// TODO: crear nuevo constructor para a?adir los panels que quieras...
165
	public WMSParamsPanel(WMSServerExplorer data) {
166
		super();
167
		setWizardData(data);
168
		this.setLayout(null);
169
		this.setVisible(false);
170
		this.setBounds(0, 0, 510, 427);
171
		if (jTabbedPane == null) {
172
			jTabbedPane = new JTabbedPane();
173
			jTabbedPane.setBounds(4, 4, 502, 415);
174
			StylesPanel sp = getTabStyle();
175
			DimensionPanel dp = getTabDimensions();
176

  
177
			jTabbedPane.addTab(PluginServices.getText(this, "capas"), null,
178
					getTabLayers(), null);
179
			jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null,
180
					sp, null);
181
			stylesTabIndex = jTabbedPane.getTabCount() - 1;
182
			jTabbedPane.addTab(PluginServices.getText(this, "dimensiones"),
183
					null, dp, null);
184
			dimensionTabIndex = jTabbedPane.getTabCount() - 1;
185
			jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null,
186
					getTabFormats(), null);
187
			jTabbedPane.setEnabledAt(dimensionTabIndex, false);
188
			jTabbedPane.setEnabledAt(stylesTabIndex, false);
189
		}
190
		this.add(jTabbedPane, null);
191

  
192
		setListenerSupport(new WizardListenerSupport());
193
	}
194

  
195
	/**
196
	 * This method initializes panelPage2
197
	 *
198
	 * @return Panel
199
	 */
200
	private void initialize() {
201
		this.setLayout(null);
202
		this.setVisible(false);
203
		this.setBounds(0, 0, 510, 427);
204
		this.add(getJTabbedPane(), null);
205
	}
206

  
207
	public boolean isUpdatingCache() {
208
		return updating;
209
	}
210

  
211
	public void setUpdatingCache(boolean updating) {
212
		this.updating = updating;
213
	}
214

  
215
	/**
216
	 * This method initializes jPanel2
217
	 *
218
	 * @return Panel
219
	 */
220
	private JPanel getJPanel2() {
221
		if (jPanel2 == null) {
222
			jPanel2 = new JPanel();
223
			jPanel2.setLayout(null);
224
			jPanel2.setBounds(5, 59, 485, 328);
225
			jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(
226
					null, PluginServices.getText(this, "select_layers"),
227
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
228
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
229
					null));
230
			jPanel2.add(getChkExtendedNames(), null);
231

  
232
			jPanel2.add(getJScrollPane1(), null);
233
			jPanel2.add(getBtnDel(), null);
234
			jPanel2.add(getBtnAdd(), null);
235
			jPanel2.add(getJScrollPane5(), null);
236
			jPanel2.add(getBtnUp(), null);
237
			jPanel2.add(getBtnDown(), null);
238
			jPanel2.add(getChkDisagregate(), null);
239
		}
240

  
241
		return jPanel2;
242
	}
243

  
244
	/**
245
	 * This method initializes jPanel4
246
	 *
247
	 * @return Panel
248
	 */
249
	private JPanel getJPanel4() {
250
		if (jPanel4 == null) {
251
			jPanel4 = new JPanel();
252
			jPanel4.setLayout(null);
253
			jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(
254
					null, PluginServices.getText(this, "layer_name"),
255
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
256
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
257
					null));
258
			jPanel4.setBounds(5, 8, 485, 49);
259
			jPanel4.add(getJTxtNomCapa(), null);
260
		}
261

  
262
		return jPanel4;
263
	}
264

  
265
	/**
266
	 * This method initializes jPanel3
267
	 *
268
	 * @return Panel
269
	 */
270
	private JPanel getTabFormats() {
271
		if (tabFormats == null) {
272
			tabFormats = new JPanel();
273
			tabFormats.setLayout(null);
274
			tabFormats.add(getJPanelFormats(), null);
275
			tabFormats.add(getJPanelSrsSelection(), null);
276
			tabFormats.add(getJPanelInfoByPointFormat(), null);
277
		}
278

  
279
		return tabFormats;
280
	}
281

  
282
	/**
283
	 * This method initializes jScrollPane1
284
	 *
285
	 * @return ScrollPane
286
	 */
287
	private JScrollPane getJScrollPane1() {
288
		if (jScrollPane1 == null) {
289
			jScrollPane1 = new JScrollPane();
290
			jScrollPane1.setBounds(11, 22, 460, 123);
291
			jScrollPane1.setViewportView(getTreeLayers());
292
			jScrollPane1.setPreferredSize(new java.awt.Dimension(205, 75));
293
		}
294

  
295
		return jScrollPane1;
296
	}
297

  
298
	/**
299
	 * This method initializes btnDel
300
	 *
301
	 * @return Button
302
	 */
303
	private JButton getBtnDel() {
304
		if (btnDel == null) {
305
			btnDel = new JButton();
306
			// btnDel.setPreferredSize(new java.awt.Dimension(23, 23));
307
			btnDel.setText(PluginServices.getText(this, "remove"));
308
			btnDel.setMargin(new java.awt.Insets(2, 0, 2, 0));
309
			btnDel.setBounds(339, 300, 101, 20);
310
			btnDel.setEnabled(false);
311
			btnDel.addActionListener(new java.awt.event.ActionListener() {
312
				public void actionPerformed(java.awt.event.ActionEvent e) {
313
					delLayer();
314
				}
315
			});
316
		}
317
		return btnDel;
318
	}
319

  
320
	/**
321
	 * This method initializes btnAdd
322
	 *
323
	 * @return Button
324
	 */
325
	private JButton getBtnAdd() {
326
		if (btnAdd == null) {
327
			btnAdd = new JButton();
328
			// btnAdd.setPreferredSize(new java.awt.Dimension(23, 23));
329
			btnAdd.setText(PluginServices.getText(this, "add"));
330
			btnAdd.setMargin(new java.awt.Insets(2, 0, 2, 0));
331
			btnAdd.setBounds(236, 300, 101, 20);
332
			btnAdd.setEnabled(false);
333
			btnAdd.addActionListener(new java.awt.event.ActionListener() {
334
				public void actionPerformed(java.awt.event.ActionEvent e) {
335
					addLayer();
336
				}
337
			});
338
		}
339
		return btnAdd;
340
	}
341

  
342
	/**
343
	 * This method initializes jScrollPane5
344
	 *
345
	 * @return ScrollPane
346
	 */
347
	private JScrollPane getJScrollPane5() {
348
		if (jScrollPane5 == null) {
349
			jScrollPane5 = new JScrollPane();
350
			jScrollPane5.setBounds(11, 155, 422, 120);
351
			jScrollPane5.setViewportView(getLstSelectedLayers());
352
			jScrollPane5.setPreferredSize(new java.awt.Dimension(205, 75));
353
		}
354

  
355
		return jScrollPane5;
356
	}
357

  
358
	/**
359
	 * This method initializes jTextField
360
	 *
361
	 * @return TextField
362
	 */
363
	private JTextField getJTxtNomCapa() {
364
		if (jTxtNomCapa == null) {
365
			jTxtNomCapa = new JTextField();
366
			jTxtNomCapa.setBounds(10, 19, 460, 20);
367
			jTxtNomCapa.setText(PluginServices.getText(this, "WMSLayer"));
368
			jTxtNomCapa.addKeyListener(new java.awt.event.KeyAdapter() {
369
				public void keyTyped(java.awt.event.KeyEvent e) {
370
					fireWizardComplete(isCorrectlyConfigured());
371
				}
372
			});
373
		}
374

  
375
		return jTxtNomCapa;
376
	}
377

  
378
	/**
379
	 * This method initializes jPanel1
380
	 *
381
	 * @return Panel
382
	 */
383
	private JPanel getJPanelFormats() {
384
		if (jPanelFormats == null) {
385
			jPanelFormats = new JPanel();
386
			jPanelFormats.setLayout(null);
387
			jPanelFormats.setBorder(javax.swing.BorderFactory.createTitledBorder(
388
					null, PluginServices.getText(this, "select_formats"),
389
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
390
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
391
					null));
392
			jPanelFormats.setBounds(5, 10, 485, 145);
393
			jPanelFormats.add(getJScrollPaneFormats(), null);
394
			jPanelFormats.add(getChkTransparency(), null);
395
		}
396
		return jPanelFormats;
397
	}
398

  
399
	/**
400
	 * This method initializes jPanel5
401
	 *
402
	 * @return Panel
403
	 */
404
	private JPanel getJPanelSrsSelection() {
405
		if (jPanelSrsSelection == null) {
406
			jPanelSrsSelection = new JPanel();
407
			jPanelSrsSelection.setLayout(null);
408
			jPanelSrsSelection.setBorder(javax.swing.BorderFactory.createTitledBorder(
409
					null, PluginServices.getText(this, "seleccionar_srs"),
410
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
411
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
412
					null));
413
			jPanelSrsSelection.setBounds(5, 162, 485, 126);
414
			jPanelSrsSelection.add(getJScrollPane2(), null);
415
		}
416
		return jPanelSrsSelection;
417
	}
418

  
419
	/**
420
	 * This method initializes jPanel6
421
	 *
422
	 * @return Panel
423
	 */
424
	private JPanel getJPanelInfoByPointFormat() {
425
		if (jPanelInfoByPointFormat == null) {
426
			jPanelInfoByPointFormat = new JPanel();
427
			jPanelInfoByPointFormat.setLayout(null);
428
			jPanelInfoByPointFormat.setBorder(javax.swing.BorderFactory.createTitledBorder(
429
					null, PluginServices.getText(this, "seleccionar_infobypoint_format"),
430
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
431
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
432
					null));
433
			jPanelInfoByPointFormat.setBounds(5, 273, 485, 78);
434
			jPanelInfoByPointFormat.add(getJScrollPane3(), null);
435
		}
436
		return jPanelInfoByPointFormat;
437
	}
438

  
439
	/**
440
	 * This method initializes jScrollPane6
441
	 *
442
	 * @return ScrollPane
443
	 */
444
	private JScrollPane getJScrollPaneFormats() {
445
		if (jScrollPane6 == null) {
446
			jScrollPane6 = new JScrollPane();
447
			jScrollPane6.setBounds(5, 23, 470, 85);
448
			jScrollPane6.setViewportView(getLstFormats());
449
			jScrollPane6.setPreferredSize(new java.awt.Dimension(250, 85));
450
		}
451

  
452
		return jScrollPane6;
453
	}
454

  
455

  
456
	/**
457
	 * This method initializes chkTrasparency
458
	 *
459
	 * @return CheckBox
460
	 */
461
	private JCheckBox getChkTransparency() {
462
		if (chkTransparency == null) {
463
			chkTransparency = new JCheckBox();
464
			chkTransparency.setText(PluginServices.getText(this,
465
					"wms_transparency"));
466
			chkTransparency.setSelected(true);
467
			chkTransparency.addItemListener(new java.awt.event.ItemListener() {
468
				public void itemStateChanged(java.awt.event.ItemEvent e) {
469
					fireWizardComplete(isCorrectlyConfigured());
470
				}
471
			});
472
			chkTransparency.setBounds(15, 115, 421, 21);
473
			chkTransparency.setVisible(true);
474
		}
475
		return chkTransparency;
476
	}
477

  
478
	/**
479
	 * This method initializes jScrollPane2
480
	 *
481
	 * @return ScrollPane
482
	 */
483
	private JScrollPane getJScrollPane2() {
484
		if (jScrollPane2 == null) {
485
			jScrollPane2 = new JScrollPane();
486
			jScrollPane2.setBounds(5, 23, 470, 91);
487
			jScrollPane2.setViewportView(getLstSRSs());
488
			jScrollPane2.setPreferredSize(new java.awt.Dimension(250, 91));
489
		}
490

  
491
		return jScrollPane2;
492
	}
493

  
494
	/**
495
	 * This method initializes jScrollPane3
496
	 *
497
	 * @return ScrollPane
498
	 */
499
	private JScrollPane getJScrollPane3() {
500
		if (jScrollPane3 == null) {
501
			jScrollPane3 = new JScrollPane();
502
			jScrollPane3.setBounds(5, 23, 470, 45);
503
			jScrollPane3.setViewportView(getLstInfoFormats());
504
			jScrollPane3.setPreferredSize(new java.awt.Dimension(250, 120));
505
		}
506

  
507
		return jScrollPane3;
508
	}
509

  
510
	/**
511
	 * Gets the available layers in WMS maintaining the tree structure
512
	 *
513
	 * @return
514
	 */
515
	public LayerTree getLayerStructure() {
516
		return treeLayers;
517
	}
518

  
519
	/**
520
	 * This method initializes treeLayers
521
	 *
522
	 * @return Tree
523
	 */
524
	private LayerTree getTreeLayers() {
525
		if (treeLayers == null) {
526
			treeLayers = new LayerTree();
527
			treeLayers.setRootVisible(true);
528
			treeLayers.addMouseListener(new java.awt.event.MouseAdapter() {
529
				public void mouseClicked(java.awt.event.MouseEvent e) {
530
					if (e.getClickCount() == 2) {
531
						addLayer();
532
					}
533
				}
534
			});
535
			treeLayers
536
					.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
537
						public void valueChanged(
538
								javax.swing.event.TreeSelectionEvent e) {
539

  
540
							boolean isGetMapable = false;
541
							TreePath[] selecciones = getTreeLayers()
542
									.getSelectionPaths();
543
							if (selecciones != null) {
544
								for (int i = 0; i < selecciones.length
545
										&& !isGetMapable; i++) {
546
									WMSLayerNode layer = ((WMSLayerNode) selecciones[i]
547
											.getLastPathComponent());
548
									isGetMapable = layer.getChildren().size() == 0
549
											|| layer.getName() != null;
550
								}
551

  
552
							}
553
							getBtnAdd().setEnabled(isGetMapable);
554
							fireWizardComplete(isCorrectlyConfigured());
555
						}
556
					});
557
		}
558

  
559
		return treeLayers;
560
	}
561

  
562
	/**
563
	 * This method checks for the options selected within the configuration
564
	 * dialog are correct and enough to perform a GetMap request.
565
	 *
566
	 * @return true if you're done, false if not.
567
	 */
568
	public boolean isCorrectlyConfigured() {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff