Revision 1459

View differences:

org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/prepare-workspace.xml
1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2

  
3
	<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" />
4

  
5
	<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." />
6
	<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" />
7
	<property name="build.jar.version" value="1.0.8-SNAPSHOT" />
8
	<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
9

  
10
	<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" />
11

  
12
	<target name="check-maven-base-build-available">
13
		<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" />
14
	</target>
15

  
16
	<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available">
17
		<!-- Unzip de build jar file from the maven repository into the workspace root folder -->
18
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
19
			<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}">
20
				<patternset>
21
					<exclude name="META-INF/**" />
22
				</patternset>
23
			</zipfileset>
24
		</copy>
25
	</target>
26

  
27
	<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available">
28
		<mkdir dir="target" />
29

  
30
		<!-- Download the build jar file -->
31
		<get src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" />
32

  
33
		<!-- Unzip de build jar file into the workspace root folder -->
34
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
35
			<zipfileset src="target/${build.jar.file}">
36
				<patternset>
37
					<exclude name="META-INF/**" />
38
				</patternset>
39
			</zipfileset>
40
		</copy>
41

  
42
	</target>
43
	
44
	<target name="find.depends.natives.file">
45
	    <condition property="depends.natives.file.exists">
46
            <available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/>
47
	    </condition>	
48
	</target>
49
	
50
	<target name="find.gvsig.platform.properties.file" 
51
			depends="find.depends.natives.file"
52
			if="depends.natives.file.exists">
53
	    <condition property="gvsig.platform.exists">
54
            <available file="${user.home}/.gvsig.platform.properties"/>
55
	    </condition>	
56
	</target>
57
	
58
	<target name="check.gvsig.platform.properties" 
59
			depends="find.gvsig.platform.properties.file">
60
		<fail if="depends.natives.file.exists" unless="gvsig.platform.exists">
61
ERROR!!
62
	
63
You have to define your gvSIG platform properties, 
64
by creating the file: ${user.home}/.gvsig.platform.properties
65
with the following content:
66

  
67
native_platform=linux
68
native_distribution=all
69
native_compiler=gcc4
70
native_arch=i386
71
native_libraryType=dynamic
72
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType}
73

  
74
Replace the fifth initial variables values with the ones appropiate 
75
to your platform.
76
	
77
If you use maven in the command line, you can use the previous file also
78
to define the MAVEN_OPTS environment variable, by adding to your 
79
.bash_rc file something like this:
80

  
81
if [ -f "${HOME}/.gvsig.platform.properties" ]
82
then
83
    . ${HOME}/.gvsig.platform.properties
84
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}"
85
else
86
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m"
87
fi
88

  
89
It will work if you use the bash shell. In any other case or platform, you'll
90
have to define your MAVEN_OPTS environment variable and set the 
91
"native-classifier" parameter directly.
92
		</fail>			
93
	
94
	</target>
95

  
96
	<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties">
97

  
98
		<mkdir dir="target" />
99

  
100
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" />
101

  
102
		<!-- Copy the maven launchers to the workspace metadata folder -->
103
		<copy todir="${workspace.basedir}/.metadata">
104
			<fileset dir="${build.basedir}/eclipse-launchers">
105
				<exclude name="**/org.eclipse.jdt.core.prefs" />
106
				<exclude name="**/org.eclipse.core.variables.prefs" />
107
			</fileset>
108
		</copy>
109

  
110
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true">
111
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" />
112
		</concat>
113
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true">
114
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" />
115
		</concat>
116

  
117
		<!-- Configure the eclipse workspace -->
118
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" />
119

  
120
		<!-- Configure the gvSIG profile -->
121
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" />
122

  
123
		<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" />
124

  
125
		<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
126
			<classpath>
127
				<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" />
128
			</classpath>
129
		</taskdef>
130

  
131
		<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}">
132
			<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" />
133
		</xmltask>
134

  
135
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
136
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
137

  
138
		<!-- Compile, install and generate eclipse projects -->
139
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
140

  
141
		<echo>INFORMATION!!!</echo>
142
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
143

  
144
		<!-- TODO: copiar al proyecto de configuración general -->
145
	</target>
146

  
147
	<target name="clean">
148
		<delete dir="target" />
149
	</target>
150
	
151
</project>
0 152

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/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.wmts</artifactId>
5
	<packaging>pom</packaging>
6
	<version>2.0.0-SNAPSHOT</version>
7
	<name>org.gvsig.raster.wmts</name>
8
	<description>WMTS client</description>
9
	<inceptionYear>2011</inceptionYear>
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>gvsig-base-pom</artifactId>
13
        <version>2.0-SNAPSHOT</version>
14
    </parent>
15
     <dependencyManagement>
16
        <dependencies>
17
            <dependency>
18
                <groupId>org.gvsig</groupId>
19
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
20
                <version>2.0.1-SNAPSHOT</version>
21
                <type>pom</type>
22
                <scope>import</scope>
23
            </dependency>
24
        </dependencies>
25
    </dependencyManagement>
26
    <developers>
27
		<developer>
28
			<id>nbrodin</id>
29
			<name>Nacho Brodin</name>
30
			<email>nachobrodin@gmail.com</email>
31
			<roles>
32
				<role>Architect</role>
33
				<role>Developer</role>
34
			</roles>
35
		</developer>
36
	</developers>
37
	<properties>
38
		<build-dir>${basedir}/../..</build-dir>
39
	</properties>
40
	<modules>
41
		<!--<module>org.gvsig.raster.wmts.swing</module>-->
42
		<module>org.gvsig.raster.wmts.io</module>
43
		<module>org.gvsig.raster.wmts.app</module>
44
	</modules>
45
</project>
0 46

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/distribution/distribution.xml
1
<assembly>
2
</assembly>
0 3

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Mon Jun 25 09:20:51 CEST 2012
3
buildNumber=2
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/dialog/TestPropsDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.dialog;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.dialog.WMTSPropsDialog;
24

  
25
public class TestPropsDialog {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private WMTSPropsDialog   desc     = null;
30

  
31
	public TestPropsDialog() {
32
		desc = new WMTSPropsDialog();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestPropsDialog();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/format/TestFormatsPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.format;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.format.IFormatsPanel;
24

  
25
public class TestFormatsPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private IFormatsPanel      desc     = null;
30

  
31
	public TestFormatsPanel() {
32
		desc = new IFormatsPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestFormatsPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestAddDelPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.AddDelLayerPanel;
24

  
25
public class TestAddDelPanel {
26
	private int               w        = 510;
27
	private int               h        = 110;
28
	private JFrame            frame    = new JFrame();
29
	private AddDelLayerPanel  desc     = null;
30

  
31
	public TestAddDelPanel() {
32
		desc = new AddDelLayerPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestAddDelPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestILayerPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.ILayerPanel;
24

  
25
public class TestILayerPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private ILayerPanel       desc     = null;
30

  
31
	public TestILayerPanel() {
32
		desc = new ILayerPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestILayerPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestLayerListPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.LayersSelectedPanel;
24

  
25
public class TestLayerListPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private LayersSelectedPanel    desc     = null;
30

  
31
	public TestLayerListPanel() {
32
		desc = new LayersSelectedPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestLayerListPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/TestStylesPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel;
20

  
21
import javax.swing.JFrame;
22
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.StylesPanel;
23

  
24
public class TestStylesPanel {
25
	private int               w        = 510;
26
	private int               h        = 610;
27
	private JFrame            frame    = new JFrame();
28
	private StylesPanel       desc     = null;
29

  
30
	public TestStylesPanel() {
31
		desc = new StylesPanel();
32
		frame.getContentPane().add(desc);
33
		frame.setSize(w, h);
34
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
35
		frame.setVisible(true);
36
	}
37
 
38
	public static void main(String[] args) {
39
		new TestStylesPanel();
40
	}
41
}
0 42

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestDescriptionPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.DescriptionPanel;
24

  
25
public class TestDescriptionPanel {
26
	private int               w        = 510;
27
	private int               h        = 510;
28
	private JFrame            frame    = new JFrame();
29
	private DescriptionPanel  desc     = null;
30

  
31
	public TestDescriptionPanel() {
32
		desc = new DescriptionPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestDescriptionPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestServerPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.IServerPanel;
24

  
25
public class TestServerPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private IServerPanel       desc     = null;
30

  
31
	public TestServerPanel() {
32
		desc = new IServerPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestServerPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestConnectPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.ConnectPanel;
24

  
25
public class TestConnectPanel {
26
	private int               w        = 510;
27
	private int               h        = 90;
28
	private JFrame            frame    = new JFrame();
29
	private ConnectPanel      connect  = null;
30

  
31
	public TestConnectPanel() {
32
		connect = new ConnectPanel();
33
		frame.getContentPane().add(connect);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestConnectPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestNextPrevPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.NextPrevPanel;
24

  
25
public class TestNextPrevPanel {
26
	private int               w        = 510;
27
	private int               h        = 100;
28
	private JFrame            frame    = new JFrame();
29
	private NextPrevPanel     desc     = null;
30

  
31
	public TestNextPrevPanel() {
32
		desc = new NextPrevPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestNextPrevPanel();
41
	}
42
}
0 43

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

  
24
import java.net.MalformedURLException;
25
import java.net.URL;
26

  
27
import org.gvsig.fmap.dal.exception.InitializeException;
28
import org.gvsig.remoteclient.wmts.exception.WMTSException;
29
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification;
30
import org.gvsig.remoteclient.wmts.struct.WMTSServiceProvider;
31
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
32

  
33
/**
34
 * @author Nacho Brodin (nachobrodin@gmail.com)
35
 */
36
public class TestWMTSDriver extends AbstractLibraryAutoInitTestCase {
37
	
38
	protected void doSetUp() throws Exception {
39
		System.err.println("TestWMTSDriver running...");
40
	}
41
	
42
	public void testStack() {
43
		
44
		URL url = null;
45
		try {
46
			url = new URL("http://scolab.es:9090/geoserver/gwc/service/wmts");
47
			
48
			//Crea el manejador para la versi?n del servidor y devuelve la versi?n 
49
			//WMTSConnector conn = WMTSDriver.getConnectorFromURL(url);
50
			//String version = conn.getVersion();
51
			
52
			//Creamos un explorer para obtener los datos del servidor
53
			WMTSServerExplorerParameters.registerDynClass();
54
			WMTSServerExplorerParameters param = new WMTSServerExplorerParameters();
55
			param.setHost(url.toString());
56
			WMTSServerExplorer explorer = new WMTSServerExplorer(param, null);
57
			explorer.connect(null);
58
			
59
			WMTSServiceIdentification id = explorer.getServiceIdentification();
60
			String title = id.getTitle();
61
			String version = id.getServiceTypeVersion();
62
			String type = id.getServiceType();
63
			
64
			WMTSServiceProvider prov = explorer.getServiceProvider();
65
			String pN = prov.getProviderName();
66
			String pS = prov.getProviderSite();
67
			String pC = prov.getServiceContact();
68
			
69
			//WMTSThemes themes = explorer.getThemes();
70
			System.out.println("Title: " + title);
71
			System.out.println("Version: " + version);
72
			System.out.println("Type: " + type);
73
			System.out.println("Provider Name: " + pN);
74
			System.out.println("Provider Site: " + pS);
75
			System.out.println("Service Contact: " + pC);
76
			
77
			//En este caso solo hay una lista de temas con una capa por cada uno
78
			//pero en un caso corriente seria un ?rbol de themas con una capa asociada a cada uno
79
			/*for (int i = 0; i < themes.size(); i++) {
80
				WMTSLayer layer = ((WMTSTheme)themes.get(i)).getLayer();
81
				if(layer != null)
82
					layer.print();
83
			}*/
84
			
85
		} catch (MalformedURLException e) {
86
			e.printStackTrace();
87
		} catch (InitializeException e) {
88
			e.printStackTrace();
89
		} catch (WMTSException e) {
90
			e.printStackTrace();
91
		}
92
		
93
	}
94
}
0 95

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/dialog/WMTSPropsDialog.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.wmts.app.wmtsclient.gui.dialog;
24

  
25
import java.awt.BorderLayout;
26
import java.awt.event.ActionEvent;
27
import java.awt.event.ActionListener;
28
import java.util.HashMap;
29

  
30
import javax.swing.JOptionPane;
31
import javax.swing.JPanel;
32

  
33
import org.gvsig.andami.PluginServices;
34
import org.gvsig.andami.ui.mdiManager.IWindow;
35
import org.gvsig.andami.ui.mdiManager.WindowInfo;
36
import org.gvsig.app.gui.wizards.WizardListener;
37
import org.gvsig.fmap.mapcontext.MapContext;
38
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
39
import org.gvsig.fmap.mapcontext.layers.FLayer;
40
import org.gvsig.fmap.mapcontext.layers.FLayers;
41
import org.gvsig.fmap.mapcontrol.MapControl;
42
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
43
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
44
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
45
import org.gvsig.raster.tools.app.basic.RasterToolsUtil;
46
import org.gvsig.raster.util.CancelTaskImpl;
47
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSGUIInterface;
48
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSParamsPanel;
49
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS;
50
import org.gvsig.raster.wmts.io.WMTSServerExplorer;
51
import org.gvsig.remoteclient.wmts.exception.WMTSException;
52

  
53

  
54
/**
55
 * The TOC WMTS properties panel container.
56
 *
57
 * @author Nacho Brodin (nachobrodin@gmail.com)
58
 */
59
public class WMTSPropsDialog extends JPanel implements IWindow, ButtonsPanelListener {
60
	private static final long         serialVersionUID      = 1L;
61
	private FLyrWMTS                  fLayer                = null;
62
	private WindowInfo                m_ViewInfo            = null;
63
	private ButtonsPanel              buttonsPanel          = null;   
64
	private WMTSGUIInterface          wmtsGUIInterface      = null;
65
    private WMTSServerExplorer        explorer              = null;
66

  
67
    public WMTSPropsDialog() {
68
    	initialize(null);
69
    }
70
    
71
    public WMTSPropsDialog(FLayer layer) {
72
		super();
73
		if(layer instanceof FLyrWMTS) {
74
			fLayer = (FLyrWMTS)layer;
75
			initialize(fLayer);
76
		}
77
	}
78

  
79
	private void initialize(FLyrWMTS layer) {
80
		HashMap<String, Object> hash = layer != null ? layer.getProperties() : null;
81
		wmtsGUIInterface = getParamsPanel(hash);
82
		wmtsGUIInterface.addWizardListener(new WizardListener(){
83
			@SuppressWarnings("deprecation")
84
			public void wizardStateChanged(boolean finishable) {
85
				getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(finishable);
86
				getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(finishable);
87
			}
88

  
89
			public void error(Exception e) {
90
			}
91

  
92
        });
93
		setLayout(new BorderLayout());
94
        this.add(wmtsGUIInterface.getComponent(), BorderLayout.CENTER);
95
        this.add(getButtonsPanel(), BorderLayout.SOUTH);
96
	}
97
	
98
	/**
99
	 * Gets the buttons panel
100
	 * @return
101
	 */
102
	public ButtonsPanel getButtonsPanel() {
103
		if(buttonsPanel == null) {
104
			buttonsPanel = new ButtonsPanel();
105
			buttonsPanel.addApply();
106
			buttonsPanel.addAccept();
107
			buttonsPanel.addClose();
108
			buttonsPanel.addButtonPressedListener(this);
109
		}
110
		return buttonsPanel;
111
	}
112

  
113
	/**
114
	 * With getParamsPanel we have access to the map config TabbedPane.
115
	 * If this panel doesn't exist yet (which can occur when an existing project is
116
	 * recovered) it is been automatically constructed by connecting to the server,
117
	 * reloading the necessary data, filling up the content and setting the selected
118
	 * values that were selected when the projet was saved.
119
	 *
120
	 *
121
	 * Since a connection to the server is needed when rebuiliding the panel, this
122
	 * causes a delay for the panel's showing up or a nullPointer error if there is
123
	 * no path to the server.
124
	 *
125
	 *
126
	 * Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n
127
	 * del mapa. Si este panel todav?a no existe (como puede ser cuando
128
	 * recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando
129
	 * al servidor, recuperando los datos necesarios, rellenando el contenido y
130
	 * dejando seleccionados los valores que estaban seleccionados cuando se
131
	 * guarda el proyecto.
132
	 *
133
	 *
134
	 * Como para reconstruirse requiere una conexi?n con el servidor esto causa
135
	 * un retardo en la aparici?n en el toc o un error de nullPointer si no
136
	 * hay conexi?n hasta el servidor.
137
	 *
138
	 *
139
	 * @return WMSParamsPanel
140
	 */
141
	public WMTSGUIInterface getParamsPanel(HashMap<String, Object> info) {
142
		if (info == null) {
143
			WMTSGUIInterface toc = new WMTSParamsPanel();
144
			return toc;
145
		}
146

  
147
		try {
148
			if(explorer == null) {
149
				explorer = ((FLyrWMTS)fLayer).getExplorer();
150

  
151
				try {
152
					explorer.connect(new CancelTaskImpl());
153
				} catch (WMTSException e) {
154
					RasterToolsUtil.messageBoxError("The connection cannot be established", this, e);
155
					return null;
156
				} 
157
			}
158
		} catch (Exception e) {
159
			explorer = null;
160
			JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE);
161
		}
162
		
163
		try {
164
			WMTSGUIInterface toc = new WMTSParamsPanel();
165
			((WMTSParamsPanel)toc).setWizardData(explorer);
166
			toc.updateSelectedInfo(info);
167
			return toc;
168
		} catch (Exception e) {
169
			JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE);
170
		}
171

  
172
		return null;
173
	}
174

  
175
    @SuppressWarnings("unused")
176
	private class CommandListener implements ActionListener {
177

  
178
        /**
179
         * Creates a new ComandosListener object.
180
         *
181
         * @param lg DOCUMENT ME!
182
         */
183
        public CommandListener(WMTSPropsDialog tp) {
184
        }
185

  
186
		/* (non-Javadoc)
187
		 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
188
		 */
189
        public void actionPerformed(ActionEvent e) {
190
        	if (e.getActionCommand() == "CANCEL") {
191
        		close();
192
        	} else {
193
   				MapControl mapCtrl = null;
194

  
195
				IWindow[] w = PluginServices.getMDIManager().getAllWindows();
196
				for (int i = 0; i < w.length; i++) {
197
					if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) {
198
						MapContext mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext();
199
						if(mapContext == fLayer.getMapContext())
200
							mapCtrl = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl();
201
					}
202
				}
203
				
204
        		try {
205
        			FLayer[] layerList = wmtsGUIInterface.getLayers();
206
        			removeDuplicate(layerList, mapCtrl);
207
        			for (int i = 0; i < layerList.length; i++) {
208
        				mapCtrl.getMapContext().getLayers().addLayer(layerList[i]);
209
        			}
210
        			mapCtrl.getMapContext().invalidate();
211
        		} catch (LoadLayerException exc) {
212
        			exc.printStackTrace();
213
        		}
214
        	}
215
		}
216
    }
217
    
218
    private void removeDuplicate(FLayer[] layerList, MapControl mapCtrl) {
219
    	FLayers lyrs = mapCtrl.getMapContext().getLayers();
220
    	for (int i = 0; i < lyrs.getLayersCount(); i++) {
221
			FLayer lyr = lyrs.getLayer(i);
222
			for (int j = 0; j < layerList.length; j++) {
223
				if(lyr.getName().compareTo(layerList[j].getName()) == 0) {
224
					lyrs.removeLayer(lyr);
225
				}
226
			}
227
		}
228
    }
229
    
230
    
231
	public WindowInfo getWindowInfo() {
232
		if (m_ViewInfo == null) {
233
			m_ViewInfo = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
234
			m_ViewInfo.setTitle(PluginServices.getText(this,"fit_WMTS_layer"));
235
	        m_ViewInfo.setWidth(500);
236
	        m_ViewInfo.setHeight(500);
237
		}
238
		return m_ViewInfo;
239
	}
240

  
241
	public void close() {
242
		PluginServices.getMDIManager().closeWindow(this);
243
	}
244

  
245
	public Object getWindowProfile() {
246
		return WindowInfo.DIALOG_PROFILE;
247
	}
248

  
249
	public void actionButtonPressed(ButtonsPanelEvent e) {
250
		if(	e.getButton() == ButtonsPanel.BUTTON_APPLY || 
251
			e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
252
			MapControl mapCtrl = null;
253

  
254
			IWindow[] w = PluginServices.getMDIManager().getAllWindows();
255
			for (int i = 0; i < w.length; i++) {
256
				if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) {
257
					MapContext mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext();
258
					if(mapContext == fLayer.getMapContext())
259
						mapCtrl = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl();
260
				}
261
			}
262
			
263
    		try {
264
    			FLayer[] layerList = wmtsGUIInterface.getLayers();
265
    			if(layerList.length > 0 && layerList[0] != null) {
266
    				if(layerList[0] instanceof FLyrWMTS) {
267
    					mapCtrl.getMapContext().getLayers().removeLayer(fLayer);
268
    					mapCtrl.getMapContext().getLayers().addLayer(layerList[0]);
269
    					fLayer = (FLyrWMTS)layerList[0];
270
    				}
271
    			}
272
    			//removeDuplicate(layerList, mapCtrl);
273
    			mapCtrl.getMapContext().invalidate();
274
    		} catch (LoadLayerException exc) {
275
    			exc.printStackTrace();
276
    		}
277
		}
278
		
279
		if(	e.getButton() == ButtonsPanel.BUTTON_CLOSE ||
280
			e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
281
			close();
282
		}
283
	}
284

  
285
}  //  @jve:decl-index=0:visual-constraint="10,10"
0 286

  
org.gvsig.raster.wmts/tags/buildNumber_29/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/panel/WMTSParamsPanel.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.wmts.app.wmtsclient.gui.panel;
24

  
25
import java.awt.BorderLayout;
26
import java.awt.event.ActionEvent;
27
import java.awt.event.ActionListener;
28
import java.awt.event.FocusAdapter;
29
import java.awt.event.FocusEvent;
30
import java.awt.event.FocusListener;
31
import java.awt.event.ItemEvent;
32
import java.awt.event.ItemListener;
33
import java.awt.event.KeyEvent;
34
import java.awt.event.KeyListener;
35
import java.awt.event.MouseEvent;
36
import java.awt.event.MouseListener;
37
import java.util.ArrayList;
38
import java.util.HashMap;
39
import java.util.Vector;
40
import java.util.prefs.Preferences;
41

  
42
import javax.swing.JComponent;
43
import javax.swing.JList;
44
import javax.swing.JTabbedPane;
45
import javax.swing.ListModel;
46
import javax.swing.event.ListSelectionEvent;
47
import javax.swing.event.ListSelectionListener;
48
import javax.swing.event.TreeSelectionEvent;
49
import javax.swing.event.TreeSelectionListener;
50
import javax.swing.tree.TreePath;
51

  
52
import org.gvsig.andami.PluginServices;
53
import org.gvsig.app.gui.WizardPanel;
54
import org.gvsig.app.gui.wizards.WizardListenerSupport;
55
import org.gvsig.fmap.dal.DataParameters;
56
import org.gvsig.fmap.dal.DataStoreParameters;
57
import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters;
58
import org.gvsig.fmap.dal.exception.InitializeException;
59
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
60
import org.gvsig.gui.beans.controls.dnd.JDnDListModel;
61
import org.gvsig.gui.beans.listeners.BeanListener;
62
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.format.IFormatsPanel;
63
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.ILayerPanel;
64
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.LayerList;
65
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.LayerTree;
66
import org.gvsig.raster.wmts.app.wmtsclient.gui.wizard.LayerTreeModel;
67
import org.gvsig.raster.wmts.app.wmtsclient.gui.wizard.WMTSParametersListModel;
68
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS;
69
import org.gvsig.raster.wmts.io.WMTSDataParameters;
70
import org.gvsig.raster.wmts.io.WMTSServerExplorer;
71
import org.gvsig.remoteclient.wmts.struct.WMTSStyle;
72
import org.gvsig.remoteclient.wmts.struct.WMTSTheme;
73

  
74

  
75
/**
76
 * This class implements the map option panel.
77
 *
78
 * It includes a set of Listeners that implement some control rules which
79
 * refresh the component values that depends on those selected in the other
80
 * components to avoid to choose an invalid set of options. It also includes a
81
 * method (isCorrectlyConfigured()) that checks if the current set of values is
82
 * enough to correctly launch a GetMap request.
83
 *
84
 * The information is obtained from a WMTSWizardDataSource object.
85
 *
86
 * @author Nacho Brodin (nachobrodin@gmail.com)
87
 */
88
@SuppressWarnings("unchecked")
89
public class WMTSParamsPanel extends WizardPanel 
90
	implements WMTSGUIInterface, ActionListener, ItemListener, KeyListener, ListSelectionListener, MouseListener, TreeSelectionListener {
91
	private static final long      serialVersionUID           = 1L;
92
	
93
	private InfoPanel              tabInfo                    = null;
94
	private ILayerPanel            layerPanel                 = null;
95
	private StylesPanel            tabStyle                   = null;
96
	private IFormatsPanel          formatsPanel               = null;
97
	
98
	private ArrayList<TreePath>    selectedPaths              = new ArrayList<TreePath>();
99
	private WizardListenerSupport  listenerSupport            = null;
100
	private JTabbedPane            jTabbedPane                = null;
101
	private int                    dimensionTabIndex;
102
	private int                    stylesTabIndex;
103
	protected WMTSServerExplorer   explorer                   = null;
104
	public static Preferences      fPrefs                     = Preferences.userRoot().node("gvsig.wmts-wizard");
105
	private boolean                deleteCache                = false;
106

  
107
	/**
108
	 * Layer to add to the selected layers box 
109
	 * @author Nacho Brodin (nachobrodin@gmail.com)
110
	 */
111
	class LayerUI {
112
		public WMTSTheme       theme                = null;
113
		public int             imageFormatSelected  = 0;
114
		public int             infoFormatSelected   = 0;
115
		public int             srsFormatSelected    = 0;
116
		public WMTSStyle       styleSelected        = null;
117
		
118
		public LayerUI(WMTSTheme theme) {
119
			this.theme = theme;
120
		}
121
		
122
		public String toString() {
123
			return theme.toString();
124
		}
125
	}
126
	
127
	/*
128
	 * (non-Javadoc)
129
	 * @see org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSGUIInterface#getComponent()
130
	 */
131
	public JComponent getComponent() {
132
		return this;
133
	}
134
	
135
	public WMTSParamsPanel() {
136
		super();
137
		initialize();
138
	}
139

  
140
	// TODO: crear nuevo constructor para a?adir los panels que quieras...
141
	public WMTSParamsPanel(WMTSServerExplorer data) {
142
		super();
143
		setWizardData(data);
144
		this.setLayout(null);
145
		this.setVisible(false);
146
		if (jTabbedPane == null) {
147
			jTabbedPane = new JTabbedPane();
148
			jTabbedPane.setBounds(4, 4, 502, 415);
149
			StylesPanel sp = getTabStyle();
150

  
151
			jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getLayerPanel(), null);
152
			jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null);
153
			stylesTabIndex = jTabbedPane.getTabCount() - 1;
154
			dimensionTabIndex = jTabbedPane.getTabCount() - 1;
155
			jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getJPanelFormatsAndSrs(), null);
156
			jTabbedPane.setEnabledAt(dimensionTabIndex, false);
157
			jTabbedPane.setEnabledAt(stylesTabIndex, false);
158
		}
159
		this.add(jTabbedPane, null);
160

  
161
		setListenerSupport(new WizardListenerSupport());
162
	}
163

  
164
	/**
165
	 * This method initializes panelPage2
166
	 *
167
	 * @return Panel
168
	 */
169
	private void initialize() {
170
		this.setLayout(new BorderLayout());
171
		this.setVisible(false);
172
		this.add(getJTabbedPane(), BorderLayout.CENTER);
173
	}
174
	
175
	/**
176
	 * This method initializes the main panel with tabs
177
	 *
178
	 * @return JTabbedPane
179
	 */
180
	public JTabbedPane getJTabbedPane() {
181
		if (jTabbedPane == null) {
182
			jTabbedPane = new JTabbedPane();
183
			jTabbedPane.setBounds(4, 4, 502, 415);
184
			InfoPanel ip = getTabInfo();
185
			ip.addFocusListener(new FocusListener() {
186
				public void focusGained(FocusEvent e) {
187
					refreshInfo();
188
				}
189

  
190
				public void focusLost(FocusEvent e) {
191
				}
192
			});
193

  
194
			jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, null);
195
			jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getLayerPanel(), null);
196
			jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, getTabStyle(), null);
197
			stylesTabIndex = jTabbedPane.getTabCount() - 1;
198
			jTabbedPane.addTab(PluginServices.getText(this, "formatos"), null, getJPanelFormatsAndSrs(), null);
199
			jTabbedPane.setEnabledAt(stylesTabIndex, false);
200
		}
201
		return jTabbedPane;
202
	}
203
	
204
	/**
205
	 * This method initializes the information panel
206
	 * @return Panel
207
	 */
208
	private InfoPanel getTabInfo() {
209
		if (tabInfo == null) {
210
			tabInfo = new InfoPanel();
211
		}
212
		return tabInfo;
213
	}
214
	
215
	/**
216
	 * This method initializes the panel with the layer list 
217
	 * @return
218
	 */
219
	private ILayerPanel getLayerPanel() {
220
		if (layerPanel == null) {
221
			layerPanel = new ILayerPanel();
222
			layerPanel.getLstSelectedLayers().addMouseListener(this);
223
			layerPanel.getLstSelectedLayers().addListSelectionListener(this);
224
			layerPanel.getJTxtNomCapa().addKeyListener(this);
225
			layerPanel.getChkExtendedNames().addItemListener(this);
226
			layerPanel.getBtnAdd().addActionListener(this);
227
			layerPanel.getBtnDel().addActionListener(this);
228
			layerPanel.getBtnDown().addActionListener(this);
229
			layerPanel.getBtnUp().addActionListener(this);
230
			layerPanel.getChkExtendedNames().addActionListener(this);
231
			layerPanel.getTreeLayers().addMouseListener(this);
232
			layerPanel.getTreeLayers().addTreeSelectionListener(this);
233
		}
234
		return layerPanel;
235
	}
236
	
237
	/**
238
	 * This method initializes the panel with the list of styles
239
	 * @return Panel
240
	 */
241
	private StylesPanel getTabStyle() {
242
		if (tabStyle == null) {
243
			tabStyle = new StylesPanel();
244
			tabStyle.setEnabled(false);
245
			tabStyle.addListener(new BeanListener() {
246
				public void beanValueChanged(Object value) {
247
					fireWizardComplete(isCorrectlyConfigured());
248
				};
249
			});
250
			tabStyle.addFocusListener(new FocusAdapter() {
251
				public void focusGained(FocusEvent e) {
252
					refreshStyleTree();
253
				}
254
			});
255
		}
256
		return tabStyle;
257
	}
258
	
259
	/**
260
	 * This method initializes the panel with the formats and SRSs
261
	 * @return Panel
262
	 */
263
	private IFormatsPanel getJPanelFormatsAndSrs() {
264
		if (formatsPanel == null) {
265
			formatsPanel = new IFormatsPanel();
266
			formatsPanel.getLstImageFormats().addListSelectionListener(this);
267
			formatsPanel.getLstInfoFormats().addListSelectionListener(this);
268
			formatsPanel.getLstSRSs().addListSelectionListener(this);
269
			formatsPanel.getChkTransparency().addItemListener(this);
270
		}
271
		return formatsPanel;
272
	}
273
	
274
	/**
275
	 * Returns the index of the CRS within the CRS list.
276
	 *
277
	 * @param crs
278
	 * @return The CRS's index if it exists, -1 if it not exists.
279
	 */
280
	public int getSRSIndex(String crs) {
281
		for (int i = 0; i < getLstSRSs().getModel().getSize(); i++) {
282
			if (crs != null
283
					&& crs.compareTo(getLstSRSs().getModel().getElementAt(i).toString()) == 0) {
284
				return i;
285
			}
286
		}
287
		return -1;
288
	}
289

  
290
	/**
291
	 * Returns the index of the format within the formats list.
292
	 * @param format
293
	 * @return The format's index if it exists, -1 if it not exists.
294
	 */
295
	public int getImageFormatIndex(String format) {
296
		for (int i = 0; i < getImageFormats().getModel().getSize(); i++) {
297
			if (format != null && 
298
				format.compareTo(getImageFormats().getModel().getElementAt(i).toString()) == 0) {
299
				return i;
300
			}
301
		}
302
		return -1;
303
	}
304
	
305
	/**
306
	 * Returns the index of the format within the formats list.
307
	 * @param format
308
	 * @return The format's index if it exists, -1 if it not exists.
309
	 */
310
	public int getInfoFormatIndex(String format) {
311
		for (int i = 0; i < getInfoFormats().getModel().getSize(); i++) {
312
			if (format != null && 
313
				format.compareTo(getInfoFormats().getModel().getElementAt(i).toString()) == 0) {
314
				return i;
315
			}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff