Revision 33817

View differences:

tags/v2_0_0_Build_2020/extensions/extDalTransform/distribution/distribution.xml
1
<assembly>
2
	<id>distribution</id>
3
	<formats>
4
		<format>dir</format>
5
	</formats>
6
	<fileSets>
7
	<!-- Extructure for the extension -->
8
		<fileSet>
9
			<directory>config</directory>
10
			<outputDirectory>${extension.install.dir.name}
11
			</outputDirectory>
12
		</fileSet>
13
		<fileSet>
14
			<directory>images</directory>
15
			<outputDirectory>/${extension.install.dir.name}/images
16
			</outputDirectory>
17
		</fileSet>
18
	</fileSets>
19
    <files>
20
        <file>
21
            <source>package.info</source>
22
            <outputDirectory>${extension.install.dir.name}
23
            </outputDirectory>
24
        </file>
25
    </files>
26
	
27
	<dependencySets>
28
		<dependencySet>
29
			<outputDirectory>${extension.install.dir.name}/${library-dir}
30
			</outputDirectory>
31
			<includes>
32
				<include>org.gvsig:org.gvsig.app.daltransform</include>				
33
			</includes>
34
		</dependencySet>		
35
	</dependencySets>
36
</assembly>
0 37

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Tue Oct 26 12:07:42 CEST 2010
3
buildNumber=2020
tags/v2_0_0_Build_2020/extensions/extDalTransform/src-test/org/gvsig/app/daltransform/BaseFeatureStoreTransform.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.app.daltransform;
29

  
30
import org.gvsig.fmap.dal.DataStoreParameters;
31
import org.gvsig.fmap.dal.exception.DataException;
32
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
33
import org.gvsig.fmap.dal.feature.BaseTestFeatureStore;
34
import org.gvsig.fmap.dal.feature.FeatureStore;
35
import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
36
import org.gvsig.tools.ToolsLocator;
37
import org.gvsig.tools.persistence.PersistentState;
38

  
39
/**
40
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
41
 */
42
public abstract class BaseFeatureStoreTransform extends BaseTestFeatureStore {
43
	public abstract DataStoreParameters getDefaultDataStoreParameters() throws DataException;
44
		
45
	public void testInitializeStore() throws Exception {
46
		FeatureStore store = (FeatureStore) dataManager.createStore(this
47
				.getDefaultDataStoreParameters());
48
		assertNotNull(store);
49
		store.dispose();
50
	}
51
	
52
	public abstract FeatureStoreTransform getFeatureStoreTransform() throws DataException, ValidateDataParametersException;
53
	
54
	public void testTransform() throws Exception {
55
		FeatureStore store = (FeatureStore) dataManager.createStore(this
56
				.getDefaultDataStoreParameters());
57
		store.getTransforms().add(getFeatureStoreTransform());
58
		this.testSimpleIteration(store);		
59
	}
60
	
61
	public void testPersistenceTransform() throws Exception {
62
		if (ToolsLocator.getPersistenceManager() == null) {
63
			fail("Default Persistence Manager not register");
64
		}
65
		FeatureStore store = (FeatureStore) dataManager.createStore(this
66
				.getDefaultDataStoreParameters());
67
		store.getTransforms().add(getFeatureStoreTransform());
68

  
69
		testSimpleIteration(store);
70

  
71
		PersistentState state = ToolsLocator.getPersistenceManager().getState(
72
				store);
73

  
74
		FeatureStore store2 = (FeatureStore) ToolsLocator
75
				.getPersistenceManager().create(state);
76

  
77
		testSimpleIteration(store2);
78

  
79
		assertTrue(compareStores(store, store2));
80

  
81
		store.dispose();
82
		store2.dispose();
83
	}
84

  
85
	/* (non-Javadoc)
86
	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
87
	 */
88
	public boolean hasExplorer() {
89
		// TODO Auto-generated method stub
90
		return false;
91
	}
92

  
93
	/* (non-Javadoc)
94
	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#usesResources()
95
	 */	
96
	public boolean usesResources() {		
97
		return false;
98
	}	
99
	
100
	
101
}
102

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<libraries library-dir="lib"/>
4
	<depends plugin-name="org.gvsig.app" />
5
	<resourceBundle name="text"/>	
6
	<extensions>		
7
		<extension class-name="org.gvsig.app.daltransform.extension.DataTransformExtension"
8
			description=""
9
			active="true">
10
			<menu text="tools/feature_transform" />
11
		</extension>
12
	</extensions>	
13
</plugin-config>
0 14

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/config/text.properties
1

  
2
transform_wizard=Aplicar una transformaci?n
3
transform_selection=Selecciona una transformaci?n
4
transform_datastore_selection=Selecciona un origen de datos
5
transform_parameters=Selecciona los par?metros de la transformaci?n
6
feature_transform=Transformaciones
7
transform_apply=Aplicar la transformaci?n
8
transform_load_layer_query=Cargar el resultado de la transformaci?n como una capa
9
transform_layer=Ha aplicado una transformaci?n sobre una capa. Si contin?a, el resultado de la transformaci?n de aplicar? sobre la capa.
10
transform_layout_geometry=Ha aplicado una transformaci?n sobre una tabla. La transformaci?n resultante tiene un atributo de tipo geometr?a, por lo que se podr? cargar en una vista.
11
transform_layout_no_geometry=Ha aplicado una transformaci?n sobre una tabla. La transformaci?n resultante NO tiene un atributo de tipo geometr?a, por lo que NO se podr? cargar en la vista activa.
12
transform_layout_not_view_to_load=Ha aplicado una transformaci?n sobre una tabla. La transformaci?n resultante tiene un atributo de tipo geometr?a pero no hay ninguna vista creada por lo que no se podr? cargar. Si quiere visualizarla, cree una vista y vuelva a aplicar la transformaci?n.
13
transform_view_to_load=Selecciona la vista en la que quiere cargar la transformaci?n
14
transform_second_datastore_selection=Selecciona el segundo origen de datos
15
join_description=La uni?n entre tablas crea una nueva tabla a partir de dos tablas de origen. Para ello es necesario que ambas tengan un campo con el que poder hacer la uni?n.
16
join_name=Uni?n
17
join_first_key=Selecciona la clave de la primera tabla
18
join_second_key=Selecciona la clave de la segunda tabla
19
join_first_prefix=Escriba el prefijo de la primera tabla
20
join_second_prefix=Escriba el prefijo de la segunda tabla
21
join_select_attributes=Selecciona los atributos a unir
22
transform_create_wizard_exception=Excepci?n creando el wizard para aplicar trasnformaciones.
0 23

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/package.info
1
#
2
#Tue Oct 26 12:07:43 CEST 2010
3
state=devel
4
name=extDalTransform
5
official=true
6
code=org.gvsig.app.daltransform
7
operating-system=all
8
architecture=all
9
java-version=j1_5
10
gvSIG-version=2.0.0
11
version=2.0-SNAPSHOT
12
type=plugin
13
build=2020
14
description=Base POM for all GvSIG extension projects. This pom knows\n\t\thow to build and made an extension for GvSIG. The property\n\t\t"build-dir" must be set up correctly.
tags/v2_0_0_Build_2020/extensions/extDalTransform/src/org/gvsig/app/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.app.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_2020/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/DataTransformGui.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.app.daltransform.gui;
29

  
30
import java.awt.Dimension;
31
import java.util.List;
32

  
33
import org.gvsig.fmap.dal.exception.DataException;
34
import org.gvsig.fmap.dal.feature.FeatureStore;
35
import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
36

  
37
/**
38
 * This interface is used to establish a relationship between 
39
 * feature transformations and their user interfaces. It creates 
40
 * the panels that are used to set the parameters that the 
41
 * transformation needs. 
42
 * 
43
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
44
 */
45
public interface DataTransformGui {
46
    
47
	/**
48
	 * Creates a feature transformation from a feature store. The
49
	 * class that implements this interface can create a transformation
50
	 * using this feature store and all the parameters that the user has
51
	 * selected. All these parameters must be known by this class
52
	 * @param featureStore
53
	 * The selected feature store
54
	 * @return
55
	 * the transformation
56
	 * @throws DataException
57
	 */
58
	public FeatureStoreTransform createFeatureStoreTransform(FeatureStore featureStore) throws DataException;
59
		
60
    /**
61
     * Creates a list of panels to set the parameters used on the transformation.
62
     * @return
63
     * a set of panels with the parameters of the transformation
64
     */
65
	public List<DataTransformWizardPanel> createPanels();
66

  
67
	/**
68
	 * @return the name that is displayed in the feature transformation
69
	 * list
70
	 */
71
	public String getName();
72
	
73
	/**
74
	 * @return a description of the feature transformation
75
	 */
76
	public String getDescription();
77
	
78
	/**
79
	 * Returns the minimum size that has to be the wizard to display
80
	 * the forms.
81
	 * @return
82
	 * The minimum size for the panels. 
83
	 */
84
	public Dimension getMinDimension();
85
}
86

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/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.app.daltransform.gui.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.fmap.dal.feature.FeatureStore;
44
import org.gvsig.fmap.mapcontext.layers.FLayer;
45
import org.gvsig.fmap.mapcontext.layers.LayersIterator;
46
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
47

  
48

  
49
/**
50
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
51
 */
52
public class SelectDataStoreWizardPanel extends AbstractDataTransformWizardPanel{
53
	private static final long serialVersionUID = -1841990357325903449L;
54
	private JList dataStoreList;
55
	private JScrollPane dataStoreScrollPane;
56

  
57
	/**
58
	 * @param wizardComponents
59
	 */
60
	public SelectDataStoreWizardPanel() {
61
		super();
62
		initComponents();
63
		addDataStores();		
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
		//Add all the tables
101
		List<Document> tables = ProjectManager.getInstance().getCurrentProject()
102
			.getDocuments(TableManager.TYPENAME);
103
		for (Document table : tables) {
104
			((DefaultListModel)dataStoreList.getModel()).addElement(					
105
					new FeatureStoreCombo(
106
							table.getName(),
107
							((TableDocument)table).getStore(),
108
							false
109
					)
110
			);
111
		}
112
		
113
//		ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
114
//		ArrayList<ProjectDocument> tables = ext.getProject().getDocumentsByType(FeatureTableDocumentFactory.registerName);
115
//		for (int i=0 ; i<tables.size() ; i++){
116
//			FeatureTableDocument table = (FeatureTableDocument)tables.get(i);
117
//			((DefaultListModel)dataStoreList.getModel()).addElement(					
118
//					new FeatureStoreCombo(table.getName(),
119
//							table.getStore(),
120
//							false));
121
//		}
122
		//Add the layers from the current view
123
		IWindow window = PluginServices.getMDIManager().getActiveWindow();
124
		if (window instanceof IView){
125
			IView view = (IView)window;
126
			LayersIterator it = new LayersIterator(
127
					view.getMapControl().getMapContext().getLayers());
128
			while(it.hasNext()){
129
				FLayer layer = it.nextLayer();
130
				if (layer instanceof FLyrVect){
131
//					try {
132
						FLyrVect layerVect = (FLyrVect)layer;
133
						FeatureStore featureStore = layerVect.getFeatureStore();
134
						boolean found = false;
135
						for (int i=0 ; i<tables.size() ; i++){
136
							TableDocument table = (TableDocument)tables.get(i);
137
							if (table.getStore().equals(featureStore)) {
138
								found = true;
139
							}							
140
						}
141
						if (!found){
142
							((DefaultListModel)dataStoreList.getModel()).addElement(
143
									new FeatureStoreCombo(layerVect.getName(),
144
											featureStore,
145
											true));
146
						}
147
//					} catch (ReadException e) {
148
//						logger.error("It is not possible to read the FeatureStore", e);
149
//					}
150
				}
151
			}
152
		}	
153
	}
154

  
155

  
156
	/**
157
	 * @return the selected feature store
158
	 */
159
	public FeatureStore getSelectedFeatureStore(){
160
		Object obj = dataStoreList.getSelectedValue();
161
		if (obj != null){
162
			return ((FeatureStoreCombo)obj).getFeatureStore();
163
		}
164
		return null;
165
	}	
166

  
167
	/* (non-Javadoc)
168
	 * @see org.gvsig.app.daltransform.impl.AbstractDataTransformWizardPanel#getFeatureStore()
169
	 */
170
	@Override
171
	public FeatureStore getFeatureStore() {
172
		return getSelectedFeatureStore();
173
	}
174

  
175
	/**
176
	 * @return the selected feature store
177
	 */
178
	public boolean isSelectedFeatureStoreLoaded(){
179
		Object obj = dataStoreList.getSelectedValue();
180
		if (obj != null){
181
			return ((FeatureStoreCombo)obj).isLoaded();
182
		}
183
		return false;
184
	}
185

  
186
	/**
187
	 * Used to fill the combo
188
	 * @author jpiera
189
	 */
190
	private class FeatureStoreCombo{
191
		private FeatureStore featureStore = null;
192
		private String name = null;
193
		private boolean isLoaded = false;
194

  
195
		public FeatureStoreCombo(String name, FeatureStore featureStore, boolean isLoaded) {
196
			super();
197
			this.name = name;
198
			this.featureStore = featureStore;
199
			this.isLoaded = isLoaded;
200
		}
201

  
202
		/**
203
		 * @return the isLoaded
204
		 */
205
		public boolean isLoaded() {
206
			return isLoaded;
207
		}
208

  
209
		/**
210
		 * @return the featureStore
211
		 */
212
		public FeatureStore getFeatureStore() {
213
			return featureStore;
214
		}
215

  
216
		/* (non-Javadoc)
217
		 * @see java.lang.Object#toString()
218
		 */		
219
		public String toString() {			
220
			return name;
221
		}		
222
	}
223

  
224
	/*
225
	 * 	(non-Javadoc)
226
	 * @see org.gvsig.app.daltransform.gui.FeatureTransformWizard#getPanelTitle()
227
	 */
228
	public String getPanelTitle() {
229
		return PluginServices.getText(this, "transform_datastore_selection");
230
	}
231

  
232
	/* (non-Javadoc)
233
	 * @see org.gvsig.app.daltransform.DataTransformWizard#updatePanel()
234
	 */
235
	public void updatePanel() {
236
		if (dataStoreList.getSelectedIndex() == -1){
237
			if (dataStoreList.getModel().getSize() > 0){
238
				dataStoreList.setSelectedIndex(0);
239
				getDataTransformWizard().setApplicable(true);
240
			}else{
241
				getDataTransformWizard().setApplicable(false);
242
			}
243
		}		
244
	}
245

  
246
	/**
247
	 * @return
248
	 */
249
	public boolean isFeatureStoreLayer() {
250
		Object obj = dataStoreList.getSelectedValue();
251
		if (obj != null){
252
			return ((FeatureStoreCombo)obj).isLoaded;
253
		}
254
		return false;
255
	}
256

  
257
	/* (non-Javadoc)
258
	 * @see org.gvsig.app.daltransform.impl.AbstractDataTransformWizardPanel#nextPanel()
259
	 */
260
	@Override
261
	public void nextPanel() {
262
		getDataTransformWizard().updateGui();
263
	}
264
	
265
	
266
}
267

  
0 268

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/impl/DataTransformSelectionAction.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.app.daltransform.gui.impl;
29

  
30
import jwizardcomponent.FinishAction;
31

  
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.app.daltransform.gui.DataTransformGui;
34
import org.gvsig.fmap.crs.CRSFactory;
35
import org.gvsig.fmap.dal.exception.DataException;
36
import org.gvsig.fmap.dal.feature.FeatureStore;
37
import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
38
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
39
import org.gvsig.fmap.mapcontext.layers.FLayer;
40
import org.gvsig.fmap.mapcontext.layers.LayerFactory;
41
import org.slf4j.Logger;
42
import org.slf4j.LoggerFactory;
43

  
44

  
45
/**
46
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
47
 */
48
public class DataTransformSelectionAction extends FinishAction{
49
	private static final Logger logger = LoggerFactory.getLogger(DataTransformSelectionAction.class);
50
	private DefaultDataTransformWizard dataTransformWizard = null;
51
	
52
	public DataTransformSelectionAction(DefaultDataTransformWizard dataTransformWizard) {
53
		super(dataTransformWizard.getWizardComponents());		
54
		this.dataTransformWizard = dataTransformWizard;
55
	}
56

  
57
	/* (non-Javadoc)
58
	 * @see jwizardcomponent.Action#performAction()
59
	 */
60
	public void performAction() {		
61
		//Gets the selected transformation
62
		DataTransformGui featureTransformGui = dataTransformWizard.getDataTransformGui();
63
			
64
		//Gets the selected FeatureStore
65
		FeatureStore featureStore = dataTransformWizard.getFeatureStore();
66
				
67
		try {			
68
			//Gets the transform
69
			FeatureStoreTransform featureStoreTransform = featureTransformGui.createFeatureStoreTransform(featureStore);
70
			
71
			//Apply the transformation
72
			featureStore.getTransforms().add(featureStoreTransform);
73
			
74
			//Create and load a new layer...
75
			if (dataTransformWizard.isLayerLoaded()){
76
				FLayer layer = LayerFactory.getInstance().createLayer(featureTransformGui.toString(),
77
						featureStore);
78
				layer.setProjection(CRSFactory.getCRS("EPSG:23030"));
79
				dataTransformWizard.getMapContext().getLayers().addLayer(layer);
80
			}
81
		} catch (DataException e) {
82
			logger.error("Error creating the transformation", e);
83
		} catch (LoadLayerException e) {
84
			logger.error("Error loading the layer", e);
85
		}
86
		//Closing the window
87
		PluginServices.getMDIManager().closeWindow(dataTransformWizard);
88
	}
89

  
90
}
91

  
0 92

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/impl/DataTransformWizardContainer.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.app.daltransform.gui.impl;
29

  
30
import java.awt.BorderLayout;
31

  
32
import jwizardcomponent.JWizardComponents;
33
import jwizardcomponent.JWizardPanel;
34

  
35
import org.gvsig.app.daltransform.gui.DataTransformWizardPanel;
36

  
37

  
38
/**
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
40
 */
41
public class DataTransformWizardContainer extends JWizardPanel {
42
	private static final long serialVersionUID = -3410258554443619626L;
43
	private DataTransformWizardPanel wizard = null;
44
	
45
	/**
46
	 * @param wizardComponents
47
	 */
48
	public DataTransformWizardContainer(JWizardComponents wizardComponents, DataTransformWizardPanel wizard) {
49
		super(wizardComponents);	
50
		this.wizard = wizard;
51
		setLayout(new BorderLayout());
52
		setBorder(javax.swing.BorderFactory.createTitledBorder(wizard.getPanelTitle()));
53
		add(wizard.getJPanel(), BorderLayout.CENTER);
54
	}
55

  
56
	/* (non-Javadoc)
57
	 * @see jwizardcomponent.WizardPanel#back()
58
	 */
59
	@Override
60
	public void back() {
61
		wizard.lastPanel();
62
		super.back();
63
	}
64

  
65
	/* (non-Javadoc)
66
	 * @see jwizardcomponent.WizardPanel#next()
67
	 */
68
	@Override
69
	public void next() {
70
		wizard.nextPanel();
71
		super.next();
72
	}
73

  
74
	/* (non-Javadoc)
75
	 * @see jwizardcomponent.JWizardPanel#update()
76
	 */
77
	@Override
78
	public void update() {
79
		wizard.updatePanel();
80
		super.update();
81
	}
82
}
83

  
0 84

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/impl/AbstractDataTransformWizardPanel.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.app.daltransform.gui.impl;
29

  
30
import javax.swing.JPanel;
31

  
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.app.daltransform.gui.DataTransformWizard;
34
import org.gvsig.app.daltransform.gui.DataTransformWizardPanel;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36
import org.slf4j.Logger;
37
import org.slf4j.LoggerFactory;
38

  
39

  
40
/**
41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
42
 */
43
public abstract class AbstractDataTransformWizardPanel extends JPanel implements DataTransformWizardPanel {
44
	protected static final Logger logger = LoggerFactory.getLogger(AbstractDataTransformWizardPanel.class);
45
	private DefaultDataTransformWizard dataTransformWizard = null;
46

  
47
	/**
48
	 * @param featureStore
49
	 */
50
	public AbstractDataTransformWizardPanel() {
51
		super();
52
	}	
53
	
54
	/* (non-Javadoc)
55
	 * @see org.gvsig.app.daltransform.DataTransformWizardPanel#setDataTransformWizard(org.gvsig.app.daltransform.DataTransformWizard)
56
	 */
57
	public void setDataTransformWizard(DataTransformWizard dataTransformWizard) {
58
		this.dataTransformWizard = (DefaultDataTransformWizard)dataTransformWizard;		
59
	}
60

  
61
	/* (non-Javadoc)
62
	 * @see org.gvsig.app.daltransform.DataTransformWizard#getJPanel()
63
	 */
64
	public JPanel getJPanel() {
65
		return this;
66
	}
67

  
68
	/* (non-Javadoc)
69
	 * @see org.gvsig.app.daltransform.DataTransformWizard#getPanelTitle()
70
	 */
71
	public String getPanelTitle() {
72
		return PluginServices.getText(this, "transform_parameters");
73
	}
74

  
75
	/* (non-Javadoc)
76
	 * @see org.gvsig.app.daltransform.DataTransformWizard#isNextButtonEnabled()
77
	 */
78
	public boolean isNextButtonEnabled() {
79
		return true;
80
	}
81

  
82
	/* (non-Javadoc)
83
	 * @see org.gvsig.app.daltransform.DataTransformWizard#lastPanel()
84
	 */
85
	public void lastPanel() {
86
		// TODO Auto-generated method stub
87
		
88
	}
89

  
90
	/* (non-Javadoc)
91
	 * @see org.gvsig.app.daltransform.DataTransformWizard#nextPanel()
92
	 */
93
	public void nextPanel() {
94
		// TODO Auto-generated method stub
95
		
96
	}
97

  
98
	/* (non-Javadoc)
99
	 * @see org.gvsig.app.daltransform.DataTransformWizard#updatePanel()
100
	 */
101
	public void updatePanel() {
102
		// TODO Auto-generated method stub
103
		
104
	}
105

  
106
	/**
107
	 * @return the featureStore
108
	 */
109
	public FeatureStore getFeatureStore() {
110
		if (dataTransformWizard != null){
111
			return dataTransformWizard.getFeatureStore();
112
		}
113
		return null;
114
	}
115
	
116
	/**
117
	 * @return the dataTransformWizard
118
	 */
119
	public DefaultDataTransformWizard getDataTransformWizard() {
120
		return dataTransformWizard;
121
	}	
122
	
123
}
124

  
0 125

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/impl/DefaultDataTransformWizard.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.app.daltransform.gui.impl;
29

  
30
import java.util.List;
31

  
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.andami.ui.mdiManager.IWindow;
34
import org.gvsig.andami.ui.wizard.WizardAndami;
35
import org.gvsig.app.daltransform.gui.DataTransformGui;
36
import org.gvsig.app.daltransform.gui.DataTransformWizard;
37
import org.gvsig.app.daltransform.gui.DataTransformWizardPanel;
38
import org.gvsig.fmap.dal.feature.FeatureStore;
39
import org.gvsig.fmap.mapcontext.MapContext;
40

  
41

  
42
/**
43
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
44
 */
45
public class DefaultDataTransformWizard extends WizardAndami implements DataTransformWizard{
46
	private List<DataTransformWizardPanel> transformWizardPanels = null;
47
	//The three default panels
48
	private LoadLayerWizardPanel loadLayerWizardPanel = null;
49
	private SelectDataStoreWizardPanel selectDataStoreWizardPanel = null;
50
	private SelectTransformWizardPanel selectTransformWizardPanel = null;
51
	//If the wizard has to use a concrete transformation
52
	private DataTransformGui dataTransformGui = null;
53
	private int PANELS_TO_REFRESH = 2;
54
	
55
	/**
56
	 * @param wizard
57
	 */
58
	public DefaultDataTransformWizard() {
59
		super(PluginServices.getIconTheme().get("feature-transform"));	
60
		loadLayerWizardPanel = new LoadLayerWizardPanel();
61
		selectDataStoreWizardPanel = new SelectDataStoreWizardPanel();
62
		selectTransformWizardPanel = new SelectTransformWizardPanel();
63
		initialize();
64
		setSize(selectTransformWizardPanel.getMaxHeight(),
65
				selectTransformWizardPanel.getMaxWidth());
66
	}
67

  
68
	private void initialize() {
69
		getWizardComponents().getFinishButton().setEnabled(false);
70
		getWindowInfo().setTitle(PluginServices.getText(this, "transform_wizard"));
71
		addDataTransformWizardPanel(selectTransformWizardPanel);
72
		addDataTransformWizardPanel(selectDataStoreWizardPanel);		
73
		getWizardComponents().setFinishAction(new DataTransformSelectionAction(this));
74
	}
75

  
76
	/*
77
	 * (non-Javadoc)
78
	 * @see org.gvsig.app.daltransform.gui.DataTransformWizard#setApplicable(boolean)
79
	 */
80
	public void setApplicable(boolean isEnabled) {
81
		getWizardComponents().getNextButton().setEnabled(isEnabled);		
82
	}	
83

  
84
	/* (non-Javadoc)
85
	 * @see org.gvsig.app.daltransform.DataTransformWizard#getDataTransformGui()
86
	 */
87
	public DataTransformGui getDataTransformGui() {
88
		if (dataTransformGui == null){
89
			return selectTransformWizardPanel.getFeatureTransformGui();
90
		}else{
91
			return dataTransformGui;
92
		}		
93
	}
94

  
95
	/* (non-Javadoc)
96
	 * @see org.gvsig.app.daltransform.DataTransformWizard#setDataTransformGui(org.gvsig.app.daltransform.DataTransformGui)
97
	 */
98
	public void updateGui() {
99
		//Remove all the panels
100
		for (int i=getWizardComponents().getWizardPanelList().size()-1 ; i>=PANELS_TO_REFRESH ; i--){
101
			getWizardComponents().removeWizardPanel(i);
102
		}	
103
		//Add new panels
104
		transformWizardPanels = getDataTransformGui().createPanels();
105
		for (int i=0 ; i<transformWizardPanels.size() ; i++){
106
			addDataTransformWizardPanel(transformWizardPanels.get(i));
107
		}
108
		addDataTransformWizardPanel(loadLayerWizardPanel);			
109
	}
110
	
111
	public void addDataTransformWizardPanel(DataTransformWizardPanel dataTransformWizardPanel){
112
		dataTransformWizardPanel.setDataTransformWizard(this);
113
		getWizardComponents().addWizardPanel(
114
				new DataTransformWizardContainer(getWizardComponents(), dataTransformWizardPanel));	
115
	}
116

  
117
	/* (non-Javadoc)
118
	 * @see org.gvsig.app.daltransform.DataTransformWizard#getFeatureStore()
119
	 */
120
	public FeatureStore getFeatureStore() {
121
		return selectDataStoreWizardPanel.getFeatureStore();
122
	}
123

  
124
	/* (non-Javadoc)
125
	 * @see org.gvsig.app.daltransform.DataTransformWizard#isFeatureStoreLayer()
126
	 */
127
	public boolean isFeatureStoreLayer() {
128
		return selectDataStoreWizardPanel.isFeatureStoreLayer();
129
	}
130
	
131
	public boolean isLayerLoaded(){
132
		return loadLayerWizardPanel.isLayerLoaded();
133
	}
134
	
135
	public MapContext getMapContext(){
136
		return loadLayerWizardPanel.getMapContext();
137
	}
138

  
139
	/* (non-Javadoc)
140
	 * @see org.gvsig.app.daltransform.gui.DataTransformWizard#getWindow()
141
	 */
142
	public IWindow getWindow() {
143
		return this;
144
	}
145

  
146
	/* (non-Javadoc)
147
	 * @see org.gvsig.app.daltransform.gui.DataTransformWizard#setDataTransformGui(org.gvsig.app.daltransform.gui.DataTransformGui)
148
	 */
149
	public void setDataTransformGui(DataTransformGui dataTransformGui) {
150
		this.dataTransformGui = dataTransformGui;
151
		PANELS_TO_REFRESH = 1;
152
		getWizardComponents().removeWizardPanel(0);		
153
	}
154
}
155

  
0 156

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/impl/SelectTransformWizardPanel.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.app.daltransform.gui.impl;
29

  
30
import java.awt.Dimension;
31
import java.util.ArrayList;
32

  
33
import javax.swing.DefaultListModel;
34
import javax.swing.JList;
35
import javax.swing.JScrollPane;
36
import javax.swing.JTextArea;
37
import javax.swing.event.ListSelectionEvent;
38
import javax.swing.event.ListSelectionListener;
39

  
40
import org.gvsig.andami.PluginServices;
41
import org.gvsig.app.daltransform.DataTransformLocator;
42
import org.gvsig.app.daltransform.DataTransformManager;
43
import org.gvsig.app.daltransform.gui.DataTransformGui;
44

  
45

  
46
/**
47
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
48
 */
49
public class SelectTransformWizardPanel extends AbstractDataTransformWizardPanel implements ListSelectionListener{
50
	private JList transformList;
51
	private JScrollPane transformScrollPane;
52
	private JScrollPane descriptionScrollPane;
53
	private JTextArea descriptionText;
54
	private int maxWidth = 315;
55
	private int maxHeight = 600;
56

  
57
	/**
58
	 * @param wizardComponents
59
	 */
60
	public SelectTransformWizardPanel() {
61
		super();	
62
		initComponents();		
63
		addTransforms();
64
		transformList.addListSelectionListener(this);		
65
	}
66

  
67
	private void initComponents() {
68
		java.awt.GridBagConstraints gridBagConstraints;
69

  
70
		transformScrollPane = new javax.swing.JScrollPane();
71
		transformList = new javax.swing.JList();
72
		descriptionScrollPane = new javax.swing.JScrollPane();
73
		descriptionText = new javax.swing.JTextArea();
74

  
75
		setLayout(new java.awt.GridBagLayout());
76

  
77
		transformScrollPane.setViewportView(transformList);
78

  
79
		transformList.setModel(new DefaultListModel());
80

  
81
		gridBagConstraints = new java.awt.GridBagConstraints();
82
		gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
83
		gridBagConstraints.weightx = 1.0;
84
		gridBagConstraints.weighty = 1.0;
85
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 5, 2);
86
		add(transformScrollPane, gridBagConstraints);
87

  
88
		descriptionText.setColumns(20);
89
		descriptionText.setEditable(false);
90
		descriptionText.setRows(5);
91
		descriptionText.setLineWrap(true);
92
		descriptionText.setBorder(null);
93
		descriptionScrollPane.setBorder(null);
94
		descriptionScrollPane.setViewportView(descriptionText);
95

  
96
		gridBagConstraints = new java.awt.GridBagConstraints();
97
		gridBagConstraints.gridx = 0;
98
		gridBagConstraints.gridy = 1;
99
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
100
		gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
101
		gridBagConstraints.weightx = 1.0;
102
		gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2);
103
		add(descriptionScrollPane, gridBagConstraints);
104
	}
105

  
106
	/**
107
	 * Adding the objects
108
	 */
109
	protected void addTransforms(){
110
		DataTransformManager featureTransformManager = 
111
			DataTransformLocator.getDataTransformManager();			
112
		ArrayList<DataTransformGui> dataTransformGui =
113
			featureTransformManager.getDataTransforms();
114
		for (int i=0 ; i<dataTransformGui.size() ; i++){
115
			((DefaultListModel)transformList.getModel()).addElement(new FeatureTransformGuiWrapper(dataTransformGui.get(i)));
116
			Dimension dimension = dataTransformGui.get(i).getMinDimension();
117
			if (dimension != null){
118
				if (dimension.getHeight() > maxHeight){
119
					maxHeight = (int)dimension.getHeight();
120
				}
121
				if (dimension.getWidth() > maxWidth){
122
					maxWidth = (int)dimension.getWidth();
123
				}
124
			}
125
		}	
126
		updatePanel();
127
	}
128

  
129
	/*
130
	 * 	(non-Javadoc)
131
	 * @see org.gvsig.app.daltransform.impl.AbstractDataTransformWizardPanel#updatePanel()
132
	 */
133
	@Override
134
	public void updatePanel() {
135
		if (transformList.getSelectedIndex() == -1){
136
			if (transformList.getModel().getSize() > 0){
137
				transformList.setSelectedIndex(0);
138
				valueChanged(null);
139
			}
140
		}else{
141
			if (transformList.getModel().getSize() == 0){
142
				getDataTransformWizard().setApplicable(false);
143
			}
144
		}
145
	}	
146

  
147
	/* (non-Javadoc)
148
	 * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
149
	 */
150
	public void valueChanged(ListSelectionEvent e) {
151
		Object obj = transformList.getSelectedValue();
152
		if (obj != null){
153
			descriptionText.setText(((FeatureTransformGuiWrapper)obj).getFeatureTransformGui().getDescription());
154
		}
155
	}
156

  
157
	public DataTransformGui getFeatureTransformGui(){
158
		Object obj = transformList.getSelectedValue();
159
		if (obj != null){
160
			return ((FeatureTransformGuiWrapper)obj).getFeatureTransformGui();
161
		}
162
		return null;
163
	}
164

  
165
	/* (non-Javadoc)
166
	 * @see org.gvsig.app.daltransform.gui.FeatureTransformWizard#getPanelTitle()
167
	 */
168
	public String getPanelTitle() {
169
		return PluginServices.getText(this, "transform_selection");
170
	}
171

  
172
	/**
173
	 * @return the maxWidth
174
	 */
175
	public int getMaxWidth() {
176
		return maxWidth;
177
	}
178

  
179
	/**
180
	 * @return the maxHeight
181
	 */
182
	public int getMaxHeight() {
183
		return maxHeight;
184
	}
185

  
186
	private class FeatureTransformGuiWrapper{
187
		private DataTransformGui featureTransformGui = null;
188

  
189
		/**
190
		 * @param featureTransformGui
191
		 */
192
		public FeatureTransformGuiWrapper(
193
				DataTransformGui featureTransformGui) {
194
			super();
195
			this.featureTransformGui = featureTransformGui;
196
		}
197

  
198
		/**
199
		 * @return the featureTransformGui
200
		 */
201
		public DataTransformGui getFeatureTransformGui() {
202
			return featureTransformGui;
203
		}
204

  
205
		/* (non-Javadoc)
206
		 * @see java.lang.Object#toString()
207
		 */
208
		public String toString() {			
209
			return featureTransformGui.getName();
210
		}		
211
	}
212
}
213

  
0 214

  
tags/v2_0_0_Build_2020/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/impl/LoadLayerWizardPanel.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.app.daltransform.gui.impl;
29

  
30
import java.awt.event.ItemEvent;
31
import java.awt.event.ItemListener;
32
import java.util.List;
33

  
34
import javax.swing.DefaultListModel;
35
import javax.swing.JCheckBox;
36
import javax.swing.JLabel;
37
import javax.swing.JList;
38
import javax.swing.JPanel;
39
import javax.swing.JScrollPane;
40
import javax.swing.JTextArea;
41

  
42
import org.gvsig.andami.PluginServices;
43
import org.gvsig.andami.ui.mdiManager.IWindow;
44
import org.gvsig.app.daltransform.gui.DataTransformGui;
45
import org.gvsig.app.project.ProjectManager;
46
import org.gvsig.app.project.documents.Document;
47
import org.gvsig.app.project.documents.view.BaseViewDocument;
48
import org.gvsig.app.project.documents.view.ViewManager;
49
import org.gvsig.app.project.documents.view.gui.IView;
50
import org.gvsig.fmap.dal.DataTypes;
51
import org.gvsig.fmap.dal.exception.DataException;
52
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
53
import org.gvsig.fmap.dal.feature.FeatureStore;
54
import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
55
import org.gvsig.fmap.dal.feature.FeatureType;
56
import org.gvsig.fmap.mapcontext.MapContext;
57
import org.slf4j.Logger;
58
import org.slf4j.LoggerFactory;
59

  
60

  
61
/**
62
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
63
 */
64
public class LoadLayerWizardPanel extends AbstractDataTransformWizardPanel implements ItemListener{
65
	/**
66
	 * 
67
	 */
68
	private static final long serialVersionUID = -7893735055404404591L;
69
	
70
	private static final Logger logger = LoggerFactory.getLogger(LoadLayerWizardPanel.class);
71
	private JCheckBox loadLayerCb = null;
72
	private JScrollPane messageScroll = null;
73
	private JTextArea messageTextArea = null;
74
	private JPanel northPanel = null;
75
	private JLabel selectViewLabel;
76
	private JList selectViewList;
77
	private JScrollPane selectViewScroll;
78
    private JPanel centerPanel;
79
	private FeatureStoreTransform transform = null;
80
//	private boolean hasViews = false;
81

  
82
	/**
83
	 * @param wizardComponents
84
	 */
85
	public LoadLayerWizardPanel() {
86
		super();	
87
		initComponents();
88
		initLabels();	
89
		addViews();
90
		loadLayerCb.addItemListener(this);
91
		itemStateChanged(null);		
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff