Revision 151

View differences:

org.gvsig.educa.thematicmap/tags/1.0.0-beta1/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>
org.gvsig.educa.thematicmap/tags/1.0.0-beta1/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
	<modelVersion>4.0.0</modelVersion>
6
	<artifactId>org.gvsig.educa.thematicmap</artifactId>
7
	<packaging>pom</packaging>
8
	<version>1.0.0-beta1</version>
9
	<name>org.gvsig.educa.thematicmap</name>
10
	<description>ThematicMap example project</description>
11
	<parent>
12
		<groupId>org.gvsig</groupId>
13
		<artifactId>org.gvsig.maven.base.pom</artifactId>
14
		<version>1.0.8-SNAPSHOT</version>
15
	</parent>
16
	<properties>
17
		<thematicmap.version>${project.version}</thematicmap.version>
18
		<gvsig.version>2.0-SNAPSHOT</gvsig.version>
19
		<gvsig.i18n.version>2.0.1-SNAPSHOT</gvsig.i18n.version>
20
		<gvsig.symbology.version>2.0.0-SNAPSHOT</gvsig.symbology.version>
21
		<gvsig.ui.version>2.0.1-SNAPSHOT</gvsig.ui.version>
22
		<gvsig.tools.version>3.0.0-SNAPSHOT</gvsig.tools.version>
23
		<gvsig.timesupport>1.0.0-SNAPSHOT</gvsig.timesupport>
24
		<gvsig.installer.version>1.0.1-SNAPSHOT</gvsig.installer.version>
25
		<apache.commons-io.version>1.3.2</apache.commons-io.version>
26
		<apache.commons-lang3.version>3.1</apache.commons-lang3.version>
27
	</properties>	
28
	<scm>
29
		<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap</connection>
30
		<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap</developerConnection>
31
		<url>https://devel.gvsig.org/redmine/projects/gvsig-educa/repository/show/org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap</url>
32
	</scm>
33
	<developers>
34
		<developer>
35
			<id>cordinyana</id>
36
			<name>C?sar Ordi?ana</name>
37
			<email>cordinyana@gvsig.com</email>
38
			<roles>
39
				<role>Architect</role>
40
				<role>Developer</role>
41
			</roles>
42
		</developer>
43
		<developer>
44
			<id>jmvivo</id>
45
			<name>Jose Manuel Viv? Arnal</name>
46
			<email>jmvivo@disid.com</email>
47
			<roles>
48
				<role>Analyst</role>
49
				<role>Developer</role>
50
			</roles>
51
		</developer>
52
	</developers>
53
	<repositories>
54
		<repository>
55
			<id>gvsig-public-http-repository</id>
56
			<name>gvSIG maven public HTTP repository</name>
57
			<url>http://devel.gvsig.org/m2repo/j2se</url>
58
			<releases>
59
				<enabled>true</enabled>
60
				<updatePolicy>daily</updatePolicy>
61
				<checksumPolicy>warn</checksumPolicy>
62
			</releases>
63
			<snapshots>
64
				<enabled>true</enabled>
65
				<updatePolicy>daily</updatePolicy>
66
				<checksumPolicy>warn</checksumPolicy>
67
			</snapshots>
68
		</repository>
69
	</repositories>
70
	<build>
71
		<plugins>
72
			<plugin>
73
				<groupId>org.apache.maven.plugins</groupId>
74
				<artifactId>maven-release-plugin</artifactId>
75
				<configuration>
76
					<tagBase>https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.thematicmap/tags</tagBase>
77
				</configuration>
78
			</plugin>
79
		</plugins>
80
	</build>
81
	<dependencyManagement>
82
		<dependencies>
83
			<!-- gvSIG educa -->
84
			<dependency>
85
				<groupId>org.gvsig</groupId>
86
				<artifactId>org.gvsig.educa.thematicmap.lib.api</artifactId>
87
				<version>${thematicmap.version}</version>
88
			</dependency>
89
			<dependency>
90
				<groupId>org.gvsig</groupId>
91
				<artifactId>org.gvsig.educa.thematicmap.lib.api</artifactId>
92
				<version>${thematicmap.version}</version>
93
				<type>test-jar</type>
94
				<scope>test</scope>
95
			</dependency>
96
			<dependency>
97
				<groupId>org.gvsig</groupId>
98
				<artifactId>org.gvsig.educa.thematicmap.lib.impl</artifactId>
99
				<version>${thematicmap.version}</version>
100
			</dependency>
101
			<dependency>
102
				<groupId>org.gvsig</groupId>
103
				<artifactId>org.gvsig.educa.thematicmap.lib.prov.installer</artifactId>
104
				<version>${thematicmap.version}</version>
105
			</dependency>
106
			<dependency>
107
				<groupId>org.gvsig</groupId>
108
				<artifactId>org.gvsig.educa.thematicmap.swing.api</artifactId>
109
				<version>${thematicmap.version}</version>
110
			</dependency>
111
			<dependency>
112
				<groupId>org.gvsig</groupId>
113
				<artifactId>org.gvsig.educa.thematicmap.swing.api</artifactId>
114
				<version>${thematicmap.version}</version>
115
				<type>test-jar</type>
116
				<scope>test</scope>
117
			</dependency>
118
			<dependency>
119
				<groupId>org.gvsig</groupId>
120
				<artifactId>org.gvsig.educa.thematicmap.swing.impl</artifactId>
121
				<version>${thematicmap.version}</version>
122
			</dependency>
123

  
124
			<!-- gvSIG -->
125
			<dependency>
126
				<groupId>org.gvsig</groupId>
127
				<artifactId>org.gvsig.i18n</artifactId>
128
				<version>${gvsig.i18n.version}</version>
129
			</dependency>
130
			<dependency>
131
				<groupId>org.gvsig</groupId>
132
				<artifactId>org.gvsig.tools.lib</artifactId>
133
				<version>${gvsig.tools.version}</version>
134
			</dependency>
135
			<dependency>
136
				<groupId>org.gvsig</groupId>
137
				<artifactId>org.gvsig.tools.lib</artifactId>
138
				<version>${gvsig.tools.version}</version>
139
				<type>test-jar</type>
140
				<scope>test</scope>
141
			</dependency>
142
			<dependency>
143
				<groupId>org.gvsig</groupId>
144
				<artifactId>org.gvsig.tools.swing.api</artifactId>
145
				<version>${gvsig.tools.version}</version>
146
			</dependency>
147
			<dependency>
148
				<groupId>org.gvsig</groupId>
149
				<artifactId>org.gvsig.tools.swing.impl</artifactId>
150
				<version>${gvsig.tools.version}</version>
151
			</dependency>
152
			<dependency>
153
				<groupId>org.gvsig</groupId>
154
				<artifactId>org.gvsig.utils</artifactId>
155
				<version>${gvsig.version}</version>
156
			</dependency>
157
			<dependency>
158
				<groupId>org.gvsig</groupId>
159
				<artifactId>org.gvsig.fmap.geometry</artifactId>
160
				<version>${gvsig.version}</version>
161
			</dependency>
162
			<dependency>
163
				<groupId>org.gvsig</groupId>
164
				<artifactId>org.gvsig.fmap.dal</artifactId>
165
				<version>${gvsig.version}</version>
166
			</dependency>
167
			<dependency>
168
				<groupId>org.gvsig</groupId>
169
				<artifactId>org.gvsig.compat</artifactId>
170
				<version>${gvsig.version}</version>
171
			</dependency>
172
			<dependency>
173
				<groupId>org.gvsig</groupId>
174
				<artifactId>org.gvsig.compat</artifactId>
175
				<version>${gvsig.version}</version>
176
				<classifier>se</classifier>
177
				<scope>runtime</scope>
178
			</dependency>
179
			<dependency>
180
				<groupId>org.gvsig</groupId>
181
				<artifactId>org.gvsig.fmap.mapcontext</artifactId>
182
				<version>${gvsig.version}</version>
183
			</dependency>
184
			<dependency>
185
				<groupId>org.gvsig</groupId>
186
				<artifactId>org.gvsig.fmap.control</artifactId>
187
				<version>${gvsig.version}</version>
188
			</dependency>
189
			<dependency>
190
				<groupId>org.gvsig</groupId>
191
				<artifactId>org.gvsig.symbology.lib.api</artifactId>
192
				<version>${gvsig.symbology.version}</version>
193
			</dependency>
194
			<dependency>
195
				<groupId>org.gvsig</groupId>
196
				<artifactId>org.gvsig.symbology.lib.impl</artifactId>
197
				<version>${gvsig.symbology.version}</version>
198
				<scope>runtime</scope>
199
			</dependency>
200
			<dependency>
201
				<groupId>org.gvsig</groupId>
202
				<artifactId>org.gvsig.fmap.dal.file</artifactId>
203
				<version>${gvsig.version}</version>
204
				<scope>compile</scope>
205
			</dependency>
206
			<dependency>
207
				<groupId>org.gvsig</groupId>
208
				<artifactId>org.gvsig.fmap.dal.file</artifactId>
209
				<version>${gvsig.version}</version>
210
				<classifier>store.dbf</classifier>
211
			</dependency>
212
			<dependency>
213
				<groupId>org.gvsig</groupId>
214
				<artifactId>org.gvsig.fmap.dal.file</artifactId>
215
				<version>${gvsig.version}</version>
216
				<classifier>store.shp</classifier>
217
			</dependency>
218
			<dependency>
219
				<groupId>org.gvsig</groupId>
220
				<artifactId>org.gvsig.fmap.geometry</artifactId>
221
				<version>${gvsig.version}</version>
222
				<classifier>impl</classifier>
223
			</dependency>
224
			<dependency>
225
				<groupId>org.gvsig</groupId>
226
				<artifactId>org.gvsig.projection</artifactId>
227
				<version>${gvsig.version}</version>
228
				<classifier>cresques-impl</classifier>
229
				<scope>test</scope>
230
			</dependency>
231
			<dependency>
232
				<groupId>org.gvsig</groupId>
233
				<artifactId>org.gvsig.timesupport.lib.impl</artifactId>
234
				<version>${gvsig.timesupport}</version>
235
			</dependency>
236
			<dependency>
237
				<groupId>org.gvsig</groupId>
238
				<artifactId>org.gvsig.ui</artifactId>
239
				<version>${gvsig.ui.version}</version>
240
			</dependency>
241
			<dependency>
242
				<groupId>org.gvsig</groupId>
243
				<artifactId>org.gvsig.fmap.dal.db</artifactId>
244
				<version>${gvsig.version}</version>
245
				<scope>runtime</scope>
246
			</dependency>
247
			<dependency>
248
				<groupId>org.gvsig</groupId>
249
				<artifactId>org.gvsig.fmap.dal.db</artifactId>
250
				<version>${gvsig.version}</version>
251
				<classifier>store.jdbc</classifier>
252
				<scope>runtime</scope>
253
			</dependency>
254
			<dependency>
255
				<groupId>org.gvsig</groupId>
256
				<artifactId>org.gvsig.fmap.dal.db</artifactId>
257
				<version>${gvsig.version}</version>
258
				<classifier>store.postgresql</classifier>
259
				<scope>runtime</scope>
260
			</dependency>
261
			<dependency>
262
				<groupId>org.gvsig</groupId>
263
				<artifactId>org.gvsig.fmap.dal.db</artifactId>
264
				<version>${gvsig.version}</version>
265
				<classifier>store.mysql</classifier>
266
				<scope>runtime</scope>
267
			</dependency>
268
			<dependency>
269
				<groupId>org.gvsig</groupId>
270
				<artifactId>org.gvsig.installer.lib.api</artifactId>
271
				<version>${gvsig.installer.version}</version>
272
			</dependency>
273
			<dependency>
274
				<groupId>org.gvsig</groupId>
275
				<artifactId>org.gvsig.installer.lib.spi</artifactId>
276
				<version>${gvsig.installer.version}</version>
277
			</dependency>
278
			<dependency>
279
				<groupId>org.gvsig</groupId>
280
				<artifactId>org.gvsig.installer.lib.impl</artifactId>
281
				<version>${gvsig.installer.version}</version>
282
				<scope>runtime</scope>
283
			</dependency>
284
			<dependency>
285
				<groupId>org.gvsig</groupId>
286
				<artifactId>org.gvsig.installer.swing.api</artifactId>
287
				<version>${gvsig.installer.version}</version>
288
			</dependency>
289
			<dependency>
290
				<groupId>org.gvsig</groupId>
291
				<artifactId>org.gvsig.installer.swing.impl</artifactId>
292
				<version>${gvsig.installer.version}</version>
293
				<scope>runtime</scope>
294
			</dependency>
295

  
296

  
297
			<!-- apache commons -->
298
			<dependency>
299
				<groupId>org.apache.commons</groupId>
300
				<artifactId>commons-io</artifactId>
301
				<version>${apache.commons-io.version}</version>
302
			</dependency>
303
			<dependency>
304
				<groupId>org.apache.commons</groupId>
305
				<artifactId>commons-lang3</artifactId>
306
				<version>${apache.commons-lang3.version}</version>
307
			</dependency>
308

  
309
		</dependencies>
310
	</dependencyManagement>
311

  
312
	<dependencies>
313
		<dependency>
314
			<groupId>org.gvsig</groupId>
315
			<artifactId>org.gvsig.tools.lib</artifactId>
316
		</dependency>
317
		<dependency>
318
			<groupId>org.gvsig</groupId>
319
			<artifactId>org.gvsig.tools.lib</artifactId>
320
			<type>test-jar</type>
321
		</dependency>
322
		<dependency>
323
			<groupId>org.slf4j</groupId>
324
			<artifactId>slf4j-api</artifactId>
325
			<scope>compile</scope>
326
		</dependency>
327
	</dependencies>
328

  
329
	<modules>
330
		<module>org.gvsig.educa.thematicmap.lib</module>
331
		<module>org.gvsig.educa.thematicmap.swing</module>
332
		<module>org.gvsig.educa.thematicmap.main</module>
333
	</modules>
334

  
335
</project>
org.gvsig.educa.thematicmap/tags/1.0.0-beta1/README.txt
1
===============
2
gvSIG Educa
3
===============
4

  
5
---------------------
6
Thematic Map
7
---------------------
8

  
9
Description
10
==============
11

  
12
This folder contains the sources of the Thematic Map functionality.
13

  
14
Requirements
15
==============
16

  
17
* Maven 2.6 or higher
18

  
19
* Java JDK 1.5 or higher
20

  
21
For eclipse
22
-------------
23

  
24
See `developer guide at gvSIG.org <https://gvsig.org/web/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2.0.0/>`_ and the file ``REAME-ECLIPSE.txt``
25

  
26

  
27
Contents
28
==========
29

  
30
org.gvsig.educa.thematicmap.lib
31
---------------------------------
32

  
33
Functionality sources. This project just contain the main process and the logic without any dependency with User Interface.
34

  
35
org.gvsig.educa.thematicmap.swing
36
-------------------------------------
37

  
38
User Interface components to access a manage the application services.
39

  
40
org.gvsig.educa.thematicmap.main
41
-----------------------------------
42

  
43
Little test application which allow run the main functionality of application.
44

  
45
See `Execute little test application`_ to know how run it.
46

  
47
pom.xml
48
---------
49

  
50
Maven project definition file
51

  
52
prepare-workspace.xml and README-ECLIPSE.txt
53
-----------------------------------------------
54

  
55
Instructions and utilities to work with eclipse
56

  
57
README.rst
58
--------------
59

  
60
This file (in reStructureText format, for more info this format look at `gvSIG portal <https://gvsig.org/web/projects/gvsig-desktop/docs/devel/guia-para-documentar/el-formato-restructuredtext>`_  or at `docUtils reference <http://docutils.sourceforge.net/rst.html>`_)
61

  
62

  
63
Compilation
64
================
65

  
66
From shell
67
------------
68

  
69
Execute this command::
70

  
71
    org.gvsig.educa.thematicmap$ mvn clean install
72

  
73

  
74
From eclipse
75
--------------
76

  
77
See `work in a proyect of the developer guide at gvSIG.org <https://gvsig.org/web/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2.0.0/trabajar-con-un-proyecto>`_
78

  
79
In some project, could be better use ``mvn eclipse:clean eclipse:eclipse``  than import project as a *Maven project*. Maven plugin of eclipse does not set classpath correctly in some project. 
80

  
81

  
82
Packing
83
========
84

  
85
This functionality has no stand-alone packing process.
86

  
87
Version 
88
---------------
89

  
90
To changes version number just set in in ``project/version`` tag of *pom.xml* in this folder. Sub-projects will inherit it.
91

  
92
Version polity is the standard in project. Changes in version number:
93

  
94
* third number: Bug fixes and minors improvements. API must have no changes from previous version.
95
* second number: Bug fixes and mayor improvements. API can have minor changes. Previously deprecated classes could be removed. No architectural changes.
96
* first number: Mayor changes.
97

  
98
Create a tag
99
------------------
100

  
101
TODO: use *maven release* plugin
102

  
103
Use svn copy command to copy version in server. Process could be like this:
104

  
105

  
106
#. Check that there ins no changes in workspace::
107
   
108
   svn up ; svn status
109

  
110
#. Check that project compiles and passes all test.
111

  
112
   mvn clean install
113

  
114
#. Update *pom.xml* to set version of tag (usually removing *-SNAPSHOT*)
115
#. create tag folder on server::
116
    
117
   svn mkdir -m "Create {version} tag folder" https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.thematicmap/tag/{version}
118

  
119
#. Copy current workcopy to tag folder::
120

  
121
   svn copy -m "Create {version} tag" * https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.thematicmap/tag/{version}
122

  
123
#. Update *pom.xml* to next version
124
#. Commit *pom.xml* changes::
125

  
126
   svn commit -m "Set new version {version}-SNAPSHOT" pom.xml
127

  
128

  
129
i18n
130
======
131

  
132
The files for internationalization can be found in this folders:
133

  
134
+ *org.gvsig.educa.thematicmap.app.viewer/src/main/resources*
135
+ *org.gvsig.educa.thematicmap.app.editor/src/main/resources*
136

  
137
The internationalization of this application is based on standard java resource bundle mechanism. So, to add a new language just add the file with the language code to every related folder.
138

  
139
Execute little test application
140
=================================
141

  
142
From shell
143
------------
144

  
145
After compile the application, execute this command::
146

  
147
    org.gvsig.educa.thematicmap$ cd org.gvsig.educa.thematicmap.main
148
    org.gvsig.educa.thematicmap/org.gvsig.educa.thematicmap.main$ mvn exec:java
149

  
150
Form eclipse
151
------------------
152

  
153
Select ``org.gvsig.educa.thematicmap.main`` project in *Project tree* using *Java perspective*, click with right mouse button and select ``Run as.../Java application``. Select ``Main`` class for project.
154

  
org.gvsig.educa.thematicmap/tags/1.0.0-beta1/README-ECLIPSE.txt
1
The first time you checkout the current project to a new workspace, 
2
you have to prepare it to be able to work easily with maven from
3
eclipse itself.
4

  
5
Perform the following steps:
6

  
7
1.- Launch the *prepare-workspace.xml* ant build file. 
8
    You can do it by loading the file into the ant view, 
9
    and running the default task, or right-clicking the 
10
    file from the package explorer or the navigator and
11
    select the option: *Run as > Ant build*. 
12
    
13
2.- Restart eclipse.
14

  
15
3.- Import the subprojects of the project you have just checked out.
16

  
17
Those steps are only needed once per workspace.     
18

  
org.gvsig.educa.thematicmap/tags/1.0.0-beta1/org.gvsig.educa.thematicmap.main/src/main/java/org/gvsig/educa/thematicmap/main/OpenThematicMap.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.educa.thematicmap.main;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.Dimension;
26
import java.awt.event.ActionEvent;
27
import java.util.ArrayList;
28
import java.util.List;
29

  
30
import javax.swing.AbstractAction;
31
import javax.swing.Box;
32
import javax.swing.BoxLayout;
33
import javax.swing.JButton;
34
import javax.swing.JLabel;
35
import javax.swing.JList;
36
import javax.swing.JPanel;
37
import javax.swing.JScrollPane;
38
import javax.swing.ListSelectionModel;
39
import javax.swing.event.ListSelectionEvent;
40
import javax.swing.event.ListSelectionListener;
41

  
42
import org.gvsig.educa.thematicmap.map.ThematicMap;
43
import org.gvsig.educa.thematicmap.swing.ThematicMapSwingLocator;
44
import org.gvsig.educa.thematicmap.swing.ThematicMapSwingManager;
45
import org.gvsig.educa.thematicmap.swing.viewer.ThematicMapInforamtionViewer;
46
import org.gvsig.tools.swing.api.ToolsSwingLocator;
47
import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
48
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
49

  
50
/**
51
 * Open Thematic Map dialog
52
 * 
53
 * @author gvSIG Team
54
 * @version $Id$
55
 * 
56
 */
57
public class OpenThematicMap extends JPanel implements ListSelectionListener {
58

  
59
    /**
60
     *
61
     */
62
    private static final long serialVersionUID = 1L;
63

  
64
    private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory
65
        .getLogger(OpenThematicMap.class);
66

  
67
    private final ThematicMapSwingManager swingManager;
68
    private final DynObjectSwingManager dynSwingManager;
69
    private final UsabilitySwingManager usabManager;
70

  
71
    private final Main main;
72

  
73
    private List<ThematicMap> maps;
74
    private final List<String> mapNames;
75
    private JPanel listPanel;
76
    private JList list;
77
    private JPanel informationPanel;
78
    private ThematicMapInforamtionViewer information;
79

  
80
    private JPanel actionPanel;
81
    private JButton botOpen;
82
    private JButton botCancel;
83
    private ThematicMap curMap;
84

  
85
    private int lastSelectedIndex;
86

  
87
    private JPanel container;
88

  
89
    public OpenThematicMap(Main main, List<ThematicMap> installedMaps) {
90
        super();
91

  
92
        this.main = main;
93
        swingManager = ThematicMapSwingLocator.getSwingManager();
94

  
95
        dynSwingManager = ToolsSwingLocator.getDynObjectSwingManager();
96
        usabManager = ToolsSwingLocator.getUsabilitySwingManager();
97

  
98
        maps = installedMaps;
99
        mapNames = new ArrayList<String>(installedMaps.size());
100
        for (ThematicMap map : maps) {
101
            mapNames.add(map.getInformation().getName());
102
        }
103
        curMap = null;
104
        lastSelectedIndex = -1;
105

  
106
        initializeUI();
107

  
108
    }
109

  
110
    /**
111
     * Initialize user interface
112
     * 
113
     */
114
    private void initializeUI() {
115
        setLayout(new BorderLayout(5, 5));
116

  
117
        setMaximumSize(new Dimension(300, 200));
118
        setPreferredSize(new Dimension(800, 600));
119

  
120
        list = new JList(mapNames.toArray());
121
        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
122
        list.addListSelectionListener(this);
123

  
124
        listPanel = new JPanel();
125
        listPanel.setLayout(new BorderLayout(5, 5));
126
        listPanel.add(new JLabel("Thematic Maps availables:"),
127
            BorderLayout.NORTH);
128
        listPanel.add(list, BorderLayout.CENTER);
129

  
130
        add(new JScrollPane(listPanel), BorderLayout.WEST);
131

  
132
        informationPanel = new JPanel();
133
        informationPanel.setLayout(new BorderLayout(5, 5));
134

  
135
        informationPanel.add(new JLabel("Thematic Map information:"),
136
            BorderLayout.NORTH);
137

  
138
        information = swingManager.newInformationViewer();
139
        informationPanel.add(information.getSwingComponent(),
140
            BorderLayout.CENTER);
141

  
142
        add(informationPanel, BorderLayout.CENTER);
143

  
144
        actionPanel = new JPanel();
145
        BoxLayout actionPanelLayout =
146
            new BoxLayout(actionPanel, BoxLayout.X_AXIS);
147
        actionPanel.setLayout(actionPanelLayout);
148

  
149
        actionPanel.add(Box.createHorizontalGlue());
150

  
151
        botOpen = usabManager.createJButton(new AbstractAction("Open Map") {
152

  
153
            /**
154
             *
155
             */
156
            private static final long serialVersionUID = -3437007146684939225L;
157

  
158
            public void actionPerformed(ActionEvent e) {
159
                openSelected();
160
            }
161
        });
162
        botOpen.setEnabled(false);
163

  
164
        botCancel = usabManager.createJButton(new AbstractAction("Cancel") {
165

  
166
            /**
167
             *
168
             */
169
            private static final long serialVersionUID = -2227776656041247582L;
170

  
171
            public void actionPerformed(ActionEvent e) {
172
                close();
173
            }
174
        });
175

  
176
        actionPanel.add(botOpen);
177
        actionPanel.add(Box.createHorizontalStrut(10));
178
        actionPanel.add(botCancel);
179
        actionPanel.add(Box.createHorizontalStrut(5));
180

  
181
        add(actionPanel, BorderLayout.SOUTH);
182

  
183
    }
184

  
185
    /**
186
     * Opens selected thematic map
187
     */
188
    private void openSelected() {
189
        if (curMap == null) {
190
            return;
191
        }
192
        main.openMap(curMap);
193
        close();
194
    }
195

  
196
    /**
197
     * Close this dialog
198
     */
199
    private void close() {
200
        this.setVisible(false);
201
        maps = null;
202
        curMap = null;
203
    }
204

  
205
    /**
206
     * Update UI with Thematic list selection
207
     */
208
    public void valueChanged(ListSelectionEvent e) {
209
        int index = list.getSelectedIndex();
210
        if (index == lastSelectedIndex) {
211
            return;
212
        }
213
        lastSelectedIndex = index;
214
        if (index < 0) {
215
            if (information != null) {
216
                information.clean();
217
            }
218
            botOpen.setEnabled(false);
219
            return;
220
        }
221
        botOpen.setEnabled(true);
222
        curMap = maps.get(index);
223
        information.loadMapInfromation(curMap);
224
    }
225
}
org.gvsig.educa.thematicmap/tags/1.0.0-beta1/org.gvsig.educa.thematicmap.main/src/main/java/org/gvsig/educa/thematicmap/main/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.educa.thematicmap package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>ThematicMap library testing and demo application.</p>
11

  
12
</body>
13
</html>
org.gvsig.educa.thematicmap/tags/1.0.0-beta1/org.gvsig.educa.thematicmap.main/src/main/java/org/gvsig/educa/thematicmap/main/MapToolsRegistrant.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.educa.thematicmap.main;
23

  
24
import org.gvsig.educa.thematicmap.swing.viewer.MapControlToolRegistrant;
25
import org.gvsig.fmap.mapcontrol.MapControl;
26
import org.gvsig.fmap.mapcontrol.tools.PanListenerImpl;
27
import org.gvsig.fmap.mapcontrol.tools.ZoomInListenerImpl;
28
import org.gvsig.fmap.mapcontrol.tools.ZoomOutRightButtonListener;
29
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
30
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseWheelBehavior;
31
import org.gvsig.fmap.mapcontrol.tools.Behavior.MoveBehavior;
32
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior;
33
import org.gvsig.fmap.mapcontrol.tools.Behavior.RectangleBehavior;
34

  
35
/**
36
 * @author gvSIG Team
37
 * @version $Id$
38
 * 
39
 */
40
public class MapToolsRegistrant implements MapControlToolRegistrant {
41

  
42
    public static final String TOOL_ZOOM_ID = "zoom";
43

  
44
    public static final String TOOL_PAN_ID = "pan";
45

  
46
    public void registerTools(MapControl mapControl) {
47
        // Adds tools to mapControl
48
        // mouseWhell
49
        mapControl.addCombinedBehavior(new MouseWheelBehavior());
50
        // zoom
51
        mapControl.addBehavior(TOOL_ZOOM_ID, new Behavior[] {
52
            new RectangleBehavior(new ZoomInListenerImpl(mapControl)),
53
            new PointBehavior(new ZoomOutRightButtonListener(mapControl)) });
54
        // pan
55
        mapControl.addBehavior(TOOL_PAN_ID, new MoveBehavior(
56
            new PanListenerImpl(mapControl)));
57

  
58
        mapControl.setTool(TOOL_PAN_ID);
59
    }
60

  
61
}
org.gvsig.educa.thematicmap/tags/1.0.0-beta1/org.gvsig.educa.thematicmap.main/src/main/java/org/gvsig/educa/thematicmap/main/Main.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.educa.thematicmap.main;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.Dimension;
26
import java.awt.event.ActionEvent;
27
import java.io.File;
28
import java.io.IOException;
29
import java.net.URL;
30
import java.util.List;
31

  
32
import javax.swing.AbstractAction;
33
import javax.swing.Box;
34
import javax.swing.JButton;
35
import javax.swing.JFileChooser;
36
import javax.swing.JFrame;
37
import javax.swing.JMenu;
38
import javax.swing.JMenuBar;
39
import javax.swing.JMenuItem;
40
import javax.swing.JToolBar;
41
import javax.swing.WindowConstants;
42

  
43
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
45

  
46
import org.gvsig.educa.thematicmap.ThematicMapLocator;
47
import org.gvsig.educa.thematicmap.ThematicMapManager;
48
import org.gvsig.educa.thematicmap.compilation.ThematicMapCompilation;
49
import org.gvsig.educa.thematicmap.compilation.ThematicMapCompiler;
50
import org.gvsig.educa.thematicmap.compilation.ThematicMapCompilerListener;
51
import org.gvsig.educa.thematicmap.compilation.ThematicMapCompilerStatus;
52
import org.gvsig.educa.thematicmap.map.ThematicMap;
53
import org.gvsig.educa.thematicmap.swing.ThematicMapSwingLocator;
54
import org.gvsig.educa.thematicmap.swing.ThematicMapSwingManager;
55
import org.gvsig.educa.thematicmap.swing.ThematicMapWindowManager;
56
import org.gvsig.educa.thematicmap.swing.ThematicMapWindowManager.CONFIRM_DIALOG_OPTION;
57
import org.gvsig.educa.thematicmap.swing.ThematicMapWindowManager.CONFIRM_DIALOG_TYPE;
58
import org.gvsig.educa.thematicmap.swing.ThematicMapWindowManager.MESSAGE_DIALOG_TYPE;
59
import org.gvsig.educa.thematicmap.swing.editor.ThematicMapCompilationEditor;
60
import org.gvsig.educa.thematicmap.swing.editor.ThematicMapCompilationEditorListener;
61
import org.gvsig.educa.thematicmap.swing.viewer.ThematicMapViewer;
62
import org.gvsig.installer.swing.api.SwingInstallerLocator;
63
import org.gvsig.installer.swing.api.SwingInstallerManager;
64
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException;
65
import org.gvsig.installer.swing.api.wizard.AbstractInstallerWizard;
66
import org.gvsig.tools.ToolsLocator;
67
import org.gvsig.tools.dispose.DisposableManager;
68
import org.gvsig.tools.exception.BaseException;
69
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
70
import org.gvsig.tools.swing.api.ToolsSwingLocator;
71
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
72
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE;
73

  
74
/**
75
 * Main executable class for testing the ThematicMap library.
76
 * 
77
 * @author gvSIG Team
78
 * @version $Id$
79
 */
80
public class Main {
81

  
82
    private static final Logger LOG = LoggerFactory.getLogger(Main.class);
83

  
84
    private final ThematicMapManager manager;
85
    private final ThematicMapSwingManager swingManager;
86
    private final ThematicMapWindowManager winManager;
87
    private final UsabilitySwingManager usabManager;
88
    private final DisposableManager disposeManager;
89
    private final SwingInstallerManager swingInstallerManager;
90

  
91
    private final JFileChooser fileChooser;
92
    private JFrame mainFrame;
93
    private ThematicMapViewer curViewer = null;
94

  
95
    private AbstractAction setPanToolAction;
96
    private AbstractAction setZoomToolAction;
97
    private AbstractAction zoomAllAction;
98
    private AbstractAction setThematiMapFolderAction;
99
    private AbstractAction showOpenThematicMapDialogAction;
100
    private AbstractAction exitAction;
101
    private AbstractAction closeThematicMapAction;
102

  
103
    private AbstractAction createCompilationAction;
104

  
105
    private AbstractAction createCompilationFromMapAction;
106

  
107
    private AbstractAction installThematicMaps;
108

  
109
    private AbstractAction addInstallUrl;
110

  
111
    public static void main(String args[]) {
112
        new DefaultLibrariesInitializer().fullInitialize();
113

  
114
        Main main = new Main();
115
        main.show();
116
    }
117

  
118
    /**
119
     * New instance of Main
120
     */
121
    public Main() {
122
        manager = ThematicMapLocator.getManager();
123
        swingManager = ThematicMapSwingLocator.getSwingManager();
124
        winManager = swingManager.getWindowManager();
125
        usabManager = ToolsSwingLocator.getUsabilitySwingManager();
126
        disposeManager = ToolsLocator.getDisposableManager();
127
        swingInstallerManager =
128
            SwingInstallerLocator.getSwingInstallerManager();
129

  
130
        String defaultFolderPath =
131
            "gvSIG/plugins/org.gvsig.educa.thematicmap.app.viewer/thematicMaps";
132
        File defaultFolder =
133
            new File(System.getProperty("user.home"), defaultFolderPath);
134

  
135
        if (defaultFolder.exists() && defaultFolder.isDirectory()) {
136
            manager.setInstallationMapFolder(defaultFolder.getAbsolutePath());
137
        }
138

  
139
        swingManager.addMapControlRegistrant(new MapToolsRegistrant());
140

  
141
        fileChooser = new JFileChooser();
142

  
143
    }
144

  
145
    /**
146
     * Shows main frame
147
     */
148
    public void show() {
149

  
150
        // Create actions
151
        createActions();
152

  
153
        // Create JFrame to show data
154
        mainFrame = new JFrame("ThematicMap example app");
155
        mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
156
        mainFrame.setLayout(new BorderLayout(10, 10));
157

  
158
        // Create menu bar
159
        createMenu();
160

  
161
        // Create tools bar
162
        createToolBar();
163

  
164
        updateControls();
165

  
166
        // Display the window.
167
        mainFrame.pack();
168
        mainFrame.setSize(800, 600);
169
        mainFrame.setVisible(true);
170

  
171
    }
172

  
173
    /**
174
     * Creates all the action for menu and tools bar
175
     * 
176
     */
177
    @SuppressWarnings("serial")
178
    private void createActions() {
179
        setThematiMapFolderAction =
180
            new AbstractAction("Set thematic map folder") {
181

  
182
                public void actionPerformed(ActionEvent e) {
183
                    setThematicMapFolder();
184
                }
185
            };
186

  
187
        showOpenThematicMapDialogAction =
188
            new AbstractAction("Open a Thematic Map") {
189

  
190
                public void actionPerformed(ActionEvent e) {
191
                    showOpenThematicMapDialog();
192
                }
193
            };
194
        showOpenThematicMapDialogAction.setEnabled(false);
195

  
196
        setZoomToolAction = new AbstractAction("Tool Zoom") {
197

  
198
            public void actionPerformed(ActionEvent e) {
199
                setZoomTool();
200
            }
201
        };
202
        setZoomToolAction.setEnabled(false);
203

  
204
        setPanToolAction = new AbstractAction("Tool Pan") {
205

  
206
            public void actionPerformed(ActionEvent e) {
207
                setPanTool();
208
            }
209
        };
210
        setPanToolAction.setEnabled(false);
211

  
212
        zoomAllAction = new AbstractAction("Zoom all") {
213

  
214
            public void actionPerformed(ActionEvent e) {
215
                zoomAll();
216
            }
217
        };
218
        zoomAllAction.setEnabled(false);
219

  
220
        closeThematicMapAction = new AbstractAction("Close Map") {
221

  
222
            public void actionPerformed(ActionEvent e) {
223
                closeMap();
224
            }
225
        };
226
        closeThematicMapAction.setEnabled(false);
227

  
228
        exitAction = new AbstractAction("Exit") {
229

  
230
            public void actionPerformed(ActionEvent e) {
231
                exit();
232
            }
233
        };
234

  
235
        createCompilationAction = new AbstractAction("Create a compilation") {
236

  
237
            public void actionPerformed(ActionEvent e) {
238
                createCompilation();
239
            }
240
        };
241
        createCompilationAction.setEnabled(false);
242

  
243
        createCompilationFromMapAction =
244
            new AbstractAction("Create compilation from current map") {
245

  
246
                public void actionPerformed(ActionEvent e) {
247
                    createCompilationFromMap();
248
                }
249
            };
250
        createCompilationFromMapAction.setEnabled(false);
251

  
252
        addInstallUrl = new AbstractAction("Add a ThematicMap install URL") {
253

  
254
            public void actionPerformed(ActionEvent e) {
255
                addThematicMapUrl();
256
            }
257

  
258
        };
259

  
260
        installThematicMaps = new AbstractAction("Install ThematicMaps") {
261

  
262
            public void actionPerformed(ActionEvent e) {
263
                installThematicMap();
264
            }
265

  
266
        };
267
        installThematicMaps.setEnabled(false);
268

  
269
    }
270

  
271
    /**
272
     * Creates the menu bar
273
     */
274
    private void createMenu() {
275
        // Create the menu bar.
276
        JMenuBar menuBar = new JMenuBar();
277

  
278
        // Build the menu.
279
        JMenu menuFile = new JMenu("File");
280
        menuFile.add(new JMenuItem(setThematiMapFolderAction));
281
        menuFile.addSeparator();
282
        menuFile.add(new JMenuItem(showOpenThematicMapDialogAction));
283
        menuFile.add(new JMenuItem(closeThematicMapAction));
284
        menuFile.addSeparator();
285
        menuFile.add(new JMenuItem(createCompilationAction));
286
        menuFile.add(new JMenuItem(createCompilationFromMapAction));
287
        menuFile.addSeparator();
288
        menuFile.add(new JMenuItem(addInstallUrl));
289
        menuFile.add(new JMenuItem(installThematicMaps));
290
        menuFile.addSeparator();
291
        menuFile.add(new JMenuItem(exitAction));
292

  
293
        JMenu menuViewer = new JMenu("Viewer");
294
        menuViewer.add(setPanToolAction);
295
        menuViewer.add(setZoomToolAction);
296
        menuViewer.addSeparator();
297
        menuViewer.add(zoomAllAction);
298

  
299
        menuBar.add(menuFile);
300
        menuBar.add(menuViewer);
301

  
302
        mainFrame.setJMenuBar(menuBar);
303
    }
304

  
305
    /**
306
     * Creates the tools bar
307
     */
308
    private void createToolBar() {
309
        Dimension sepSize = new Dimension(20, 5);
310
        JToolBar toolBar = new JToolBar();
311
        toolBar.add(usabManager.createJButton(showOpenThematicMapDialogAction));
312
        toolBar.add(usabManager.createJButton(closeThematicMapAction));
313

  
314
        toolBar.addSeparator(sepSize);
315
        toolBar.add(usabManager.createJButton(setPanToolAction));
316
        toolBar.add(usabManager.createJButton(setZoomToolAction));
317

  
318
        toolBar.addSeparator(sepSize);
319
        toolBar.add(usabManager.createJButton(zoomAllAction));
320

  
321
        toolBar.add(Box.createHorizontalGlue());
322
        toolBar.add(new JButton(exitAction));
323

  
324
        mainFrame.add(toolBar, BorderLayout.PAGE_START);
325
    }
326

  
327
    /**
328
     * Shows file chooser to select thematic map folder
329
     */
330
    public void setThematicMapFolder() {
331
        fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
332
        int result =
333
            fileChooser.showDialog(mainFrame, "Select ThematicMap folder");
334
        if (result != JFileChooser.APPROVE_OPTION) {
335
            return;
336
        }
337
        File folder = fileChooser.getSelectedFile();
338
        List<ThematicMap> maps =
339
            manager.getInstalledMaps(folder.getAbsolutePath());
340
        if (maps.isEmpty()) {
341
            LOG.info("No maps foudn in required folder: {}",
342
                folder.getAbsolutePath());
343
            CONFIRM_DIALOG_OPTION resp =
344
                winManager.showConfirmDialog(mainFrame,
345
                    "No maps found. Select this folder anyway?",
346
                    "Set ThematicMap folder", CONFIRM_DIALOG_TYPE.YES_NO,
347
                    MESSAGE_DIALOG_TYPE.WARNING);
348
            if (resp != CONFIRM_DIALOG_OPTION.OK_YES) {
349
                return;
350
            }
351
        }
352
        LOG.info("Selected map folder: {}", folder.getAbsolutePath());
353
        try {
354
            manager.setInstallationMapFolder(folder.getAbsolutePath());
355
        } catch (Exception e) {
356
            LOG.error("Error setting thematic map folder", e);
357
            winManager
358
                .showMessageDialog(
359
                    mainFrame,
360
                    "Setting folder",
361
                    "Problem foudn setting Thematic Map folder (See log for more information)",
362
                    MESSAGE_DIALOG_TYPE.ERROR);
363
        }
364
        updateControls();
365
    }
366

  
367
    /**
368
     * Shows a dialog to select a Thematic Map to open
369
     */
370
    public void showOpenThematicMapDialog() {
371
        if (manager.getInstallationMapFolder() == null) {
372
            LOG.warn("thematic map folder not set on open Thematic Map request");
373
            winManager.showMessageDialog(mainFrame, "Open a Thematic Map",
374
                "Select a Thematic Map folder first", MESSAGE_DIALOG_TYPE.INFO);
375
            return;
376
        }
377
        OpenThematicMap openThematicMap =
378
            new OpenThematicMap(this, manager.getInstalledMaps());
379
        winManager.showWindow(openThematicMap, "Open a Thematic Map...",
380
            MODE.DIALOG);
381
    }
382

  
383
    /**
384
     * Opens a thematic map in main frame
385
     * 
386
     * @param curMap
387
     * @return
388
     */
389
    public boolean openMap(ThematicMap curMap) {
390
        ThematicMapViewer viewer;
391
        try {
392
            viewer = swingManager.getViewer(curMap);
393
        } catch (Exception e) {
394
            LOG.error("Can't open map", e);
395
            winManager.showMessageDialog(mainFrame, "Open Thematic map",
396
                "Problem found opening map (see log for details)",
397
                MESSAGE_DIALOG_TYPE.ERROR);
398
            return false;
399
        }
400
        doCloseMap();
401

  
402
        mainFrame.add(viewer.getSwingComponent(), BorderLayout.CENTER);
403
        curViewer = viewer;
404
        updateControls();
405
        return true;
406
    }
407

  
408
    /**
409
     * Closes the current thematic map
410
     */
411
    public void closeMap() {
412
        doCloseMap();
413
        updateControls();
414
    }
415

  
416
    /**
417
     * Removes thematic map view from main frame
418
     */
419
    private void doCloseMap() {
420
        if (curViewer != null) {
421
            mainFrame.remove(curViewer.getSwingComponent());
422
            try {
423
                curViewer.getThematicMap().close();
424
            } catch (IOException e) {
425
                LOG.warn("Exception clossing map", e);
426
            }
427
            curViewer = null;
428
        }
429
    }
430

  
431
    /**
432
     * Update actions ability and updates main frame content
433
     */
434
    public void updateControls() {
435
        showOpenThematicMapDialogAction.setEnabled(manager
436
            .getInstallationMapFolder() != null);
437
        createCompilationAction
438
            .setEnabled(manager.getInstallationMapFolder() != null);
439
        createCompilationFromMapAction.setEnabled(curViewer != null);
440
        setZoomToolAction.setEnabled(curViewer != null);
441
        setPanToolAction.setEnabled(curViewer != null);
442
        closeThematicMapAction.setEnabled(curViewer != null);
443
        zoomAllAction.setEnabled(curViewer != null);
444
        installThematicMaps
445
            .setEnabled(manager.getInstallationMapFolder() != null);
446

  
447
        mainFrame.getContentPane().invalidate();
448
        mainFrame.doLayout();
449
        Dimension d = mainFrame.getSize();
450
        d.width--;
451
        mainFrame.setSize(d);
452
        d.width++;
453
        mainFrame.setSize(d);
454

  
455
    }
456

  
457
    /**
458
     * Sets the zoom tool
459
     */
460
    public void setZoomTool() {
461
        if (curViewer != null) {
462
            curViewer.setTool(MapToolsRegistrant.TOOL_ZOOM_ID);
463
        }
464
    }
465

  
466
    /**
467
     * Sets the pan tool
468
     */
469
    public void setPanTool() {
470
        if (curViewer != null) {
471
            curViewer.setTool(MapToolsRegistrant.TOOL_PAN_ID);
472
        }
473
    }
474

  
475
    /**
476
     * Zoom to all thematic map contents
477
     */
478
    public void zoomAll() {
479
        if (curViewer != null) {
480
            curViewer.zoomAll();
481
        }
482
    }
483

  
484
    /**
485
     * Exit from app
486
     */
487
    public void exit() {
488
        // Close current thematic map
489
        closeMap();
490

  
491
        // clean resources
492
        try {
493
            disposeManager.releaseAll();
494
        } catch (BaseException e) {
495
            LOG.warn("Problems dispossing", e);
496
        }
497

  
498
        try {
499
            Thread.sleep(200);
500
        } catch (InterruptedException e) {
501
            // Do nothing
502
        }
503

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

Also available in: Unified diff