Revision 247

View differences:

org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/pom.xml
1
<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">
2
    <modelVersion>4.0.0</modelVersion>
3
    <artifactId>org.gvsig.wfs.app</artifactId>
4
    <packaging>pom</packaging>
5

  
6
    <name>${project.artifactId}</name>
7
    <description>Web Feature Service support</description>
8
    <version>2.0.33</version>
9

  
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>org.gvsig.desktop</artifactId>
13
        <version>2.0.126</version>
14
    </parent>
15

  
16
    <url>https://devel.gvsig.org/redmine/projects/gvsig-wfs</url>
17

  
18
    <repositories>
19
        <repository>
20
            <id>gvsig-public-http-repository</id>
21
            <name>gvSIG maven public HTTP repository</name>
22
            <url>http://devel.gvsig.org/m2repo/j2se</url>
23
            <releases>
24
                <enabled>true</enabled>
25
                <updatePolicy>daily</updatePolicy>
26
                <checksumPolicy>warn</checksumPolicy>
27
            </releases>
28
            <snapshots>
29
                <enabled>true</enabled>
30
                <updatePolicy>daily</updatePolicy>
31
                <checksumPolicy>warn</checksumPolicy>
32
            </snapshots>
33
        </repository>
34
    </repositories>
35

  
36
    <scm>
37
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33</connection>
38
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33</developerConnection>
39
        <url>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33</url>
40
    </scm>
41

  
42
    <build>
43
        <plugins>
44
            <plugin>
45
                <groupId>org.apache.maven.plugins</groupId>
46
                <artifactId>maven-release-plugin</artifactId>
47
                <configuration>
48
                    <tagBase>https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags</tagBase>
49
                </configuration>
50
            </plugin>
51
        </plugins>
52
    </build>
53
   
54
    <properties>
55
        <org.gvsig.gpe.version>2.1.24</org.gvsig.gpe.version>
56
        <org.gvsig.xmlschema.version>2.0.4</org.gvsig.xmlschema.version>
57
    </properties>  
58
    
59
    <dependencyManagement>
60
        <dependencies>
61
            <!-- Childs -->
62
            <dependency>
63
                <groupId>org.gvsig</groupId>
64
                <artifactId>org.gvsig.wfs.app.mainplugin</artifactId>
65
                <version>2.0.33</version>
66
            </dependency>
67
                                 
68
            <!-- Extern libraries -->
69
            
70
            <!-- gvSIG extern libraries -->
71
            <dependency>
72
                <groupId>org.gvsig</groupId>
73
                <artifactId>org.gvsig.gpe</artifactId>
74
                <version>${org.gvsig.gpe.version}</version>
75
                <type>pom</type>
76
                <scope>import</scope>
77
            </dependency>
78
            <dependency>
79
                <groupId>org.gvsig</groupId>
80
                <artifactId>org.gvsig.xmlschema</artifactId>
81
                <version>${org.gvsig.xmlschema.version}</version>
82
                <type>pom</type>
83
                <scope>import</scope>
84
            </dependency>
85

  
86
        </dependencies>
87
    </dependencyManagement>
88

  
89
    <modules>
90
        <module>org.gvsig.wfs.app.mainplugin</module>
91
    </modules>
92

  
93
</project>
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/org.gvsig.wfs.app.mainplugin/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
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/xsd/maven-4.0.0.xsd">
4

  
5
    <modelVersion>4.0.0</modelVersion>
6
    <artifactId>org.gvsig.wfs.app.mainplugin</artifactId>
7

  
8
    <packaging>jar</packaging>
9
    <name>${project.artifactId}</name>
10
    <description>Web Feature Service support</description>
11

  
12
    <parent>
13
        <groupId>org.gvsig</groupId>
14
        <artifactId>org.gvsig.wfs.app</artifactId>
15
        <version>2.0.33</version>
16
    </parent>
17

  
18

  
19

  
20
    <dependencies>
21
        <dependency>
22
            <groupId>org.gvsig</groupId>
23
            <artifactId>org.gvsig.app.mainplugin</artifactId>
24
            <scope>compile</scope>
25
        </dependency>
26
        <dependency>
27
            <groupId>org.gvsig</groupId>
28
            <artifactId>org.gvsig.utils</artifactId>
29
            <scope>compile</scope>
30
        </dependency>
31
        <dependency>
32
            <groupId>org.gvsig</groupId>
33
            <artifactId>org.gvsig.remoteclient</artifactId>
34
            <scope>compile</scope>
35
        </dependency>
36
        <dependency>
37
            <groupId>org.gvsig</groupId>
38
            <artifactId>org.gvsig.andami</artifactId>
39
            <scope>compile</scope>
40
        </dependency>
41
        <dependency>
42
            <groupId>org.gvsig</groupId>
43
            <artifactId>org.gvsig.projection.api</artifactId>
44
            <scope>compile</scope>
45
        </dependency>
46
        <dependency>
47
            <groupId>org.gvsig</groupId>
48
            <artifactId>org.gvsig.ui</artifactId>
49
            <scope>compile</scope>
50
        </dependency>
51
        <dependency>
52
            <groupId>org.gvsig</groupId>
53
            <artifactId>org.gvsig.gpe.extension</artifactId>
54
            <version>2.0</version>
55
            <classifier>store</classifier>
56
            <scope>compile</scope>
57
        </dependency>
58
        <dependency>
59
            <groupId>org.gvsig</groupId>
60
            <artifactId>org.gvsig.gpe.lib.api</artifactId>
61
            <scope>compile</scope>
62
        </dependency>
63
        <dependency>
64
            <groupId>org.gvsig</groupId>
65
            <artifactId>org.gvsig.xmlschema.lib.api</artifactId>
66
            <scope>compile</scope>
67
        </dependency>
68
        <dependency>
69
            <groupId>org.gvsig</groupId>
70
            <artifactId>org.gvsig.fmap.dal.api</artifactId>
71
            <scope>compile</scope>
72
        </dependency>
73
        <dependency>
74
            <groupId>org.gvsig</groupId>
75
            <artifactId>org.gvsig.fmap.dal.spi</artifactId>
76
            <scope>compile</scope>
77
        </dependency>
78
        <dependency>
79
            <groupId>org.gvsig</groupId>
80
            <artifactId>org.gvsig.tools.lib</artifactId>
81
            <scope>compile</scope>
82
        </dependency>
83
        <dependency>
84
            <groupId>org.gvsig</groupId>
85
            <artifactId>org.gvsig.tools.swing.api</artifactId>
86
            <scope>compile</scope>
87
        </dependency>
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.geometry.api</artifactId>
96
        </dependency>
97
        <dependency>
98
            <groupId>org.gvsig</groupId>
99
            <artifactId>org.gvsig.fmap.control</artifactId>
100
            <scope>compile</scope>
101
        </dependency>
102
        <dependency>
103
            <groupId>org.gvsig</groupId>
104
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
105
            <scope>compile</scope>
106
        </dependency>
107

  
108
        <dependency>
109
            <groupId>org.gvsig</groupId>
110
            <artifactId>org.gvsig.tools.lib</artifactId>
111
            <type>test-jar</type>
112
            <scope>test</scope>
113
        </dependency>
114
        <dependency>
115
            <groupId>org.gvsig</groupId>
116
            <artifactId>org.gvsig.compat.se</artifactId>
117
            <scope>test</scope>
118
        </dependency>
119
        <dependency>
120
            <groupId>org.gvsig</groupId>
121
            <artifactId>org.gvsig.xmlpull.lib.impl</artifactId>
122
            <scope>runtime</scope>
123
        </dependency>
124
        <dependency>
125
            <groupId>org.gvsig</groupId>
126
            <artifactId>org.gvsig.xmlpull.prov.kxml</artifactId>
127
            <scope>runtime</scope>
128
        </dependency>
129
        <dependency>
130
            <groupId>org.gvsig</groupId>
131
            <artifactId>org.gvsig.xmlschema.lib.impl</artifactId>
132
            <scope>runtime</scope>
133
        </dependency>
134
        <dependency>
135
            <groupId>org.gvsig</groupId>
136
            <artifactId>org.gvsig.xmlschema.prov.kxml</artifactId>
137
            <scope>runtime</scope>
138
        </dependency>
139
        <dependency>
140
            <groupId>org.gvsig</groupId>
141
            <artifactId>org.gvsig.timesupport.lib.api</artifactId>
142
            <scope>compile</scope>
143
        </dependency>
144
        <dependency>
145
            <groupId>java3d</groupId>
146
            <artifactId>vecmath</artifactId>
147
            <scope>runtime</scope>
148
        </dependency>
149

  
150
        <!--
151
        <dependency>
152
            <groupId>org.geotools</groupId>
153
            <artifactId>gt2-main</artifactId>
154
            <scope>compile</scope>
155
        </dependency>
156
        -->
157

  
158
        <dependency>
159
            <groupId>org.slf4j</groupId>
160
            <artifactId>slf4j-api</artifactId>
161
            <scope>compile</scope>
162
        </dependency>
163
        <dependency>
164
            <groupId>zql</groupId>
165
            <artifactId>zql</artifactId>
166
            <scope>compile</scope>
167
        </dependency>
168
        <dependency>
169
            <groupId>org.gvsig</groupId>
170
            <artifactId>org.gvsig.i18n</artifactId>
171
            <scope>compile</scope>
172
        </dependency>
173

  
174
    </dependencies>
175

  
176
    <build>
177
        <plugins>
178
            <plugin>
179
                <groupId>org.apache.maven.plugins</groupId>
180
                <artifactId>maven-surefire-plugin</artifactId>
181
                <configuration>
182
                    <!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
183
                    <skipTests>true</skipTests>
184
                </configuration>
185
            </plugin>
186
        </plugins>
187
    </build>
188

  
189
    <properties>
190
        <gvsig.package.info.name>Formats: WFS support</gvsig.package.info.name>
191
        <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2,required: org.gvsig.gpe.app.mainplugin -ge 2</gvsig.package.info.dependencies>
192
        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-wfs/pool</gvsig.package.info.poolURL>
193
        <gvsig.package.info.sourcesURL>https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app</gvsig.package.info.sourcesURL>
194
        <gvsig.package.info.state>testing</gvsig.package.info.state>
195
        <!-- alpha-devel -->
196
        <gvsig.package.info.categories>Formats,Vector,OGC,Remote Services</gvsig.package.info.categories>
197
        <gvsig.package.info.official>true</gvsig.package.info.official>
198

  
199
    </properties>
200

  
201
</project>
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/org.gvsig.wfs.app.mainplugin/buildNumber.properties
1
#Thu Feb 04 13:28:41 CET 2016
2
buildNumber=2115
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/org.gvsig.wfs.app.mainplugin/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.store.wfs.WFSLibrary
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/org.gvsig.wfs.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
<!--
26
  <dependencySets>
27
    <dependencySet>
28
      <useProjectArtifact>false</useProjectArtifact>
29
      <useTransitiveDependencies>false</useTransitiveDependencies>
30
      <outputDirectory>lib</outputDirectory>
31
      <includes>
32
        <include>org.gvsig:org.gvsig.wfs.app.mainplugin</include>
33
      </includes>
34
    </dependencySet>
35
  </dependencySets>
36
-->
37

  
38
</assembly>
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/wfs/WFSClientExtension.java
1
package org.gvsig.wfs;
2

  
3
import org.gvsig.andami.IconThemeHelper;
4
import org.gvsig.andami.plugins.Extension;
5
import org.gvsig.app.extension.AddLayer;
6
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow;
7
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider;
8
import org.gvsig.fmap.mapcontext.MapContextLocator;
9
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
10
import org.gvsig.gui.beans.panelGroup.PanelGroupManager;
11
import org.gvsig.tools.ToolsLocator;
12
import org.gvsig.tools.extensionpoint.ExtensionPoint;
13
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
14
import org.gvsig.wfs.gui.panels.WFSAreaPanel;
15
// import org.gvsig.wfs.gui.panels.WFSFilterPanel;
16
import org.gvsig.wfs.gui.panels.WFSInfoPanel;
17
import org.gvsig.wfs.gui.panels.WFSOptionsPanel;
18
import org.gvsig.wfs.gui.panels.WFSParamsPanel;
19
import org.gvsig.wfs.gui.panels.WFSSelectFeaturePanel;
20
import org.gvsig.wfs.gui.panels.WFSSelectFieldsPanel;
21
import org.gvsig.wfs.gui.toc.WFSProperties;
22
import org.gvsig.wfs.gui.wizards.WFSWizard;
23

  
24

  
25
public class WFSClientExtension extends Extension{
26

  
27
	public void initialize() {
28
		// Adds a new tab to the "add layer" wizard for WFS layer creation
29
		AddLayer.addWizard(WFSWizard.class);
30
		
31
		ExtensionPointManager extensionPointManager = ToolsLocator
32
		.getExtensionPointManager();
33
     	
34
		//WFS properties tabs:
35
		ExtensionPoint wfsTabExtensionPoint = extensionPointManager.add("WFSPropertiesDialog");
36
		wfsTabExtensionPoint.append("info", "", WFSInfoPanel.class);
37
		wfsTabExtensionPoint.append("features", "", WFSSelectFeaturePanel.class);
38
		wfsTabExtensionPoint.append("fields", "", WFSSelectFieldsPanel.class);
39
		wfsTabExtensionPoint.append("options", "", WFSOptionsPanel.class);
40
		// wfsTabExtensionPoint.append("filter", "", WFSFilterPanel.class);
41
		wfsTabExtensionPoint.append("area", "", WFSAreaPanel.class);
42
				
43
		ThemeManagerWindow.addPage(WFSProperties.class);
44
		ThemeManagerWindow.setTabEnabledForLayer(WFSProperties.class, FLyrVect.class, true);
45
                		
46
                // Registers this class as a "PanelGroup" type
47
                PanelGroupManager.getManager().registerPanelGroup(WFSParamsPanel.class);
48

  
49
                // Sets this class as the default "PanelGroup" type
50
                PanelGroupManager.getManager().setDefaultType(WFSParamsPanel.class);
51

  
52
                initilizeIcons();		
53
	}
54

  
55
	/*
56
	 * (non-Javadoc)
57
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
58
	 */
59
	public void execute(String actionCommand) {
60
		// TODO Auto-generated method stub
61
		
62
	}	
63

  
64
	/*
65
	 * (non-Javadoc)
66
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
67
	 */
68
	public boolean isEnabled() {
69
		// TODO Auto-generated method stub
70
		return false;
71
	}
72

  
73
	/*
74
	 * (non-Javadoc)
75
	 * @see com.iver.andami.plugins.IExtension#isVisible()
76
	 */
77
	public boolean isVisible() {
78
		// TODO Auto-generated method stub
79
		return false;
80
	}
81
	
82
	/**
83
	 * Prepares support for the icons that can be used in the WFS extension.
84
	 */
85
	void initilizeIcons(){
86
		IconThemeHelper.registerIcon("layer", "layer-icon-wfs", this);
87
		MapContextLocator.getMapContextManager().registerIconLayer(WFSStoreProvider.NAME, "layer-icon-wfs");
88

  
89
		// WFSAreaPanel.java
90
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-undo", this);
91
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-move", this);
92
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-scaling", this); // ???
93
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-pan", this);
94
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-zoom-in", this);
95
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-zoom-out", this);
96
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-zoom-back", this);
97
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-zoom-all", this);
98
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-zoom-plus", this);
99
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-zoom-minus", this);
100
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-query-area", this);
101
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-query-distance", this);
102
		IconThemeHelper.registerIcon("wfs-properties", "wfs-properties-validate-area", this); // ???
103
	}
104

  
105
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/wfs/gui/toc/WFSProperties.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
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.wfs.gui.toc;
29

  
30
import java.awt.BorderLayout;
31

  
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.app.panelGroup.loaders.PanelGroupLoaderFromExtensionPoint;
34
import org.gvsig.app.project.documents.view.legend.gui.AbstractThemeManagerPage;
35
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow;
36
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer;
37
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider;
38
import org.gvsig.fmap.mapcontext.exceptions.CreateLayerException;
39
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
40
import org.gvsig.fmap.mapcontext.layers.FLayer;
41
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
42
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
43
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
44
import org.gvsig.gui.beans.panelGroup.PanelGroupManager;
45
import org.gvsig.wfs.gui.panels.WFSParamsPanel;
46
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeatureManager;
47
import org.slf4j.Logger;
48
import org.slf4j.LoggerFactory;
49

  
50

  
51
/**
52
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
53
 */
54
public class WFSProperties extends AbstractThemeManagerPage{
55
        private static final long serialVersionUID = -3666226507540534256L;
56

  
57
        private static final Logger LOG = LoggerFactory.getLogger(WFSProperties.class);
58
    
59
        private WFSParamsPanel panel = null;
60
	private FLyrVect layer = null;
61
	private final String wfs_properties_extensionpoint_name = "WFSPropertiesDialog";
62
	
63
	public WFSProperties() {
64
		super();
65
		setLayout(new BorderLayout());		
66
	}
67

  
68
	public void acceptAction() {
69
		applyAction();		
70
	}
71

  
72
	public void applyAction() {
73
		if (panel != null){			
74
		    try{
75
		        ILegend legend = layer.getLegend();
76
		        /*
77
		         * The layer is re-created each time.
78
		         * TODO Check if this is really necessary
79
		         */
80
		        FLyrVect newLayer = (FLyrVect)panel.createLayer();
81

  
82
		        /* 
83
		         * Copy label strategy too
84
		         */
85
		        newLayer.setIsLabeled(layer.isLabeled());
86
		        newLayer.setLabelingStrategy(layer.getLabelingStrategy());
87
		        // =======================================
88
		        
89
		        if (newLayer != null){		      
90
		            layer.getMapContext().getLayers().replaceLayer(layer, newLayer);
91
		            layer = newLayer;
92
		            layer.setLegend((IVectorLegend)legend);
93
		        }
94
		    } catch (LoadLayerException e) {
95
		        LOG.error("Error loading the new layer", e);
96
		    } catch (CreateLayerException e) {
97
		        LOG.error("Error creating the new layer", e);
98
            }
99

  
100
		}
101
	}
102

  
103
	public void cancelAction() {
104
		// TODO Auto-generated method stub
105
		
106
	}
107

  
108
	public String getName() {
109
		return PluginServices.getText(this, "WFS");
110
	}
111

  
112
        public boolean isTabEnabledForLayer(FLayer layer) {
113
            if(! (layer instanceof FLyrVect) ) {
114
                return false; 
115
            }
116
            if( !WFSStoreProvider.NAME.equalsIgnoreCase(((FLyrVect)layer).getFeatureStore().getProviderName()) ) {
117
                return false; 
118
            }
119
            return true;
120
        }
121
        
122
	public void setModel(FLayer layer) {
123
                this.layer = (FLyrVect)layer;
124
                PanelGroupManager manager = PanelGroupManager.getManager();
125
		manager.registerPanelGroup(WFSParamsPanel.class);
126
		manager.setDefaultType(WFSParamsPanel.class);
127
		try {
128
			if( ! (this.layer.getDataStore().getExplorer() instanceof  WFSServerExplorer) ) {
129
				return;
130
			}
131
			boolean firstExecution = (panel == null);
132
			WFSServerExplorer serverExplorer = (WFSServerExplorer)this.layer.getDataStore().getExplorer();
133
			WFSSelectedFeatureManager selectedFeatureManager = WFSSelectedFeatureManager.getInstance(serverExplorer);
134
			panel = (WFSParamsPanel) manager.getPanelGroup(null);
135
			panel.loadPanels(new PanelGroupLoaderFromExtensionPoint(wfs_properties_extensionpoint_name));
136
			panel.setServerExplorer(serverExplorer);
137
			panel.setVisible(true);		
138
			if (firstExecution){				
139
				add(panel, BorderLayout.CENTER);				
140
			}		
141
			
142
			//Refresh the forms with the capabilities information
143
			panel.refreshCapabilitiesInfo();
144
			
145
			//Set the datastore
146
			panel.setDataStore(((FLyrVect)layer).getDataStore());
147
		} catch (Exception e) {
148
		    LOG.error("Error loading the layer", e);
149
		}		
150
	}
151

  
152
}
153

  
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/wfs/gui/panels/AbstractWFSPanel.java
1
package org.gvsig.wfs.gui.panels;
2

  
3
import java.awt.Dimension;
4

  
5
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer;
6
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
7
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeature;
8
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeatureManager;
9
import org.slf4j.Logger;
10
import org.slf4j.LoggerFactory;
11

  
12

  
13

  
14
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
15
 *
16
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
17
 *
18
 * This program is free software; you can redistribute it and/or
19
 * modify it under the terms of the GNU General Public License
20
 * as published by the Free Software Foundation; either version 2
21
 * of the License, or (at your option) any later version.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 * GNU General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU General Public License
29
 * along with this program; if not, write to the Free Software
30
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
31
 *
32
 * For more information, contact:
33
 *
34
 *  Generalitat Valenciana
35
 *   Conselleria d'Infraestructures i Transport
36
 *   Av. Blasco Ib??ez, 50
37
 *   46010 VALENCIA
38
 *   SPAIN
39
 *
40
 *      +34 963862235
41
 *   gvsig@gva.es
42
 *      www.gvsig.gva.es
43
 *
44
 *    or
45
 *
46
 *   IVER T.I. S.A
47
 *   Salamanca 50
48
 *   46005 Valencia
49
 *   Spain
50
 *
51
 *   +34 963163400
52
 *   dac@iver.es
53
 */
54

  
55
/* CVS MESSAGES:
56
 *
57
 * $Id$
58
 * $Log$
59
 *
60
 */
61

  
62
/**
63
 * <p>Default panel used to create a WFS group's panel.</p>
64
 * 
65
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
66
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
67
 */
68
public abstract class AbstractWFSPanel extends AbstractPanel implements IWFSPanel {
69
	// Default dimensions of all WFS panels
70
	static final int PANEL_WIDTH = 475;
71
	static final int PANEL_HEIGHT = 365;
72
	protected static final Logger logger = LoggerFactory.getLogger(AbstractWFSPanel.class);
73

  
74
	/**
75
	 * Initializes an WFS panel.
76
	 */
77
	public AbstractWFSPanel() {
78
		super();
79
		setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
80
	}
81

  
82
	/*
83
	 * (non-Javadoc)
84
	 * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#initialize()
85
	 */
86
	protected void initialize() {
87
		// By default all panels will be at the GUI
88
		setVisible(true);
89
	}
90

  
91
	/**
92
	 * <p>Gets the information of the wizard used to add or load panels.</p>
93
	 * 
94
	 * @return the wizard data
95
	 */
96
	public WFSServerExplorer getServerExplorer(){
97
		return (getPanelGroup() == null)? null: ((WFSParamsPanel)getPanelGroup()).getServerExplorer();  
98
	}
99
	
100
	public WFSSelectedFeatureManager getSelectedFeatureManager(){
101
		return (getPanelGroup() == null)? null: ((WFSParamsPanel)getPanelGroup()).getSelectedFeatureManager();
102
	}
103

  
104
	/*
105
	 * (non-Javadoc)
106
	 * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#setReference(java.lang.Object)
107
	 */
108
	public void setReference(Object ref) {
109
		super.setReference(ref);
110
	}	
111
 
112
	/*
113
	 * (non-Javadoc)
114
	 * @see com.iver.cit.gvsig.gui.panels.IWFSPanel#refresh(com.iver.cit.gvsig.fmap.layers.WFSLayerNode)
115
	 */
116
	public void refresh(WFSSelectedFeature layer) {
117
	}
118

  
119
	/*
120
	 * (non-Javadoc)
121
	 * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#accept()
122
	 */
123
	public void accept() {
124
	}
125

  
126
	/*
127
	 * (non-Javadoc)
128
	 * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#apply()
129
	 */
130
	public void apply() {
131
	}
132

  
133
	/*
134
	 * (non-Javadoc)
135
	 * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#cancel()
136
	 */
137
	public void cancel() {
138
	}
139

  
140
	/*
141
	 * (non-Javadoc)
142
	 * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#selected()
143
	 */
144
	public void selected() {
145
	}
146
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.33/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/wfs/gui/panels/WFSParamsPanel.java
1
package org.gvsig.wfs.gui.panels;
2

  
3
import java.awt.Container;
4
import java.util.List;
5

  
6
import javax.swing.JTabbedPane;
7

  
8
import org.cresques.cts.IProjection;
9
import org.gvsig.andami.PluginServices;
10
import org.gvsig.app.gui.ILayerPanel;
11
import org.gvsig.app.gui.WizardPanel;
12
import org.gvsig.fmap.crs.CRSFactory;
13
import org.gvsig.fmap.dal.DALLocator;
14
import org.gvsig.fmap.dal.DataManager;
15
import org.gvsig.fmap.dal.DataStore;
16
import org.gvsig.fmap.dal.exception.DataException;
17
import org.gvsig.fmap.dal.exception.InitializeException;
18
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
19
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer;
20
import org.gvsig.fmap.dal.store.wfs.WFSStoreParameters;
21
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider;
22
import org.gvsig.fmap.geom.Geometry;
23
import org.gvsig.fmap.geom.primitive.Envelope;
24
import org.gvsig.fmap.mapcontext.MapContextLocator;
25
import org.gvsig.fmap.mapcontext.MapContextManager;
26
import org.gvsig.fmap.mapcontext.exceptions.CreateLayerException;
27
import org.gvsig.fmap.mapcontext.layers.FLayer;
28
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
29
import org.gvsig.gui.beans.panelGroup.exceptions.EmptyPanelGroupException;
30
import org.gvsig.gui.beans.panelGroup.exceptions.EmptyPanelGroupGUIException;
31
import org.gvsig.gui.beans.panelGroup.exceptions.ListCouldntAddPanelException;
32
import org.gvsig.gui.beans.panelGroup.loaders.IPanelGroupLoader;
33
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
34
import org.gvsig.gui.beans.panelGroup.panels.IPanel;
35
import org.gvsig.gui.beans.panelGroup.tabbedPanel.TabbedPanel;
36
import org.gvsig.remoteclient.wfs.filters.filterencoding.FilterEncoding;
37
import org.gvsig.remoteclient.wfs.schema.XMLNameSpace;
38
import org.gvsig.tools.dynobject.DynObject;
39
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeature;
40
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeatureManager;
41
import org.gvsig.wfs.gui.wizards.WFSWizard;
42
import org.slf4j.Logger;
43
import org.slf4j.LoggerFactory;
44

  
45

  
46
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
47
 *
48
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
49
 *
50
 * This program is free software; you can redistribute it and/or
51
 * modify it under the terms of the GNU General Public License
52
 * as published by the Free Software Foundation; either version 2
53
 * of the License, or (at your option) any later version.
54
 *
55
 * This program is distributed in the hope that it will be useful,
56
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
57
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
58
 * GNU General Public License for more details.
59
 *
60
 * You should have received a copy of the GNU General Public License
61
 * along with this program; if not, write to the Free Software
62
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
63
 *
64
 * For more information, contact:
65
 *
66
 *  Generalitat Valenciana
67
 *   Conselleria d'Infraestructures i Transport
68
 *   Av. Blasco Ib??ez, 50
69
 *   46010 VALENCIA
70
 *   SPAIN
71
 *
72
 *      +34 963862235
73
 *   gvsig@gva.es
74
 *      www.gvsig.gva.es
75
 *
76
 *    or
77
 *
78
 *   IVER T.I. S.A
79
 *   Salamanca 50
80
 *   46005 Valencia
81
 *   Spain
82
 *
83
 *   +34 963163400
84
 *   dac@iver.es
85
 */
86
/* CVS MESSAGES:
87
 *
88
 * $Id: WFSParamsPanel.java 17736 2008-01-02 16:53:48Z ppiqueras $
89
 * $Log$
90
 * Revision 1.42  2007-09-19 16:14:50  jaume
91
 * removed unnecessary imports
92
 *
93
 * Revision 1.41  2007/06/26 09:33:54  jorpiell
94
 * Information tab refreshed
95
 *
96
 * Revision 1.40  2007/04/11 12:08:55  ppiqueras
97
 * Varios cambios:
98
 * - Corregida etiqueta "Campo"
99
 * - Cambiada actualizaci?n
100
 * - Corregido bug: actualizar ?rea visible despu?s de pulsar "Aplicar" en la interfaz gr?fica.
101
 *
102
 * Revision 1.39  2007/03/15 13:33:44  ppiqueras
103
 * Corregido bug de excepci?n que se lanzaba cuando se filtraba y no se pod?a cargar la capa.
104
 *
105
 * Revision 1.38  2007/03/05 13:49:42  ppiqueras
106
 * Si una capa WFS no tiene campos (y por tanto no tiene un campo obligatorio de tipo geometr?a), que avise al usuario y no permita que se intente cargar dicha capa.
107
 *
108
 * Revision 1.37  2007/03/01 13:12:09  ppiqueras
109
 * Mejorado el filtrado por ?rea.
110
 *
111
 * Revision 1.36  2007/02/22 12:30:59  ppiqueras
112
 * - Eliminado m?todo que sobraba.
113
 * - Mejorada la relaci?n con el panel del ?rea.
114
 * - A?adido JOptionPanel de aviso que no se aplicar? ?rea porque es incorrecta.
115
 *
116
 * Revision 1.35  2007/02/20 11:31:11  ppiqueras
117
 * Eliminados comentarios que sobraban.
118
 *
119
 * Revision 1.34  2007/02/19 11:44:42  jorpiell
120
 * Aรฑadidos los filtros por รกrea
121
 *
122
 * Revision 1.33  2007/02/16 13:36:53  ppiqueras
123
 * Que el ?rea seleccionada en el panel WFSArea sea accesible una vez se va a aplicar.
124
 *
125
 * Revision 1.32  2007/02/12 11:37:00  ppiqueras
126
 * A?adidos comentarios y m?todo para refrescar el MapControl de la pesta?a del ?rea.
127
 *
128
 * Revision 1.31  2007/02/09 14:12:39  jorpiell
129
 * Soporte para WFS 1.1 y WFS-T
130
 *
131
 * Revision 1.30  2007/02/02 12:22:22  ppiqueras
132
 * Corregido alg?n bug.
133
 *
134
 * Revision 1.29  2007/01/08 09:37:39  ppiqueras
135
 * Eliminado comentario que sobraba
136
 *
137
 * Revision 1.28  2006/12/29 09:27:02  ppiqueras
138
 * Corregidos varios bugs:
139
 *
140
 * - Se ejecuta 2 veces "Aplicar" o "Aceptar" en los filtros WFS.
141
 * - Cuando se carga por primera vez una capa WFS, si se pone un
142
 * filtro incorrecto, se ignora el filtro (cargando toda la informaciรณn posible de la capa, y borrando el texto de filtrado).
143
 *
144
 * Revision 1.27  2006/12/26 09:19:40  ppiqueras
145
 * Cambiado "atttibutes" en todas las aparaciones en atributos, mรฉtodos, clases, paquetes o comentarios por "fields". (Sรณlo a aquellas que afectan a clases dentro del proyecto extWFS2).
146
 *
147
 * Revision 1.26  2006/12/20 14:22:06  ppiqueras
148
 * Aรฑadido comentario
149
 *
150
 * Revision 1.25  2006/12/15 13:59:36  ppiqueras
151
 * -Permite que se almacenen y/o recojan todos los campos y valores conocidos de la capa actual.
152
 *
153
 * -Ademรกs, control frentre a consultas de filtro errรณneas, (esto a medias aรบn).
154
 *
155
 * - Algรบn comentario mรกs.
156
 *
157
 * Revision 1.24  2006/12/12 10:24:45  ppiqueras
158
 * Nueva funcionalidad: Pulsando doble 'click' sobre una capa de un servidor, se carga (igual que antes), pero ademรกs se avanza a la siguiente pestaรฑa sin tener que pulsar el botรณn 'Siguiente'.
159
 *
160
 * Revision 1.23  2006/12/11 11:02:24  ppiqueras
161
 * Corregido bug -> que se mantenga la frase de filtrado
162
 *
163
 * Revision 1.22  2006/12/04 08:59:47  ppiqueras
164
 * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todavรญa no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
165
 *
166
 * Revision 1.21  2006/11/28 08:05:13  jorpiell
167
 * Se escribe la query en la pesta?a del filtro
168
 *
169
 * Revision 1.20  2006/11/14 13:45:49  ppiqueras
170
 * Aรฑadida pequeรฑa funcionalidad:
171
 * Cuando se pulsa el botรณn "Aplicar", (al seleccionar un nuevo filtro), si el รกrbol de campos posee alguno seleccionado, actualiza los valores (con los nuevos), asociados a รฉste campo seleccionado.
172
 *
173
 * Revision 1.19  2006/10/27 12:10:02  ppiqueras
174
 * Nueva funcionalidad
175
 *
176
 * Revision 1.16  2006/10/23 07:37:04  jorpiell
177
 * Ya funciona el filterEncoding
178
 *
179
 * Revision 1.14  2006/10/13 13:05:32  ppiqueras
180
 * Permite el refrescado de datos del panel de filtrado sobre capa WFS.
181
 *
182
 * Revision 1.13  2006/10/10 12:55:06  jorpiell
183
 * Se ha a?adido el soporte de features complejas
184
 *
185
 * Revision 1.12  2006/10/02 09:17:48  jorpiell
186
 * A?adido el setCRS a la capa
187
 *
188
 * Revision 1.11  2006/09/29 13:02:38  ppiqueras
189
 * Filtro para WFS. De momento sรณlo interfaz grรกfica.
190
 *
191
 * Revision 1.10  2006/07/21 11:50:31  jaume
192
 * improved appearance
193
 *
194
 * Revision 1.9  2006/06/21 12:35:45  jorpiell
195
 * Se ha a?adido la ventana de propiedades. Esto implica a?adir listeners por todos los paneles. Adem?s no se muestra la geomatr?a en la lista de atributos y se muestran ?nicamnete los que se van a descargar
196
 *
197
 * Revision 1.8  2006/06/15 07:50:58  jorpiell
198
 * A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz
199
 *
200
 * Revision 1.7  2006/05/25 16:22:47  jorpiell
201
 * Se limpia el panel cada vez que se conecta con un servidor distinto
202
 *
203
 * Revision 1.6  2006/05/25 16:01:43  jorpiell
204
 * Se ha a?adido la funcionalidad para eliminar el namespace de los tipos de atributos
205
 *
206
 * Revision 1.5  2006/05/25 10:31:06  jorpiell
207
 * Como ha cambiado la forma de mostrar las capas (una tabla, en lugar de una lista), los paneles han tenido que ser modificados
208
 *
209
 * Revision 1.4  2006/05/23 08:09:39  jorpiell
210
 * Se ha cambiado la forma en la que se leian los valores seleccionados en los paneles y se ha cambiado el comportamiento de los botones
211
 *
212
 * Revision 1.3  2006/05/19 12:57:08  jorpiell
213
 * Modificados algunos paneles
214
 *
215
 * Revision 1.2  2006/04/20 16:38:24  jorpiell
216
 * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
217
 *
218
 * Revision 1.1  2006/04/19 12:50:16  jorpiell
219
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
220
 *
221
 */
222

  
223
/**
224
 * <p>Container of the WFS panels, that works as a {@linkplain TabbedPanel TabbedPanel}.</p>
225
 *
226
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
227
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
228
 */
229
public class WFSParamsPanel extends TabbedPanel implements ILayerPanel {
230
	private static final long serialVersionUID = 150328995058481516L;
231

  
232
	private static Logger logger = LoggerFactory.getLogger(WFSParamsPanel.class);
233

  
234
	private WFSServerExplorer serverExplorer = null;
235
	private WFSSelectedFeatureManager selectedFeatureManager = null;
236

  
237
	private static final MapContextManager MAP_CONTEXT_MANAGER = MapContextLocator.getMapContextManager();
238

  
239
	// Tab positions
240
	private int infoTabPosition = -1;
241
	private int featureTabPosition = -1;
242
	private int fieldsTabPosition = -1;
243
	private int optionsTabPosition = -1;
244
	// private int filterTabPosition = -1;
245
	private int areaTabPosition = -1;
246

  
247
	// Tabs
248
	private WFSInfoPanel infoPanel = null;
249
	private WFSSelectFeaturePanel featurePanel = null;
250
	private WFSSelectFieldsPanel fieldsPanel = null;
251
	private WFSOptionsPanel optionsPanel = null;
252
	// private WFSFilterPanel filterPanel = null;
253
	private WFSAreaPanel areaPanel = null;
254

  
255
	private String cacheSelected = null;
256

  
257
	/**
258
	 * This method initializes jTabbedPane
259
	 *
260
	 * @return javax.swing.JTabbedPane
261
	 */
262
	public WFSParamsPanel(Object reference) {
263
		super(reference);
264
		initialize();
265
	}
266

  
267
	/*
268
	 * (non-Javadoc)
269
	 * @see org.gvsig.gui.beans.panelGroup.tabbedPanel.TabbedPanel#initialize()
270
	 */
271
	protected void initialize() {
272
		super.initialize();
273

  
274
		this.setVisible(false);
275
	}
276

  
277
	/**
278
	 * Sets the focus to the next tab of the current one.
279
	 */
280
	public void goToNextTab() {
281
		int tabIndex = getSelectedIndex();
282

  
283
		if ((tabIndex - 1) < getPanelInGUICount()) {
284
			int nextIndex = nextPageEnabled();
285

  
286
			if (nextIndex > -1)
287
				setSelectedIndex(nextIndex);
288
		}
289
	}
290

  
291
	/**
292
	 * Sets the focus to the tab previous to the current one.
293
	 */
294
	public void goToPreviousTab(){
295
		setSelectedIndex(previousEnabledPage());
296
	}
297

  
298
	/**
299
	 * @see JTabbedPane#getSelectedIndex()
300
	 */
301
	public int getSelectedIndex(){
302
		return this.getJTabbedPane().getSelectedIndex();
303
	}
304

  
305
	/**
306
	 * @see JTabbedPane#setSelectedIndex(int)
307
	 */
308
	public void setSelectedIndex(int index) {
309
		this.getJTabbedPane().setSelectedIndex(index);
310
	}
311

  
312
	/**
313
	 * This method initializes infoPanel
314
	 *
315
	 * @return the information panel
316
	 */
317
	public WFSInfoPanel getInfoPanel() {
318
		if (infoPanel != null)
319
			return infoPanel;
320

  
321
		if (infoTabPosition == -1)
322
			return null;
323

  
324
		return (infoPanel = (WFSInfoPanel) values().toArray()[infoTabPosition]);
325
	}
326

  
327
	/**
328
	 * This method initializes featurePanel
329
	 *
330
	 * @return javax.swing.JPanel
331
	 */
332
	public WFSSelectFeaturePanel getFeaturesPanel() {
333
		if (featurePanel != null)
334
			return featurePanel;
335

  
336
		if (featureTabPosition == -1)
337
			return null;
338

  
339
		return (featurePanel = (WFSSelectFeaturePanel) values().toArray()[featureTabPosition]);
340
	}
341

  
342
	/**
343
	 * This method initializes fieldsPanel
344
	 *
345
	 * @return javax.swing.JPanel
346
	 */
347
	public WFSSelectFieldsPanel getFieldsPanel() {
348
		if (fieldsPanel != null)
349
			return fieldsPanel;
350

  
351
		if (fieldsTabPosition == -1)
352
			return null;
353

  
354
		return (fieldsPanel = (WFSSelectFieldsPanel) values().toArray()[fieldsTabPosition]);
355
	}
356

  
357
	/**
358
	 * This method initializes optionsPanel
359
	 *
360
	 * @return javax.swing.JPanel
361
	 */
362
	public WFSOptionsPanel getOptionsPanel() {
363
		if (optionsPanel != null)
364
			return optionsPanel;
365

  
366
		if (optionsTabPosition == -1)
367
			return null;
368

  
369
		return (optionsPanel = (WFSOptionsPanel) values().toArray()[optionsTabPosition]);
370
	}
371

  
372
	/**
373
	 * This method initializes filterPanel
374
	 *
375
	 * @return javax.swing.JPanel
376
	 */
377

  
378
	/*
379
	public WFSFilterPanel getFilterPanel(){
380
		if (filterPanel != null)
381
			return filterPanel;
382

  
383
		if (filterTabPosition == -1)
384
			return null;
385

  
386
		return (filterPanel = (WFSFilterPanel) values().toArray()[filterTabPosition]);
387
	}
388
	*/
389

  
390
	/**
391
	 * This method initializes areaPanel
392
	 *
393
	 * @return javax.swing.JPanel
394
	 */
395
	public WFSAreaPanel getAreaPanel() {
396
		if (areaPanel != null)
397
			return areaPanel;
398

  
399
		if (areaTabPosition == -1)
400
			return null;
401

  
402
		return (areaPanel = (WFSAreaPanel) values().toArray()[areaTabPosition]);
403
	}
404

  
405
	/**
406
	 * Verifies that the selected parameters are enough to request
407
	 * the coverage to the server.
408
	 *
409
	 * @return boolean <code>true</code> if its correctly configured;
410
	 * otherwise returns <code>false</code>
411
	 */
412
	public boolean isCorretlyConfigured() {
413

  
414
	    if (featurePanel == null) {
415
	        return false;
416
	    }
417

  
418
	    int n_sel = featurePanel.getSelectedFeaturesCount();
419
	    return (n_sel > 0);
420
	}
421

  
422
	/**
423
	 * Enable or disable the default tabs
424
	 */
425
	public void enableDefaultTabs(boolean isEnabled) {
426
		if (fieldsTabPosition != -1)
427
			setEnabledAt(fieldsTabPosition, isEnabled);
428

  
429
		/*
430
		if (filterTabPosition != -1)
431
			setEnabledAt(filterTabPosition, isEnabled);
432
			*/
433

  
434
		if (areaTabPosition != -1)
435
			setEnabledAt(areaTabPosition, isEnabled);
436
	}
437

  
438
	/*
439
	 * (non-Javadoc)
440
	 * @see org.gvsig.gui.beans.panelGroup.tabbedPanel.TabbedPanel#loadPanel(org.gvsig.gui.beans.panelGroup.panels.IPanel)
441
	 */
442
	protected void loadPanel(IPanel panel) {
443
		super.loadPanel(panel);
444

  
445
		if (((AbstractPanel)panel).getClass() ==  WFSInfoPanel.class) {
446
			infoTabPosition = getPanelInGUICount() - 1;
447
			return;
448
		}
449

  
450
		if (((AbstractPanel)panel).getClass() ==  WFSSelectFeaturePanel.class) {
451
			featureTabPosition = getPanelInGUICount() - 1;
452
			return;
453
		}
454

  
455
		if (((AbstractPanel)panel).getClass() ==  WFSSelectFieldsPanel.class) {
456
			fieldsTabPosition = getPanelInGUICount() - 1;
457
			return;
458
		}
459

  
460
		if (((AbstractPanel)panel).getClass() ==  WFSOptionsPanel.class) {
461
			optionsTabPosition = getPanelInGUICount() - 1;
462
			return;
463
		}
464

  
465
		/*
466
		if (((AbstractPanel)panel).getClass() ==  WFSFilterPanel.class) {
467
			filterTabPosition = getPanelInGUICount() - 1;
468
			return;
469
		}
470
		*/
471

  
472
		if (((AbstractPanel)panel).getClass() ==  WFSAreaPanel.class) {
473
			areaTabPosition = getPanelInGUICount() - 1;
474
			return;
475
		}
476
	}
477

  
478
	/**
479
	 * Refresh all the panels with the WFS capabilities information.
480
	 */
481
	public void refreshCapabilitiesInfo(){
482
		WFSSelectedFeature selectedFeature = getFeaturesPanel().getSelectedFeature();
483
		if (selectedFeature != null) {
484
			selectedFeature.setSelectedFields(getFieldsPanel().getSelectedFields());
485
		} else {
486
			getFeaturesPanel().refresh(null);
487
		}
488
		serverExplorer.setUserName(getOptionsPanel().getUserName());
489
		serverExplorer.setMaxFeatures(getOptionsPanel().getBuffer());
490
		serverExplorer.setTimeOut(getOptionsPanel().getTimeout());
491

  
492
		getInfoPanel().refresh(selectedFeature);
493
	}
494

  
495
	/**
496
	 * Gets the information used to add or load a WFS layer.
497
	 *
498
	 * @return information used to add or load a WFS layer
499
	 */
500
	public WFSServerExplorer getServerExplorer() {
501
		return serverExplorer;
502
	}
503

  
504
	/**
505
	 * Sets the information used to add or load a WFS layer.
506
	 *
507
	 * @param wizardData information used to add or load a WFS layer
508
	 */
509
	public void setServerExplorer(WFSServerExplorer serverExplorer) {
510
		this.serverExplorer = serverExplorer;
511
		this.selectedFeatureManager =
512
			WFSSelectedFeatureManager.getInstance(serverExplorer);
513
	}
514

  
515
	/**
516
	 * Returns the next enabled tab's index, or -1 if there isn't any.
517
	 *
518
	 * @return The index or -1 if there is no one.
519
	 */
520
	public int nextPageEnabled() {
521
		int currentPage = getSelectedIndex();
522
		int nPages = getPanelInGUICount();
523

  
524
		if (currentPage == nPages)
525
			return -1;
526

  
527
		for (int i = currentPage + 1; i < nPages; i++){
528
			if (getJTabbedPane().isEnabledAt(i)){
529
				return i;
530
			}
531
		}
532

  
533
		return -1;
534
	}
535

  
536
	/**
537
	 * Returns the index of the current tab.
538
	 *
539
	 * @return index of the current tab
540
	 */
541
	public int currentPage() {
542
		return getSelectedIndex();
543
	}
544

  
545
	/**
546
	 * Returns the index of the previous enabled tab.
547
	 *
548
	 * @return The index, or -1 if there is no one.
549
	 */
550
	public int previousEnabledPage() {
551
		int currentPage = getSelectedIndex();
552

  
553
		if (currentPage == 0)
554
			return -1;
555

  
556
		for (int i = currentPage - 1; i > -1; i--) {
557
			if (isEnabledAt(i)) {
558
				return i;
559
			}
560
		}
561

  
562
		return -1;
563
	}
564

  
565
	/*
566
	 *  (non-Javadoc)
567
	 * @see com.iver.cit.gvsig.gui.WizardPanel#initWizard()
568
	 */
569
	public void initWizard() {
570

  
571
	}
572

  
573
	/*
574
	 *  (non-Javadoc)
575
	 * @see com.iver.cit.gvsig.gui.WizardPanel#execute()
576
	 */
577
	public void execute() {
578

  
579
	}
580

  
581
	/*
582
	 *  (non-Javadoc)
583
	 * @see com.iver.cit.gvsig.gui.ILayerPanel#getLayer()
584
	 */
585
	public FLayer getLayer() {
586
	    try {
587
	        FLayer layer = (FLyrVect) createLayer();
588
	        logger.warn("El flujo de la apliaci?n tal vez no deber?a haber pasado por aqu?.");
589
	        return layer;
590
	    } catch (CreateLayerException e) {
591
	        // do nothing
592
	    }
593
	    return null;
594
	}
595

  
596
	public FLayer createLayer() throws CreateLayerException {
597
		try {
598
		    FLyrVect layerAux =
599
		        (FLyrVect)MAP_CONTEXT_MANAGER.createLayer(getFeaturesPanel().getLayerName(), getDataStoreParameters());
600

  
601
			if((cacheSelected != null) && (!this.cacheSelected.equals(PluginServices.getText(this, "none")))){
602
				layerAux.getFeatureStore().createCache(cacheSelected, getParameters(cacheSelected));
603
			}
604
			return layerAux;
605
		} catch (Exception e) {
606
			logger.warn("Can't create layer.",e);
607
			throw new CreateLayerException(getFeaturesPanel().getLayerName(), e);
608
		}
609

  
610
	}
611

  
612

  
613
	 protected DynObject getParameters(String nameCacheProvider) throws DataException {
614
		 DataManager dataManager = DALLocator.getDataManager();
615
		 return dataManager.createCacheParameters(nameCacheProvider);
616
	 }
617

  
618
	public WFSStoreParameters getDataStoreParameters() throws InitializeException, ProviderNotRegisteredException{
619
		DataManager dataManager = DALLocator.getDataManager();
620
		WFSStoreParameters parameters = (WFSStoreParameters) dataManager
621
		.createStoreParameters(WFSStoreProvider.NAME);
622
		refreshDataStoreParameters(parameters);
623
		return parameters;
624
	}
625

  
626
	private void refreshDataStoreParameters(WFSStoreParameters parameters){
627
		WFSSelectedFeature selectedFeature = getSelectedFeature();
628
		parameters.setUrl(serverExplorer.getUrl());
629
		parameters.setFeatureType(selectedFeature.getNameSpace(),
630
				selectedFeature.getName());
631
		parameters.setFields(getFieldsPanel().getSelectedFieldsAsString());
632
		parameters.setUser(getOptionsPanel().getUserName());
633
		parameters.setPassword(getOptionsPanel().getPassword());
634
		parameters.setMaxFeatures(getOptionsPanel().getBuffer());
635
		parameters.setTimeOut(getOptionsPanel().getTimeout());
636

  
637
		boolean useAxisOrderYX = getOptionsPanel().getUseAxisOrderYX();
638
		parameters.setUseAxisOrderYX(useAxisOrderYX);
639

  
640
		// MapServer no funciona con filtros por intersecci?n de pol?gonos
641

  
642
//		parameters.setFilterByAreaGeometry(getAreaPanel().getArea());
643
		Geometry area = getAreaPanel().getArea();
644
		if (area != null) {
645

  
646
			Envelope envelope = area.getEnvelope();
647
			parameters.setFilterByAreaEnvelope(envelope);
648
		}
649
		parameters.setFilterByAreaCrs(getAreaPanel().getSrs());
650

  
651
		XMLNameSpace ns = selectedFeature.getWFSFeature().getNamespace();
652
		if (ns != null) {
653
	        String ns_pre = ns.getPrefix();
654
	        parameters.setDynValue(
655
	            WFSStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX, ns_pre);
656
		}
657
		// serverExplorer.getServerExplorerProviderServices();
658

  
659
		parameters.setVersion(getOptionsPanel().getVersion());
660

  
661
		parameters.setFilterByAreaOperation(FilterEncoding.GEOMETRIC_OPERATOR_CONTAINS); //(int)AbstractFilter.GEOMETRY_INTERSECTS);
662
		parameters.setFilterByAreaAttribute(selectedFeature.getGeometryField().getName());
663
		parameters.setCrs(getOptionsPanel().getSRS());
664

  
665
		// parameters.setFilterEncodingByAttribute(getFilterPanel().getQuery());
666
	}
667

  
668
    /**
669
     * Sets the forms from a
670
     */
671
    public void setDataStore(DataStore dataStore){
672
        WFSStoreParameters storeParameters =
673
            (WFSStoreParameters)dataStore.getParameters();
674
        WFSSelectedFeature selectedFeature =
675
            selectedFeatureManager.getFeatureInfo(storeParameters.getFeatureNamespace(),
676
                storeParameters.getFeatureType());
677
        getFeaturesPanel().setSelectedFeature(selectedFeature);
678
        getFieldsPanel().setSelectedFields(storeParameters.getFields());
679
        getOptionsPanel().setUserName(storeParameters.getUser());
680
        getOptionsPanel().setPassword(storeParameters.getPassword());
681
        getOptionsPanel().setBuffer(storeParameters.getMaxFeatures());
682
        getOptionsPanel().setTimeOut(storeParameters.getTimeOut());
683
        getAreaPanel().setArea(storeParameters.getFilterByAreaGeometry());
684
        getAreaPanel().setSrs(storeParameters.getFilterByAreaCrs());
685

  
686
        getOptionsPanel().setSRS(storeParameters.getCrs());
687
        getOptionsPanel().setVersion(storeParameters.getVersion());
688

  
689
        // getFilterPanel().setFilterExpressionIntoInterface(storeParameters.getFilterEncodingByAttribute());
690

  
691
        //The filter panel needs to store to update the attributes list
692
        // getFilterPanel().setDataStore(dataStore);
693
    }
694

  
695
    /**
696
     * Gets the node of the layer selected as a feature, with the selected fields and the filter defined.
697
     *
698
     * @return gets the node of the layer selected as a feature, with the selected fields and the filter defined
699
     */
700
    private WFSSelectedFeature getSelectedFeature(){
701
        WFSSelectedFeature selectedFeature = getFeaturesPanel().getSelectedFeature();
702
        selectedFeature.setSelectedFields(getFieldsPanel().getSelectedFields());
703
        // selectedFeature.setFilter(getFilterPanel().getQuery());
704
        return selectedFeature;
705
    }
706

  
707
	/**
708
	 * @see WFSWizard#doClickOnNextButton()
709
	 */
710
	public void doClickOnNextButton() {
711
		Object obj = this.getParent();
712

  
713
		if (obj == null)
714
			return;
715

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff