Revision 34557
tags/v2_0_0_Build_2024/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_2024/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_2024/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_2024/extensions/extDalTransform/package.info | ||
---|---|---|
1 |
# |
|
2 |
#Mon Feb 14 17:38:09 CET 2011 |
|
3 |
state=devel |
|
4 |
name=extDalTransform |
|
5 |
buildNumber=2024 |
|
6 |
official=true |
|
7 |
code=org.gvsig.app.daltransform |
|
8 |
operating-system=all |
|
9 |
architecture=all |
|
10 |
java-version=j1_5 |
|
11 |
gvSIG-version=2.0.0 |
|
12 |
version=2.0-SNAPSHOT |
|
13 |
type=plugin |
|
14 |
description=Frame which provide access to the different transformations like join, event theme, ... |
|
15 |
model-version=1.0.0 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/DataTransformLocator.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.locator.AbstractLocator; |
|
31 |
import org.gvsig.tools.locator.Locator; |
|
32 |
import org.gvsig.tools.locator.LocatorException; |
|
33 |
|
|
34 |
/** |
|
35 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
36 |
*/ |
|
37 |
public class DataTransformLocator extends AbstractLocator { |
|
38 |
private static final String LOCATOR_NAME = "DataTransformLocator"; |
|
39 |
/** |
|
40 |
* GPEManager name used by the locator to access the instance |
|
41 |
*/ |
|
42 |
public static final String DATA_TRANSFORM_MANAGER_NAME = "DataTransformManager"; |
|
43 |
private static final String DATA_TRANSFORM_MANAGER_DESCRIPTION = "DataTransformManager of gvSIG"; |
|
44 |
|
|
45 |
/** |
|
46 |
* Unique instance. |
|
47 |
*/ |
|
48 |
private static final DataTransformLocator instance = new DataTransformLocator(); |
|
49 |
|
|
50 |
/* (non-Javadoc) |
|
51 |
* @see org.gvsig.tools.locator.Locator#getLocatorName() |
|
52 |
*/ |
|
53 |
public String getLocatorName() { |
|
54 |
return LOCATOR_NAME; |
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* Return a reference to {@link DataTransformManager}. |
|
59 |
* |
|
60 |
* @return a reference to DataTransformManager |
|
61 |
* @throws LocatorException |
|
62 |
* if there is no access to the class or the class cannot be |
|
63 |
* instantiated |
|
64 |
* @see Locator#get(String) |
|
65 |
*/ |
|
66 |
public static DataTransformManager getDataTransformManager() throws LocatorException { |
|
67 |
return (DataTransformManager) getInstance().get(DATA_TRANSFORM_MANAGER_NAME); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Return the singleton instance. |
|
72 |
* |
|
73 |
* @return the singleton instance |
|
74 |
*/ |
|
75 |
public static DataTransformLocator getInstance() { |
|
76 |
return instance; |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Registers the Class implementing the {@link DataTransformManager} interface. |
|
81 |
* |
|
82 |
* @param clazz |
|
83 |
* implementing the DataTransformManager interface |
|
84 |
*/ |
|
85 |
public static void registerDataTransformManager(Class clazz) { |
|
86 |
getInstance().register(DATA_TRANSFORM_MANAGER_NAME, |
|
87 |
DATA_TRANSFORM_MANAGER_DESCRIPTION, |
|
88 |
clazz); |
|
89 |
} |
|
90 |
} |
|
0 | 91 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/NotRegisteredTransformException.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 NotRegisteredTransformException extends BaseException{ |
|
36 |
private static final long serialVersionUID = 6104956845700384855L; |
|
37 |
private String name = null; |
|
38 |
|
|
39 |
/** |
|
40 |
* @param message |
|
41 |
* @param cause |
|
42 |
* @param key |
|
43 |
* @param code |
|
44 |
*/ |
|
45 |
public NotRegisteredTransformException(String name) { |
|
46 |
init(); |
|
47 |
this.name = name; |
|
48 |
} |
|
49 |
|
|
50 |
private void init() { |
|
51 |
messageKey = "transform_not_registered"; |
|
52 |
formatString = "Can?t create the wizard because there is not a " + |
|
53 |
"registered transform whit the name " + name + "."; |
|
54 |
} |
|
55 |
|
|
56 |
} |
|
57 |
|
|
58 |
|
|
59 |
|
|
0 | 60 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/DataTransformLibrary.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.app.ApplicationLibrary; |
|
31 |
import org.gvsig.fmap.dal.DALLibrary; |
|
32 |
import org.gvsig.tools.library.AbstractLibrary; |
|
33 |
import org.gvsig.tools.library.Library; |
|
34 |
import org.gvsig.tools.library.LibraryException; |
|
35 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
36 |
|
|
37 |
/** |
|
38 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
39 |
*/ |
|
40 |
public class DataTransformLibrary extends AbstractLibrary { |
|
41 |
|
|
42 |
public DataTransformLibrary() { |
|
43 |
super(DataTransformLibrary.class, Library.TYPE.API); |
|
44 |
require(DALLibrary.class); |
|
45 |
require(ApplicationLibrary.class); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doInitialize() throws LibraryException { |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
protected void doPostInitialize() throws LibraryException { |
|
54 |
// Validate there is any implementation registered. |
|
55 |
DataTransformManager dataTransformManager = DataTransformLocator.getDataTransformManager(); |
|
56 |
if (dataTransformManager == null) { |
|
57 |
throw new ReferenceNotRegisteredException( |
|
58 |
DataTransformLocator.DATA_TRANSFORM_MANAGER_NAME, DataTransformLocator.getInstance()); |
|
59 |
} |
|
60 |
} |
|
61 |
} |
|
62 |
|
|
63 |
|
|
64 |
|
|
0 | 65 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/extension/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.app.daltransform.extension; |
|
29 |
|
|
30 |
import java.awt.Component; |
|
31 |
|
|
32 |
import javax.swing.JOptionPane; |
|
33 |
|
|
34 |
import org.gvsig.andami.PluginServices; |
|
35 |
import org.gvsig.andami.plugins.Extension; |
|
36 |
import org.gvsig.app.daltransform.DataTransformLocator; |
|
37 |
|
|
38 |
|
|
39 |
/** |
|
40 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
41 |
*/ |
|
42 |
public class DataTransformExtension extends Extension{ |
|
43 |
// public static DataTransformLibrary library = null; |
|
44 |
// public static DefaultDataTransformLibrary defaultlibrary = null; |
|
45 |
|
|
46 |
/* (non-Javadoc) |
|
47 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
|
48 |
*/ |
|
49 |
public void execute(String actionCommand) { |
|
50 |
try { |
|
51 |
PluginServices.getMDIManager().addWindow(DataTransformLocator.getDataTransformManager().createWizard().getWindow()); |
|
52 |
} catch (Exception e) { |
|
53 |
JOptionPane.showInternalMessageDialog((Component)PluginServices.getMDIManager(), |
|
54 |
PluginServices.getText(this, "transform_create_wizard_exception"), |
|
55 |
PluginServices.getText(this, "feature_transform"), |
|
56 |
JOptionPane.ERROR_MESSAGE); |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
/* (non-Javadoc) |
|
61 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
62 |
*/ |
|
63 |
public void initialize() { |
|
64 |
registerIcons(); |
|
65 |
// library = new DataTransformLibrary(); |
|
66 |
// library.initialize(); |
|
67 |
// |
|
68 |
// defaultlibrary = new DefaultDataTransformLibrary(); |
|
69 |
// defaultlibrary.initialize(); |
|
70 |
} |
|
71 |
|
|
72 |
/* (non-Javadoc) |
|
73 |
* @see com.iver.andami.plugins.Extension#postInitialize() |
|
74 |
*/ |
|
75 |
public void postInitialize() { |
|
76 |
super.postInitialize(); |
|
77 |
// library.postInitialize(); |
|
78 |
// defaultlibrary.postInitialize(); |
|
79 |
} |
|
80 |
|
|
81 |
private void registerIcons(){ |
|
82 |
PluginServices.getIconTheme().registerDefault( |
|
83 |
"feature-transform", |
|
84 |
this.getClass().getClassLoader().getResource("images/transform.png") |
|
85 |
); |
|
86 |
} |
|
87 |
|
|
88 |
/* (non-Javadoc) |
|
89 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
|
90 |
*/ |
|
91 |
public boolean isEnabled() { |
|
92 |
return true; |
|
93 |
} |
|
94 |
|
|
95 |
/* (non-Javadoc) |
|
96 |
* @see com.iver.andami.plugins.IExtension#isVisible() |
|
97 |
*/ |
|
98 |
public boolean isVisible() { |
|
99 |
return true; |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
0 | 103 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/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.app.daltransform; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
|
|
32 |
import org.gvsig.app.daltransform.gui.DataTransformGui; |
|
33 |
import org.gvsig.app.daltransform.gui.DataTransformWizard; |
|
34 |
|
|
35 |
/** |
|
36 |
* This singleton provides a centralized access to register |
|
37 |
* {@link DataTransformGui} that is a class to establish |
|
38 |
* a relationship between a tranformation and a user interface. |
|
39 |
* |
|
40 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
41 |
*/ |
|
42 |
public interface DataTransformManager { |
|
43 |
|
|
44 |
/** |
|
45 |
* Register a data transformation |
|
46 |
* @param name |
|
47 |
* the name used to register the transformation |
|
48 |
* @param featureTransformGui |
|
49 |
* the class that contains the relationship between a transformation |
|
50 |
* and its user interface. This class has to be an instance of |
|
51 |
* {@link DataTransformGui} |
|
52 |
*/ |
|
53 |
public void registerDataTransform(String name, Class dataTransformGui); |
|
54 |
|
|
55 |
/** |
|
56 |
* Register the GUI that is used to apply transformations. |
|
57 |
* @param dataTransformWizard |
|
58 |
* the class that implements the GUI. This class has to be an instance of |
|
59 |
* {@link DataTransformWizard} |
|
60 |
*/ |
|
61 |
public void registerDataTransformWizard(Class dataTransformWizard); |
|
62 |
|
|
63 |
/** |
|
64 |
* Returns a list of the registered data transformations. |
|
65 |
* @return |
|
66 |
* A list of the registered data transformations. |
|
67 |
*/ |
|
68 |
public ArrayList<DataTransformGui> getDataTransforms(); |
|
69 |
|
|
70 |
/** |
|
71 |
* Creates a wizard that can be used to apply the transformations. |
|
72 |
* @return |
|
73 |
* The wizard. |
|
74 |
*/ |
|
75 |
public DataTransformWizard createWizard() throws CreateWizardException; |
|
76 |
|
|
77 |
/** |
|
78 |
* It creates a wizard and selects the transformation specified |
|
79 |
* by the parameter. |
|
80 |
* @param transformName |
|
81 |
* The name of the transformation to apply. |
|
82 |
* @return |
|
83 |
* The wizard. |
|
84 |
* @throws CreateWizardException |
|
85 |
*/ |
|
86 |
public DataTransformWizard createWizard(String transformName) throws CreateWizardException, NotRegisteredTransformException; |
|
87 |
|
|
88 |
} |
|
89 |
|
|
0 | 90 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/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.app.daltransform.impl; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.Iterator; |
|
32 |
|
|
33 |
import org.gvsig.app.daltransform.CreateWizardException; |
|
34 |
import org.gvsig.app.daltransform.DataTransformManager; |
|
35 |
import org.gvsig.app.daltransform.NotRegisteredTransformException; |
|
36 |
import org.gvsig.app.daltransform.gui.DataTransformGui; |
|
37 |
import org.gvsig.app.daltransform.gui.DataTransformWizard; |
|
38 |
import org.gvsig.tools.ToolsLocator; |
|
39 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
40 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
41 |
import org.slf4j.Logger; |
|
42 |
import org.slf4j.LoggerFactory; |
|
43 |
|
|
44 |
/** |
|
45 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
46 |
*/ |
|
47 |
public class DefaultDataTransformManager implements DataTransformManager{ |
|
48 |
private static final String TRANSFORM_GUI_EXTENSION_POINT = "TransformGuiExtensionPoint"; |
|
49 |
private static final String TRANSFORM_WIZARD_EXTENSION_POINT = "TransformWizardExtensionPoint"; |
|
50 |
private static final String TRANSFORM_WIZARD_NAME = "Wizard"; |
|
51 |
private static final Logger logger = LoggerFactory.getLogger(DefaultDataTransformManager.class); |
|
52 |
private ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
53 |
|
|
54 |
/* |
|
55 |
* (non-Javadoc) |
|
56 |
* @see org.gvsig.feature.transform.FeatureTransformManager#registerFeatureTransform(java.lang.String, java.lang.Class) |
|
57 |
*/ |
|
58 |
public void registerDataTransform(String name, |
|
59 |
Class featureTransformPage) { |
|
60 |
if (!DataTransformGui.class.isAssignableFrom(featureTransformPage)) { |
|
61 |
throw new IllegalArgumentException(featureTransformPage.getName() |
|
62 |
+ " must implement the DataTransformGui interface"); |
|
63 |
} |
|
64 |
|
|
65 |
ExtensionPoint extensionPoint = extensionPoints.add(TRANSFORM_GUI_EXTENSION_POINT, ""); |
|
66 |
extensionPoint.append(name, name, featureTransformPage); |
|
67 |
} |
|
68 |
|
|
69 |
/* |
|
70 |
* (non-Javadoc) |
|
71 |
* @see org.gvsig.feature.transform.FeatureTransformManager#getFeatureTransforms() |
|
72 |
*/ |
|
73 |
public ArrayList<DataTransformGui> getDataTransforms() { |
|
74 |
ArrayList<DataTransformGui> transformArray = new ArrayList(); |
|
75 |
|
|
76 |
ExtensionPoint ep = extensionPoints.add(TRANSFORM_GUI_EXTENSION_POINT); |
|
77 |
Iterator iterator = ep.iterator(); |
|
78 |
while (iterator.hasNext()) { |
|
79 |
try { |
|
80 |
transformArray.add((DataTransformGui)((ExtensionPoint.Extension) iterator |
|
81 |
.next()).create()); |
|
82 |
} catch (Exception e) { |
|
83 |
logger.error("Error creating a FeatureTranformationGui", e); |
|
84 |
} |
|
85 |
} |
|
86 |
return transformArray; |
|
87 |
} |
|
88 |
|
|
89 |
/* |
|
90 |
* (non-Javadoc) |
|
91 |
* @see org.gvsig.app.daltransform.DataTransformManager#createWizard() |
|
92 |
*/ |
|
93 |
public DataTransformWizard createWizard() throws CreateWizardException { |
|
94 |
ExtensionPoint ep = extensionPoints.add(TRANSFORM_WIZARD_EXTENSION_POINT); |
|
95 |
try { |
|
96 |
return (DataTransformWizard)ep.create(TRANSFORM_WIZARD_NAME); |
|
97 |
} catch (Exception e) { |
|
98 |
throw new CreateWizardException(e); |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
/* (non-Javadoc) |
|
103 |
* @see org.gvsig.app.daltransform.DataTransformManager#registerDataTransformWizard(java.lang.String, java.lang.Class) |
|
104 |
*/ |
|
105 |
public void registerDataTransformWizard(Class dataTransformWizard) { |
|
106 |
if (!DataTransformWizard.class.isAssignableFrom(dataTransformWizard)) { |
|
107 |
throw new IllegalArgumentException(dataTransformWizard.getName() |
|
108 |
+ " must implement the DataTransformWizard interface"); |
|
109 |
} |
|
110 |
|
|
111 |
ExtensionPoint extensionPoint = extensionPoints.add(TRANSFORM_WIZARD_EXTENSION_POINT, ""); |
|
112 |
extensionPoint.append(TRANSFORM_WIZARD_NAME, "", dataTransformWizard); |
|
113 |
} |
|
114 |
|
|
115 |
/* (non-Javadoc) |
|
116 |
* @see org.gvsig.app.daltransform.DataTransformManager#createWizard(java.lang.String) |
|
117 |
*/ |
|
118 |
public DataTransformWizard createWizard(String transformName) |
|
119 |
throws CreateWizardException { |
|
120 |
ExtensionPoint ep = extensionPoints.add(TRANSFORM_GUI_EXTENSION_POINT); |
|
121 |
try { |
|
122 |
Object obj = ep.create(transformName); |
|
123 |
if (obj == null){ |
|
124 |
throw new NotRegisteredTransformException(transformName); |
|
125 |
} |
|
126 |
DataTransformGui dataTransformGui = (DataTransformGui)obj; |
|
127 |
DataTransformWizard wizard = createWizard(); |
|
128 |
wizard.setDataTransformGui(dataTransformGui); |
|
129 |
return wizard; |
|
130 |
} catch (Exception e) { |
|
131 |
throw new CreateWizardException(e); |
|
132 |
} |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
0 | 136 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/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.app.daltransform.impl; |
|
29 |
|
|
30 |
import org.gvsig.app.ApplicationLibrary; |
|
31 |
import org.gvsig.app.daltransform.DataTransformLibrary; |
|
32 |
import org.gvsig.app.daltransform.DataTransformLocator; |
|
33 |
import org.gvsig.app.daltransform.DataTransformManager; |
|
34 |
import org.gvsig.app.daltransform.gui.impl.DefaultDataTransformWizard; |
|
35 |
import org.gvsig.fmap.dal.DALLibrary; |
|
36 |
import org.gvsig.tools.library.AbstractLibrary; |
|
37 |
import org.gvsig.tools.library.Library; |
|
38 |
import org.gvsig.tools.library.LibraryException; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
42 |
*/ |
|
43 |
public class DefaultDataTransformLibrary extends AbstractLibrary { |
|
44 |
|
|
45 |
public DefaultDataTransformLibrary() { |
|
46 |
super(DataTransformLibrary.class, Library.TYPE.IMPL); |
|
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_2024/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_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/components/impl/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.app.daltransform.gui.components.impl; |
|
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 |
protected static final Logger logger = LoggerFactory.getLogger(FeatureTypeCombo.class); |
|
46 |
|
|
47 |
public FeatureTypeCombo() { |
|
48 |
super(); |
|
49 |
this.setModel(new DefaultComboBoxModel()); |
|
50 |
} |
|
51 |
|
|
52 |
public void addFeatureStore(FeatureStore featureStore){ |
|
53 |
removeAllItems(); |
|
54 |
List<FeatureType> featureTypes; |
|
55 |
try { |
|
56 |
featureTypes = featureStore.getFeatureTypes(); |
|
57 |
for (int i=0 ; i<featureTypes.size() ; i++){ |
|
58 |
((DefaultComboBoxModel)getModel()).addElement(featureTypes.get(i)); |
|
59 |
} |
|
60 |
} catch (DataException e) { |
|
61 |
logger.error("Error updating the panel", e); |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
public FeatureType getSelectedFeatureType(){ |
|
66 |
return (FeatureType)getSelectedItem(); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
0 | 70 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/components/impl/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.app.daltransform.gui.components.impl; |
|
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_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/components/impl/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.app.daltransform.gui.components.impl; |
|
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 |
public FeatureTypeAttributesList() { |
|
46 |
super(); |
|
47 |
setModel(new DefaultListModel()); |
|
48 |
} |
|
49 |
|
|
50 |
public void addFeatureAttrubutes(FeatureStore featureStore) throws DataException{ |
|
51 |
addFeatureAttributes(featureStore.getDefaultFeatureType()); |
|
52 |
} |
|
53 |
|
|
54 |
public void addFeatureAttributes(FeatureType featureType){ |
|
55 |
removeAll(); |
|
56 |
FeatureAttributeDescriptor[] descriptors = featureType.getAttributeDescriptors(); |
|
57 |
for (int i=0 ; i<descriptors.length ; i++){ |
|
58 |
addFeatureAttributeDescriptor(descriptors[i]); |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
public void addFeatureAttributeDescriptor(FeatureAttributeDescriptor featureAttributeDescriptor){ |
|
63 |
((DefaultListModel)getModel()).addElement(new FeatureTypeAttributeWrapper(featureAttributeDescriptor)); |
|
64 |
} |
|
65 |
|
|
66 |
public ArrayList<FeatureAttributeDescriptor> getSelectedFeatureTypes(){ |
|
67 |
ArrayList<FeatureAttributeDescriptor> featureTypes = new ArrayList<FeatureAttributeDescriptor>(); |
|
68 |
Object[] objects = getSelectedValues(); |
|
69 |
for (int i=0 ; i<objects.length ; i++){ |
|
70 |
featureTypes.add(((FeatureTypeAttributeWrapper)objects[i]).getFeatureAttributeDescriptor()); |
|
71 |
} |
|
72 |
return featureTypes; |
|
73 |
} |
|
74 |
|
|
75 |
public String[] getAttributesName(){ |
|
76 |
Object[] objects = getSelectedValues(); |
|
77 |
String[] featureTypes = new String[objects.length]; |
|
78 |
for (int i=0 ; i<objects.length ; i++){ |
|
79 |
featureTypes[i] = ((FeatureTypeAttributeWrapper)objects[i]).getFeatureAttributeDescriptor().getName(); |
|
80 |
} |
|
81 |
return featureTypes; |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
0 | 85 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/components/impl/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.app.daltransform.gui.components.impl; |
|
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_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/components/impl/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.app.daltransform.gui.components.impl; |
|
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 |
protected static final Logger logger = LoggerFactory.getLogger(FeatureTypeAttributesCombo.class); |
|
45 |
|
|
46 |
public FeatureTypeAttributesCombo() { |
|
47 |
super(); |
|
48 |
this.setModel(new DefaultComboBoxModel()); |
|
49 |
} |
|
50 |
|
|
51 |
public void addFeatureAttrubutes(FeatureStore featureStore) throws DataException{ |
|
52 |
addFeatureAttributes(featureStore.getDefaultFeatureType()); |
|
53 |
} |
|
54 |
|
|
55 |
public void addFeatureAttributes(FeatureType featureType){ |
|
56 |
removeAllItems(); |
|
57 |
FeatureAttributeDescriptor[] descriptors = featureType.getAttributeDescriptors(); |
|
58 |
for (int i=0 ; i<descriptors.length ; i++){ |
|
59 |
addFeatureAttributeDescriptor(descriptors[i]); |
|
60 |
} |
|
61 |
} |
|
62 |
|
|
63 |
public void addFeatureAttributeDescriptor(FeatureAttributeDescriptor featureAttributeDescriptor){ |
|
64 |
((DefaultComboBoxModel)getModel()).addElement(new FeatureTypeAttributeWrapper(featureAttributeDescriptor)); |
|
65 |
} |
|
66 |
|
|
67 |
public FeatureAttributeDescriptor getSelectedFeatureAttributeDescriptor(){ |
|
68 |
return ((FeatureTypeAttributeWrapper)getSelectedItem()).getFeatureAttributeDescriptor(); |
|
69 |
} |
|
70 |
} |
|
71 |
|
|
0 | 72 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/components/impl/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.app.daltransform.gui.components.impl; |
|
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 |
/* (non-Javadoc) |
|
39 |
* @see org.gvsig.app.daltransform.gui.combos.FeatureTypeAttributesCombo#addFeatureAttributeDescriptor(org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor) |
|
40 |
*/ |
|
41 |
public void addFeatureAttributeDescriptor( |
|
42 |
FeatureAttributeDescriptor featureAttributeDescriptor) { |
|
43 |
int type = featureAttributeDescriptor.getType(); |
|
44 |
if ((type == DataTypes.DOUBLE) || |
|
45 |
(type == DataTypes.FLOAT) || |
|
46 |
(type == DataTypes.INT) || |
|
47 |
(type == DataTypes.LONG)){ |
|
48 |
super.addFeatureAttributeDescriptor(featureAttributeDescriptor); |
|
49 |
} |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
0 | 53 |
tags/v2_0_0_Build_2024/extensions/extDalTransform/src/org/gvsig/app/daltransform/gui/DataTransformWizard.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 org.gvsig.andami.ui.mdiManager.IWindow; |
|
31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
32 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransform; |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* This interface has to be implemented by the transformation |
|
37 |
* wizard. It has to provide |
|
38 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
39 |
*/ |
|
40 |
public interface DataTransformWizard { |
|
41 |
|
|
42 |
/** |
|
43 |
* Returns the window that has to be displayed to |
|
44 |
* apply transformation. |
|
45 |
* @return |
|
46 |
* The window to display. |
|
47 |
*/ |
|
48 |
public IWindow getWindow(); |
|
49 |
|
|
50 |
/** |
|
51 |
* Returns <code>true</code> if the transformation |
|
52 |
* can be applied. |
|
53 |
* @param isApplicable |
|
54 |
* If the transformation can be applied. |
|
55 |
*/ |
|
56 |
public void setApplicable(boolean isApplicable); |
|
57 |
|
|
58 |
/** |
|
59 |
* Returns the {@link FeatureStore} that can is used |
|
60 |
* to apply the transformation. |
|
61 |
* @return |
|
62 |
* The selected {@link FeatureStore} |
|
63 |
*/ |
|
64 |
public FeatureStore getFeatureStore(); |
|
65 |
|
|
66 |
/** |
|
67 |
* Returns <code>true</code> if the selected {@link FeatureStore} |
|
68 |
* has been selected from a layer. |
|
69 |
* @return |
|
70 |
* If the selected {@link FeatureStore} has been selected |
|
71 |
* from a layer. |
|
72 |
*/ |
|
73 |
public boolean isFeatureStoreLayer(); |
|
74 |
|
|
75 |
/** |
|
76 |
* Returns the selected {@link DataTransformGui}. It is used |
|
77 |
* to create the {@link FeatureStoreTransform}. |
|
78 |
* @return |
|
79 |
* The selected {@link DataTransformGui}. |
|
80 |
*/ |
|
81 |
public DataTransformGui getDataTransformGui(); |
|
82 |
|
|
83 |
/** |
|
84 |
* Sets the value of the transformation to apply. The wizard |
|
85 |
* uses this transformation like the selected transformation. |
|
86 |
* @param dataTransformGui |
|
87 |
* The transformation to apply. |
|
88 |
*/ |
|
89 |
public void setDataTransformGui(DataTransformGui dataTransformGui); |
|
90 |
} |
|
91 |
|
Also available in: Unified diff