Revision 38353
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
|
5 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
6 |
|
|
7 |
<modelVersion>4.0.0</modelVersion> |
|
8 |
<artifactId>org.gvsig.daltransform.app.mainplugin</artifactId> |
|
9 |
<name>Transforms framework</name> |
|
10 |
<version>2.0-SNAPSHOT</version> |
|
11 |
<description>Frame which provide access to the different transformations like join, event theme, ...</description> |
|
12 |
<parent> |
|
13 |
<groupId>org.gvsig</groupId> |
|
14 |
<artifactId>org.gvsig.maven.base.extension.pom</artifactId> |
|
15 |
<version>1.0.8-SNAPSHOT</version> |
|
16 |
</parent> |
|
17 |
|
|
18 |
<scm> |
|
19 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin</connection> |
|
20 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin</developerConnection> |
|
21 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin</url> |
|
22 |
</scm> |
|
23 |
<repositories> |
|
24 |
<repository> |
|
25 |
<id>gvsig-public-http-repository</id> |
|
26 |
<name>gvSIG maven public HTTP repository</name> |
|
27 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
28 |
<releases> |
|
29 |
<enabled>true</enabled> |
|
30 |
<updatePolicy>daily</updatePolicy> |
|
31 |
<checksumPolicy>warn</checksumPolicy> |
|
32 |
</releases> |
|
33 |
<snapshots> |
|
34 |
<enabled>true</enabled> |
|
35 |
<updatePolicy>daily</updatePolicy> |
|
36 |
<checksumPolicy>warn</checksumPolicy> |
|
37 |
</snapshots> |
|
38 |
</repository> |
|
39 |
</repositories> |
|
40 |
<dependencyManagement> |
|
41 |
<dependencies> |
|
42 |
<dependency> |
|
43 |
<groupId>org.gvsig</groupId> |
|
44 |
<artifactId>org.gvsig.core.maven.dependencies</artifactId> |
|
45 |
<version>2.0.1-SNAPSHOT</version> |
|
46 |
<type>pom</type> |
|
47 |
<scope>import</scope> |
|
48 |
</dependency> |
|
49 |
</dependencies> |
|
50 |
</dependencyManagement> |
|
51 |
|
|
52 |
<dependencies> |
|
53 |
<dependency> |
|
54 |
<groupId>org.gvsig</groupId> |
|
55 |
<artifactId>org.gvsig.andami</artifactId> |
|
56 |
<scope>compile</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.app</artifactId> |
|
61 |
<version>2.0-SNAPSHOT</version> |
|
62 |
<scope>compile</scope> |
|
63 |
</dependency> |
|
64 |
<dependency> |
|
65 |
<groupId>org.gvsig</groupId> |
|
66 |
<artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId> |
|
67 |
<version>2.0.0-SNAPSHOT</version> |
|
68 |
<scope>compile</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
73 |
<scope>compile</scope> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
83 |
<scope>compile</scope> |
|
84 |
</dependency> |
|
85 |
<dependency> |
|
86 |
<groupId>org.gvsig</groupId> |
|
87 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
88 |
<scope>compile</scope> |
|
89 |
</dependency> |
|
90 |
<dependency> |
|
91 |
<groupId>org.gvsig</groupId> |
|
92 |
<artifactId>org.gvsig.i18n</artifactId> |
|
93 |
<scope>compile</scope> |
|
94 |
</dependency> |
|
95 |
<dependency> |
|
96 |
<groupId>org.gvsig</groupId> |
|
97 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
98 |
<scope>compile</scope> |
|
99 |
</dependency> |
|
100 |
<dependency> |
|
101 |
<groupId>org.gvsig</groupId> |
|
102 |
<artifactId>org.gvsig.projection</artifactId> |
|
103 |
<scope>compile</scope> |
|
104 |
</dependency> |
|
105 |
<dependency> |
|
106 |
<groupId>org.gvsig</groupId> |
|
107 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
108 |
<scope>compile</scope> |
|
109 |
</dependency> |
|
110 |
<dependency> |
|
111 |
<groupId>org.gvsig</groupId> |
|
112 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
113 |
<scope>compile</scope> |
|
114 |
</dependency> |
|
115 |
<dependency> |
|
116 |
<groupId>org.gvsig</groupId> |
|
117 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
118 |
<scope>compile</scope> |
|
119 |
</dependency> |
|
120 |
<dependency> |
|
121 |
<groupId>jwizardcomponent</groupId> |
|
122 |
<artifactId>jwizardcomponent</artifactId> |
|
123 |
<scope>compile</scope> |
|
124 |
</dependency> |
|
125 |
<dependency> |
|
126 |
<groupId>org.slf4j</groupId> |
|
127 |
<artifactId>slf4j-api</artifactId> |
|
128 |
<scope>compile</scope> |
|
129 |
</dependency> |
|
130 |
<!-- Testing --> |
|
131 |
<dependency> |
|
132 |
<groupId>org.gvsig</groupId> |
|
133 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
134 |
<classifier>tests</classifier> |
|
135 |
<scope>test</scope> |
|
136 |
</dependency> |
|
137 |
<dependency> |
|
138 |
<groupId>org.gvsig</groupId> |
|
139 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
140 |
<type>test-jar</type> |
|
141 |
<scope>test</scope> |
|
142 |
</dependency> |
|
143 |
</dependencies> |
|
144 |
<properties> |
|
145 |
<package.info.dependencies>required: |
|
146 |
org.gvsig.app.document.table.app.mainplugin -ge 2</package.info.dependencies> |
|
147 |
<package.info.state>alpha5</package.info.state> |
|
148 |
</properties> |
|
149 |
<build> |
|
150 |
<plugins> |
|
151 |
<plugin> |
|
152 |
<groupId>org.apache.maven.plugins</groupId> |
|
153 |
<artifactId>maven-jar-plugin</artifactId> |
|
154 |
<configuration> |
|
155 |
</configuration> |
|
156 |
<executions> |
|
157 |
<!-- Generates a jar file only with the test classes --> |
|
158 |
<execution> |
|
159 |
<goals> |
|
160 |
<goal>test-jar</goal> |
|
161 |
</goals> |
|
162 |
</execution> |
|
163 |
</executions> |
|
164 |
</plugin> |
|
165 |
</plugins> |
|
166 |
</build> |
|
167 |
<profiles> |
|
168 |
<profile> |
|
169 |
<id>gvsig-install</id> |
|
170 |
<activation> |
|
171 |
<activeByDefault>true</activeByDefault> |
|
172 |
</activation> |
|
173 |
<properties> |
|
174 |
<!-- Default gvSIG installation folder relative to the current workspace --> |
|
175 |
<gvsig.install.dir>${basedir}/../build/product</gvsig.install.dir> |
|
176 |
</properties> |
|
177 |
</profile> |
|
178 |
</profiles> |
|
179 |
</project> |
|
0 | 180 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<fileSet> |
|
8 |
<directory>src/main/resources</directory> |
|
9 |
<outputDirectory>${extension.install.dir.name} |
|
10 |
</outputDirectory> |
|
11 |
</fileSet> |
|
12 |
</fileSets> |
|
13 |
|
|
14 |
<files> |
|
15 |
<file> |
|
16 |
<source>package.info</source> |
|
17 |
<outputDirectory>${extension.install.dir.name} |
|
18 |
</outputDirectory> |
|
19 |
</file> |
|
20 |
</files> |
|
21 |
|
|
22 |
<dependencySets> |
|
23 |
<dependencySet> |
|
24 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
25 |
</outputDirectory> |
|
26 |
<includes> |
|
27 |
<include>org.gvsig:org.gvsig.daltransform.app.mainplugin</include> |
|
28 |
</includes> |
|
29 |
</dependencySet> |
|
30 |
</dependencySets> |
|
31 |
</assembly> |
|
0 | 32 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Tue May 29 16:39:52 CEST 2012 |
|
3 |
buildNumber=2047 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/DataTransformManager.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import org.gvsig.daltransform.swing.DataTransformGui; |
|
33 |
import org.gvsig.daltransform.swing.DataTransformWizard; |
|
34 |
import org.gvsig.daltransform.swing.JDataTransformList; |
|
35 |
import org.gvsig.daltransform.swing.JDialogDataTransformList; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
37 |
|
|
38 |
/** |
|
39 |
* This singleton provides a centralized access to register |
|
40 |
* {@link DataTransformGui} that is a class to establish |
|
41 |
* a relationship between a tranformation and a user interface. |
|
42 |
* |
|
43 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
44 |
*/ |
|
45 |
public interface DataTransformManager { |
|
46 |
|
|
47 |
/** |
|
48 |
* Register a data transformation |
|
49 |
* |
|
50 |
* @param name |
|
51 |
* the name used to register the transformation |
|
52 |
* @param featureTransformGui |
|
53 |
* the class that contains the relationship between a |
|
54 |
* transformation |
|
55 |
* and its user interface. This class has to be an instance of |
|
56 |
* {@link DataTransformGui} |
|
57 |
*/ |
|
58 |
public void registerDataTransform(String name, Class<?> dataTransformGui); |
|
59 |
|
|
60 |
/** |
|
61 |
* Register the GUI that is used to apply transformations. |
|
62 |
* |
|
63 |
* @param dataTransformWizard |
|
64 |
* the class that implements the GUI. This class has to be an |
|
65 |
* instance of {@link DataTransformWizard} |
|
66 |
*/ |
|
67 |
public void registerDataTransformWizard(Class<?> dataTransformWizard); |
|
68 |
|
|
69 |
/** |
|
70 |
* Returns a list of the registered data transformations. |
|
71 |
* |
|
72 |
* @return |
|
73 |
* A list of the registered data transformations. |
|
74 |
*/ |
|
75 |
public List<DataTransformGui> getDataTransforms(); |
|
76 |
|
|
77 |
/** |
|
78 |
* Creates a wizard that can be used to apply the transformations. |
|
79 |
* |
|
80 |
* @return |
|
81 |
* The wizard. |
|
82 |
*/ |
|
83 |
public DataTransformWizard createWizard() throws CreateWizardException; |
|
84 |
|
|
85 |
/** |
|
86 |
* It creates a wizard and selects the transformation specified |
|
87 |
* by the parameter. |
|
88 |
* |
|
89 |
* @param transformName |
|
90 |
* The name of the transformation to apply. |
|
91 |
* @return |
|
92 |
* The wizard. |
|
93 |
* @throws CreateWizardException |
|
94 |
*/ |
|
95 |
public DataTransformWizard createWizard(String transformName) |
|
96 |
throws CreateWizardException, NotRegisteredTransformException; |
|
97 |
|
|
98 |
public JDataTransformList createJDataTransformList(FeatureStore featureStore); |
|
99 |
|
|
100 |
// public JDialogDataTransformList createJDialogDataTransformList( |
|
101 |
// FeatureStore featureStore); |
|
102 |
|
|
103 |
public JDialogDataTransformList createJDialogDataTransformList(); |
|
104 |
|
|
105 |
} |
|
0 | 106 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/app/mainplugin/DataTransformExtension.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.app.mainplugin; |
|
29 |
|
|
30 |
import java.awt.Component; |
|
31 |
import java.awt.GridBagConstraints; |
|
32 |
|
|
33 |
import javax.swing.JOptionPane; |
|
34 |
|
|
35 |
import org.gvsig.andami.PluginServices; |
|
36 |
import org.gvsig.andami.plugins.Extension; |
|
37 |
import org.gvsig.andami.ui.ToolsWindowManager; |
|
38 |
import org.gvsig.app.ApplicationLocator; |
|
39 |
import org.gvsig.app.ApplicationManager; |
|
40 |
import org.gvsig.daltransform.DataTransformLocator; |
|
41 |
import org.gvsig.daltransform.DataTransformManager; |
|
42 |
import org.gvsig.daltransform.swing.JDialogDataTransformList; |
|
43 |
import org.gvsig.i18n.Messages; |
|
44 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
45 |
|
|
46 |
/** |
|
47 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
48 |
*/ |
|
49 |
public class DataTransformExtension extends Extension { |
|
50 |
|
|
51 |
/* |
|
52 |
* (non-Javadoc) |
|
53 |
* |
|
54 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
|
55 |
*/ |
|
56 |
public void execute(String actionCommand) { |
|
57 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
58 |
DataTransformManager manager = |
|
59 |
DataTransformLocator.getDataTransformManager(); |
|
60 |
|
|
61 |
if ("CREATE".equalsIgnoreCase(actionCommand)) { |
|
62 |
try { |
|
63 |
PluginServices.getMDIManager().addWindow( |
|
64 |
manager.createWizard().getWindow()); |
|
65 |
|
|
66 |
} catch (Exception e) { |
|
67 |
JOptionPane.showInternalMessageDialog( |
|
68 |
(Component) PluginServices.getMDIManager(), |
|
69 |
Messages.getText("transform_create_wizard_exception"), |
|
70 |
Messages.getText("feature_transform"), |
|
71 |
JOptionPane.ERROR_MESSAGE); |
|
72 |
} |
|
73 |
} else |
|
74 |
if ("VIEW".equalsIgnoreCase(actionCommand)) { |
|
75 |
|
|
76 |
// there is no layer loaded |
|
77 |
if (application.getActiveDocument() == null) { |
|
78 |
JOptionPane.showMessageDialog(null, |
|
79 |
Messages.getText("not_featurestore_loaded"), |
|
80 |
Messages.getText("view_transforms"), |
|
81 |
JOptionPane.OK_OPTION + JOptionPane.WARNING_MESSAGE); |
|
82 |
return; |
|
83 |
} |
|
84 |
|
|
85 |
JDialogDataTransformList dialog = |
|
86 |
manager.createJDialogDataTransformList(); |
|
87 |
|
|
88 |
ToolsWindowManager wm = new ToolsWindowManager(); |
|
89 |
wm.showWindow(dialog, Messages.getText("view_transforms"), |
|
90 |
WindowManager.MODE.WINDOW, GridBagConstraints.CENTER); |
|
91 |
} |
|
92 |
|
|
93 |
} |
|
94 |
|
|
95 |
/* |
|
96 |
* (non-Javadoc) |
|
97 |
* |
|
98 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
99 |
*/ |
|
100 |
public void initialize() { |
|
101 |
registerIcons(); |
|
102 |
} |
|
103 |
|
|
104 |
/* |
|
105 |
* (non-Javadoc) |
|
106 |
* |
|
107 |
* @see com.iver.andami.plugins.Extension#postInitialize() |
|
108 |
*/ |
|
109 |
@Override |
|
110 |
public void postInitialize() { |
|
111 |
super.postInitialize(); |
|
112 |
} |
|
113 |
|
|
114 |
private void registerIcons() { |
|
115 |
PluginServices.getIconTheme().registerDefault( |
|
116 |
"feature-transform", |
|
117 |
this.getClass().getClassLoader() |
|
118 |
.getResource("images/transform.png")); |
|
119 |
} |
|
120 |
|
|
121 |
/* |
|
122 |
* (non-Javadoc) |
|
123 |
* |
|
124 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
|
125 |
*/ |
|
126 |
public boolean isEnabled() { |
|
127 |
return true; |
|
128 |
} |
|
129 |
|
|
130 |
/* |
|
131 |
* (non-Javadoc) |
|
132 |
* |
|
133 |
* @see com.iver.andami.plugins.IExtension#isVisible() |
|
134 |
*/ |
|
135 |
public boolean isVisible() { |
|
136 |
return true; |
|
137 |
} |
|
138 |
} |
|
0 | 139 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/impl/DefaultDataTransformManager.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.impl; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.Iterator; |
|
32 |
import java.util.List; |
|
33 |
|
|
34 |
import org.slf4j.Logger; |
|
35 |
import org.slf4j.LoggerFactory; |
|
36 |
|
|
37 |
import org.gvsig.daltransform.CreateWizardException; |
|
38 |
import org.gvsig.daltransform.DataTransformManager; |
|
39 |
import org.gvsig.daltransform.NotRegisteredTransformException; |
|
40 |
import org.gvsig.daltransform.swing.DataTransformGui; |
|
41 |
import org.gvsig.daltransform.swing.DataTransformWizard; |
|
42 |
import org.gvsig.daltransform.swing.JDataTransformList; |
|
43 |
import org.gvsig.daltransform.swing.JDialogDataTransformList; |
|
44 |
import org.gvsig.daltransform.swing.impl.DefaultJDataTransformList; |
|
45 |
import org.gvsig.daltransform.swing.impl.DefaultJDialogDataTransformList; |
|
46 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
47 |
import org.gvsig.tools.ToolsLocator; |
|
48 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
49 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
50 |
|
|
51 |
/** |
|
52 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
53 |
*/ |
|
54 |
public class DefaultDataTransformManager implements DataTransformManager{ |
|
55 |
private static final String TRANSFORM_GUI_EXTENSION_POINT = "TransformGuiExtensionPoint"; |
|
56 |
private static final String TRANSFORM_WIZARD_EXTENSION_POINT = "TransformWizardExtensionPoint"; |
|
57 |
private static final String TRANSFORM_WIZARD_NAME = "Wizard"; |
|
58 |
private static final Logger logger = LoggerFactory.getLogger(DefaultDataTransformManager.class); |
|
59 |
private ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
60 |
|
|
61 |
/* |
|
62 |
* (non-Javadoc) |
|
63 |
* @see org.gvsig.feature.transform.FeatureTransformManager#registerFeatureTransform(java.lang.String, java.lang.Class) |
|
64 |
*/ |
|
65 |
public void registerDataTransform(String name, |
|
66 |
Class<?> featureTransformPage) { |
|
67 |
if (!DataTransformGui.class.isAssignableFrom(featureTransformPage)) { |
|
68 |
throw new IllegalArgumentException(featureTransformPage.getName() |
|
69 |
+ " must implement the DataTransformGui interface"); |
|
70 |
} |
|
71 |
|
|
72 |
ExtensionPoint extensionPoint = extensionPoints.add(TRANSFORM_GUI_EXTENSION_POINT, ""); |
|
73 |
extensionPoint.append(name, name, featureTransformPage); |
|
74 |
} |
|
75 |
|
|
76 |
/* |
|
77 |
* (non-Javadoc) |
|
78 |
* @see org.gvsig.feature.transform.FeatureTransformManager#getFeatureTransforms() |
|
79 |
*/ |
|
80 |
@SuppressWarnings("unchecked") |
|
81 |
public List<DataTransformGui> getDataTransforms() { |
|
82 |
List<DataTransformGui> transformArray = new ArrayList<DataTransformGui>(); |
|
83 |
|
|
84 |
ExtensionPoint ep = extensionPoints.add(TRANSFORM_GUI_EXTENSION_POINT); |
|
85 |
Iterator<ExtensionPoint.Extension> iterator = ep.iterator(); |
|
86 |
while (iterator.hasNext()) { |
|
87 |
try { |
|
88 |
transformArray.add((DataTransformGui)((ExtensionPoint.Extension) iterator |
|
89 |
.next()).create()); |
|
90 |
} catch (Exception e) { |
|
91 |
logger.error("Error creating a FeatureTranformationGui", e); |
|
92 |
} |
|
93 |
} |
|
94 |
return transformArray; |
|
95 |
} |
|
96 |
|
|
97 |
/* |
|
98 |
* (non-Javadoc) |
|
99 |
* @see org.gvsig.app.daltransform.DataTransformManager#createWizard() |
|
100 |
*/ |
|
101 |
public DataTransformWizard createWizard() throws CreateWizardException { |
|
102 |
ExtensionPoint ep = extensionPoints.add(TRANSFORM_WIZARD_EXTENSION_POINT); |
|
103 |
try { |
|
104 |
return (DataTransformWizard)ep.create(TRANSFORM_WIZARD_NAME); |
|
105 |
} catch (Exception e) { |
|
106 |
throw new CreateWizardException(e); |
|
107 |
} |
|
108 |
} |
|
109 |
|
|
110 |
/* (non-Javadoc) |
|
111 |
* @see org.gvsig.app.daltransform.DataTransformManager#registerDataTransformWizard(java.lang.String, java.lang.Class) |
|
112 |
*/ |
|
113 |
public void registerDataTransformWizard(Class<?> dataTransformWizard) { |
|
114 |
if (!DataTransformWizard.class.isAssignableFrom(dataTransformWizard)) { |
|
115 |
throw new IllegalArgumentException(dataTransformWizard.getName() |
|
116 |
+ " must implement the DataTransformWizard interface"); |
|
117 |
} |
|
118 |
|
|
119 |
ExtensionPoint extensionPoint = extensionPoints.add(TRANSFORM_WIZARD_EXTENSION_POINT, ""); |
|
120 |
extensionPoint.append(TRANSFORM_WIZARD_NAME, "", dataTransformWizard); |
|
121 |
} |
|
122 |
|
|
123 |
/* (non-Javadoc) |
|
124 |
* @see org.gvsig.app.daltransform.DataTransformManager#createWizard(java.lang.String) |
|
125 |
*/ |
|
126 |
public DataTransformWizard createWizard(String transformName) |
|
127 |
throws CreateWizardException { |
|
128 |
ExtensionPoint ep = extensionPoints.add(TRANSFORM_GUI_EXTENSION_POINT); |
|
129 |
try { |
|
130 |
Object obj = ep.create(transformName); |
|
131 |
if (obj == null){ |
|
132 |
throw new NotRegisteredTransformException(transformName); |
|
133 |
} |
|
134 |
DataTransformGui dataTransformGui = (DataTransformGui)obj; |
|
135 |
DataTransformWizard wizard = createWizard(); |
|
136 |
wizard.setDataTransformGui(dataTransformGui); |
|
137 |
return wizard; |
|
138 |
} catch (Exception e) { |
|
139 |
throw new CreateWizardException(e); |
|
140 |
} |
|
141 |
} |
|
142 |
|
|
143 |
public JDataTransformList createJDataTransformList(FeatureStore featureStore) { |
|
144 |
return new DefaultJDataTransformList(featureStore); |
|
145 |
} |
|
146 |
|
|
147 |
public JDialogDataTransformList createJDialogDataTransformList() { |
|
148 |
return new DefaultJDialogDataTransformList(); |
|
149 |
} |
|
150 |
|
|
151 |
// public JDialogDataTransformList createJDialogDataTransformList( |
|
152 |
// FeatureStore featureStore) { |
|
153 |
// return new DefaultJDialogDataTransformList(featureStore); |
|
154 |
// } |
|
155 |
} |
|
156 |
|
|
0 | 157 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/impl/DefaultDataTransformLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.impl; |
|
29 |
|
|
30 |
import org.gvsig.app.ApplicationLibrary; |
|
31 |
import org.gvsig.daltransform.DataTransformLibrary; |
|
32 |
import org.gvsig.daltransform.DataTransformLocator; |
|
33 |
import org.gvsig.daltransform.DataTransformManager; |
|
34 |
import org.gvsig.daltransform.swing.impl.DefaultDataTransformWizard; |
|
35 |
import org.gvsig.fmap.dal.DALLibrary; |
|
36 |
import org.gvsig.tools.library.AbstractLibrary; |
|
37 |
import org.gvsig.tools.library.LibraryException; |
|
38 |
|
|
39 |
/** |
|
40 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
41 |
*/ |
|
42 |
public class DefaultDataTransformLibrary extends AbstractLibrary { |
|
43 |
|
|
44 |
@Override |
|
45 |
public void doRegistration() { |
|
46 |
registerAsImplementationOf(DataTransformLibrary.class); |
|
47 |
require(DALLibrary.class); |
|
48 |
require(ApplicationLibrary.class); |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
protected void doInitialize() throws LibraryException { |
|
53 |
//Register the default DataTransformManager |
|
54 |
DataTransformLocator.registerDataTransformManager(DefaultDataTransformManager.class); |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
protected void doPostInitialize() throws LibraryException { |
|
59 |
DataTransformManager dataTransformManager = DataTransformLocator.getDataTransformManager(); |
|
60 |
|
|
61 |
//Register the default wizard to apply transformations |
|
62 |
dataTransformManager.registerDataTransformWizard(DefaultDataTransformWizard.class); |
|
63 |
} |
|
64 |
} |
|
65 |
|
|
0 | 66 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/CreateWizardException.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform; |
|
29 |
|
|
30 |
import org.gvsig.tools.exception.BaseException; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class CreateWizardException extends BaseException{ |
|
36 |
private static final long serialVersionUID = 3062621423281216473L; |
|
37 |
|
|
38 |
/** |
|
39 |
* @param message |
|
40 |
* @param cause |
|
41 |
* @param key |
|
42 |
* @param code |
|
43 |
*/ |
|
44 |
public CreateWizardException(Throwable cause) { |
|
45 |
init(); |
|
46 |
initCause(cause); |
|
47 |
} |
|
48 |
|
|
49 |
private void init() { |
|
50 |
messageKey = "transform_create_wizard_exception"; |
|
51 |
formatString = "Can?t create the wizard to apply transformations."; |
|
52 |
} |
|
53 |
|
|
54 |
} |
|
55 |
|
|
0 | 56 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/NumericFeatureTypeAttributesCombo.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.DataTypes; |
|
31 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
35 |
*/ |
|
36 |
public class NumericFeatureTypeAttributesCombo extends FeatureTypeAttributesCombo{ |
|
37 |
|
|
38 |
/** |
|
39 |
* |
|
40 |
*/ |
|
41 |
private static final long serialVersionUID = -1694488470656611290L; |
|
42 |
|
|
43 |
/* (non-Javadoc) |
|
44 |
* @see org.gvsig.app.daltransform.gui.combos.FeatureTypeAttributesCombo#addFeatureAttributeDescriptor(org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor) |
|
45 |
*/ |
|
46 |
public void addFeatureAttributeDescriptor( |
|
47 |
FeatureAttributeDescriptor featureAttributeDescriptor) { |
|
48 |
int type = featureAttributeDescriptor.getType(); |
|
49 |
if ((type == DataTypes.DOUBLE) || |
|
50 |
(type == DataTypes.FLOAT) || |
|
51 |
(type == DataTypes.INT) || |
|
52 |
(type == DataTypes.LONG)){ |
|
53 |
super.addFeatureAttributeDescriptor(featureAttributeDescriptor); |
|
54 |
} |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
0 | 58 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeCombo.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import javax.swing.DefaultComboBoxModel; |
|
33 |
import javax.swing.JComboBox; |
|
34 |
|
|
35 |
import org.gvsig.fmap.dal.exception.DataException; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
38 |
import org.slf4j.Logger; |
|
39 |
import org.slf4j.LoggerFactory; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
43 |
*/ |
|
44 |
public class FeatureTypeCombo extends JComboBox{ |
|
45 |
/** |
|
46 |
* |
|
47 |
*/ |
|
48 |
private static final long serialVersionUID = -3689986732982756932L; |
|
49 |
protected static final Logger logger = LoggerFactory.getLogger(FeatureTypeCombo.class); |
|
50 |
|
|
51 |
public FeatureTypeCombo() { |
|
52 |
super(); |
|
53 |
this.setModel(new DefaultComboBoxModel()); |
|
54 |
} |
|
55 |
|
|
56 |
@SuppressWarnings("unchecked") |
|
57 |
public void addFeatureStore(FeatureStore featureStore){ |
|
58 |
removeAllItems(); |
|
59 |
List<FeatureType> featureTypes; |
|
60 |
try { |
|
61 |
featureTypes = featureStore.getFeatureTypes(); |
|
62 |
for (int i=0 ; i<featureTypes.size() ; i++){ |
|
63 |
((DefaultComboBoxModel)getModel()).addElement(featureTypes.get(i)); |
|
64 |
} |
|
65 |
} catch (DataException e) { |
|
66 |
logger.error("Error updating the panel", e); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public FeatureType getSelectedFeatureType(){ |
|
71 |
return (FeatureType)getSelectedItem(); |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
0 | 75 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeWrapper.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class FeatureTypeWrapper { |
|
36 |
private FeatureType featureType = null; |
|
37 |
|
|
38 |
/** |
|
39 |
* @param featureType |
|
40 |
*/ |
|
41 |
public FeatureTypeWrapper(FeatureType featureType) { |
|
42 |
super(); |
|
43 |
this.featureType = featureType; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @return the featureType |
|
48 |
*/ |
|
49 |
public FeatureType getFeatureType() { |
|
50 |
return featureType; |
|
51 |
} |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see java.lang.Object#toString() |
|
55 |
*/ |
|
56 |
public String toString() { |
|
57 |
return featureType.toString(); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
0 | 61 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeAttributesList.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
|
|
32 |
import javax.swing.DefaultListModel; |
|
33 |
import javax.swing.JList; |
|
34 |
|
|
35 |
import org.gvsig.fmap.dal.exception.DataException; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
42 |
*/ |
|
43 |
public class FeatureTypeAttributesList extends JList { |
|
44 |
|
|
45 |
/** |
|
46 |
* |
|
47 |
*/ |
|
48 |
private static final long serialVersionUID = -3457322116557877761L; |
|
49 |
|
|
50 |
public FeatureTypeAttributesList() { |
|
51 |
super(); |
|
52 |
setModel(new DefaultListModel()); |
|
53 |
} |
|
54 |
|
|
55 |
public void addFeatureAttrubutes(FeatureStore featureStore) throws DataException{ |
|
56 |
addFeatureAttributes(featureStore.getDefaultFeatureType()); |
|
57 |
} |
|
58 |
|
|
59 |
public void addFeatureAttributes(FeatureType featureType){ |
|
60 |
removeAll(); |
|
61 |
FeatureAttributeDescriptor[] descriptors = featureType.getAttributeDescriptors(); |
|
62 |
for (int i=0 ; i<descriptors.length ; i++){ |
|
63 |
addFeatureAttributeDescriptor(descriptors[i]); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
public void addFeatureAttributeDescriptor(FeatureAttributeDescriptor featureAttributeDescriptor){ |
|
68 |
((DefaultListModel)getModel()).addElement(new FeatureTypeAttributeWrapper(featureAttributeDescriptor)); |
|
69 |
} |
|
70 |
|
|
71 |
public ArrayList<FeatureAttributeDescriptor> getSelectedFeatureTypes(){ |
|
72 |
ArrayList<FeatureAttributeDescriptor> featureTypes = new ArrayList<FeatureAttributeDescriptor>(); |
|
73 |
Object[] objects = getSelectedValues(); |
|
74 |
for (int i=0 ; i<objects.length ; i++){ |
|
75 |
featureTypes.add(((FeatureTypeAttributeWrapper)objects[i]).getFeatureAttributeDescriptor()); |
|
76 |
} |
|
77 |
return featureTypes; |
|
78 |
} |
|
79 |
|
|
80 |
public String[] getAttributesName(){ |
|
81 |
Object[] objects = getSelectedValues(); |
|
82 |
String[] featureTypes = new String[objects.length]; |
|
83 |
for (int i=0 ; i<objects.length ; i++){ |
|
84 |
featureTypes[i] = ((FeatureTypeAttributeWrapper)objects[i]).getFeatureAttributeDescriptor().getName(); |
|
85 |
} |
|
86 |
return featureTypes; |
|
87 |
} |
|
88 |
} |
|
89 |
|
|
0 | 90 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeAttributeWrapper.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class FeatureTypeAttributeWrapper { |
|
36 |
private FeatureAttributeDescriptor attributeDescriptor = null; |
|
37 |
|
|
38 |
/** |
|
39 |
* @param featureType |
|
40 |
*/ |
|
41 |
public FeatureTypeAttributeWrapper(FeatureAttributeDescriptor attributeDescriptor) { |
|
42 |
super(); |
|
43 |
this.attributeDescriptor = attributeDescriptor; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @return the featureType |
|
48 |
*/ |
|
49 |
public FeatureAttributeDescriptor getFeatureAttributeDescriptor() { |
|
50 |
return attributeDescriptor; |
|
51 |
} |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see java.lang.Object#toString() |
|
55 |
*/ |
|
56 |
public String toString() { |
|
57 |
return attributeDescriptor.getName(); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
0 | 61 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeAttributesCombo.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import javax.swing.DefaultComboBoxModel; |
|
31 |
import javax.swing.JComboBox; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.exception.DataException; |
|
34 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
37 |
import org.slf4j.Logger; |
|
38 |
import org.slf4j.LoggerFactory; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
42 |
*/ |
|
43 |
public class FeatureTypeAttributesCombo extends JComboBox { |
|
44 |
/** |
|
45 |
* |
|
46 |
*/ |
|
47 |
private static final long serialVersionUID = -8843843810490892699L; |
|
48 |
protected static final Logger logger = LoggerFactory.getLogger(FeatureTypeAttributesCombo.class); |
|
49 |
|
|
50 |
public FeatureTypeAttributesCombo() { |
|
51 |
super(); |
|
52 |
this.setModel(new DefaultComboBoxModel()); |
|
53 |
} |
|
54 |
|
|
55 |
public void addFeatureAttrubutes(FeatureStore featureStore) throws DataException{ |
|
56 |
addFeatureAttributes(featureStore.getDefaultFeatureType()); |
|
57 |
} |
|
58 |
|
|
59 |
public void addFeatureAttributes(FeatureType featureType){ |
|
60 |
removeAllItems(); |
|
61 |
FeatureAttributeDescriptor[] descriptors = featureType.getAttributeDescriptors(); |
|
62 |
for (int i=0 ; i<descriptors.length ; i++){ |
|
63 |
addFeatureAttributeDescriptor(descriptors[i]); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
public void addFeatureAttributeDescriptor(FeatureAttributeDescriptor featureAttributeDescriptor){ |
|
68 |
((DefaultComboBoxModel)getModel()).addElement(new FeatureTypeAttributeWrapper(featureAttributeDescriptor)); |
|
69 |
} |
|
70 |
|
|
71 |
public FeatureAttributeDescriptor getSelectedFeatureAttributeDescriptor(){ |
|
72 |
return ((FeatureTypeAttributeWrapper)getSelectedItem()).getFeatureAttributeDescriptor(); |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
0 | 76 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/SelectDataStoreWizardPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import javax.swing.DefaultListModel; |
|
33 |
import javax.swing.JList; |
|
34 |
import javax.swing.JScrollPane; |
|
35 |
|
|
36 |
import org.gvsig.andami.PluginServices; |
|
37 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
38 |
import org.gvsig.app.project.ProjectManager; |
|
39 |
import org.gvsig.app.project.documents.Document; |
|
40 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
41 |
import org.gvsig.app.project.documents.table.TableManager; |
|
42 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
43 |
import org.gvsig.daltransform.swing.DataTransformGui; |
|
44 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
45 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
46 |
import org.gvsig.fmap.mapcontext.layers.LayersIterator; |
|
47 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
48 |
|
|
49 |
|
|
50 |
/** |
|
51 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
52 |
*/ |
|
53 |
public class SelectDataStoreWizardPanel extends AbstractDataTransformWizardPanel{ |
|
54 |
private static final long serialVersionUID = -1841990357325903449L; |
|
55 |
private JList dataStoreList; |
|
56 |
private JScrollPane dataStoreScrollPane; |
|
57 |
|
|
58 |
/** |
|
59 |
* @param wizardComponents |
|
60 |
*/ |
|
61 |
public SelectDataStoreWizardPanel() { |
|
62 |
super(); |
|
63 |
initComponents(); |
|
64 |
} |
|
65 |
|
|
66 |
private void initComponents() { |
|
67 |
java.awt.GridBagConstraints gridBagConstraints; |
|
68 |
|
|
69 |
dataStoreScrollPane = new javax.swing.JScrollPane(); |
|
70 |
dataStoreList = new javax.swing.JList(); |
|
71 |
|
|
72 |
setLayout(new java.awt.GridBagLayout()); |
|
73 |
|
|
74 |
dataStoreScrollPane.setViewportView(dataStoreList); |
|
75 |
|
|
76 |
dataStoreList.setModel(new DefaultListModel()); |
|
77 |
|
|
78 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
79 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
|
80 |
gridBagConstraints.weightx = 1.0; |
|
81 |
gridBagConstraints.weighty = 1.0; |
|
82 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
83 |
add(dataStoreScrollPane, gridBagConstraints); |
|
84 |
} |
|
85 |
|
|
86 |
public void removeFeatureStore(FeatureStore featureStore){ |
|
87 |
DefaultListModel model =( DefaultListModel)dataStoreList.getModel(); |
|
88 |
for (int i=model.getSize()-1 ; i>=0 ; i--){ |
|
89 |
if (((FeatureStoreCombo)model.get(i)).getFeatureStore().equals(featureStore)){ |
|
90 |
model.remove(i); |
|
91 |
break; |
|
92 |
} |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* Adding the objects |
|
98 |
*/ |
|
99 |
private void addDataStores(){ |
|
100 |
((DefaultListModel)dataStoreList.getModel()).removeAllElements(); |
|
101 |
DataTransformGui dataTransformGui = |
|
102 |
getDataTransformWizard().getDataTransformGui(); |
|
103 |
|
|
104 |
//Add all the tables |
|
105 |
List<Document> tables = ProjectManager.getInstance().getCurrentProject() |
|
106 |
.getDocuments(TableManager.TYPENAME); |
|
107 |
for (Document table : tables) { |
|
108 |
if (dataTransformGui.accept(((TableDocument)table).getStore())){ |
|
109 |
((DefaultListModel)dataStoreList.getModel()).addElement( |
|
110 |
new FeatureStoreCombo( |
|
111 |
table.getName(), |
|
112 |
((TableDocument)table).getStore(), |
|
113 |
false |
|
114 |
) |
|
115 |
); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
//Add the layers from the current view |
|
120 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
121 |
if (window instanceof IView){ |
|
122 |
IView view = (IView)window; |
|
123 |
LayersIterator it = new LayersIterator( |
|
124 |
view.getMapControl().getMapContext().getLayers()); |
|
125 |
while(it.hasNext()){ |
|
126 |
FLayer layer = it.nextLayer(); |
|
127 |
if (layer instanceof FLyrVect){ |
|
128 |
FLyrVect layerVect = (FLyrVect)layer; |
|
129 |
FeatureStore featureStore = layerVect.getFeatureStore(); |
|
130 |
boolean found = false; |
|
131 |
for (int i=0 ; i<tables.size() ; i++){ |
|
132 |
TableDocument table = (TableDocument)tables.get(i); |
|
133 |
if (table.getStore().equals(featureStore)) { |
|
134 |
found = true; |
|
135 |
} |
|
136 |
} |
|
137 |
if (!found){ |
|
138 |
if (dataTransformGui.accept(featureStore)){ |
|
139 |
((DefaultListModel)dataStoreList.getModel()).addElement( |
|
140 |
new FeatureStoreCombo(layerVect.getName(), |
|
141 |
featureStore, |
|
142 |
true)); |
|
143 |
} |
|
144 |
} |
|
145 |
} |
|
146 |
} |
|
147 |
} |
|
148 |
} |
|
149 |
|
|
150 |
|
|
151 |
/** |
|
152 |
* @return the selected feature store |
|
153 |
*/ |
|
154 |
public FeatureStore getSelectedFeatureStore(){ |
|
155 |
Object obj = dataStoreList.getSelectedValue(); |
|
156 |
if (obj != null){ |
|
157 |
return ((FeatureStoreCombo)obj).getFeatureStore(); |
|
158 |
} |
|
159 |
return null; |
|
160 |
} |
|
161 |
|
|
162 |
/* (non-Javadoc) |
|
163 |
* @see org.gvsig.app.daltransform.impl.AbstractDataTransformWizardPanel#getFeatureStore() |
|
164 |
*/ |
|
165 |
@Override |
|
166 |
public FeatureStore getFeatureStore() { |
|
167 |
return getSelectedFeatureStore(); |
|
168 |
} |
|
169 |
|
|
170 |
/** |
|
171 |
* @return the selected feature store |
|
172 |
*/ |
|
173 |
public boolean isSelectedFeatureStoreLoaded(){ |
|
174 |
Object obj = dataStoreList.getSelectedValue(); |
|
175 |
if (obj != null){ |
|
176 |
return ((FeatureStoreCombo)obj).isLoaded(); |
|
177 |
} |
|
178 |
return false; |
|
179 |
} |
|
180 |
|
|
181 |
/** |
|
182 |
* Used to fill the combo |
|
183 |
* @author jpiera |
|
184 |
*/ |
|
185 |
private class FeatureStoreCombo{ |
|
186 |
private FeatureStore featureStore = null; |
|
187 |
private String name = null; |
|
188 |
private boolean isLoaded = false; |
|
189 |
|
|
190 |
public FeatureStoreCombo(String name, FeatureStore featureStore, boolean isLoaded) { |
|
191 |
super(); |
|
192 |
this.name = name; |
|
193 |
this.featureStore = featureStore; |
|
194 |
this.isLoaded = isLoaded; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* @return the isLoaded |
|
199 |
*/ |
|
200 |
public boolean isLoaded() { |
Also available in: Unified diff