Revision 39469
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<fileSet> |
|
8 |
<directory>src/main/resources</directory> |
|
9 |
<outputDirectory>${extension.install.dir.name} |
|
10 |
</outputDirectory> |
|
11 |
</fileSet> |
|
12 |
</fileSets> |
|
13 |
|
|
14 |
<files> |
|
15 |
<file> |
|
16 |
<source>package.info</source> |
|
17 |
<outputDirectory>${extension.install.dir.name} |
|
18 |
</outputDirectory> |
|
19 |
</file> |
|
20 |
</files> |
|
21 |
|
|
22 |
<dependencySets> |
|
23 |
<dependencySet> |
|
24 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
25 |
</outputDirectory> |
|
26 |
<includes> |
|
27 |
<include>org.gvsig:org.gvsig.daltransform.app.mainplugin</include> |
|
28 |
</includes> |
|
29 |
</dependencySet> |
|
30 |
</dependencySets> |
|
31 |
</assembly> |
|
0 | 32 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Fri Dec 14 11:32:38 CET 2012 |
|
3 |
buildNumber=2073 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/test/java/org/gvsig/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.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_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.daltransform.DataTransformLibrary |
|
2 |
org.gvsig.daltransform.impl.DefaultDataTransformLibrary |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/resources/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 |
<depends plugin-name="org.gvsig.app.document.table.app.mainplugin" /> |
|
6 |
<resourceBundle name="text"/> |
|
7 |
<extensions> |
|
8 |
<extension class-name="org.gvsig.daltransform.app.mainplugin.DataTransformExtension" |
|
9 |
description="Create a transform" |
|
10 |
active="true"> |
|
11 |
<menu text="tools/feature_transform/create" |
|
12 |
action-command="CREATE" /> |
|
13 |
</extension> |
|
14 |
<extension class-name="org.gvsig.daltransform.app.mainplugin.DataTransformExtension" |
|
15 |
description="View a transform" |
|
16 |
active="true"> |
|
17 |
<menu text="tools/feature_transform/view" |
|
18 |
action-command="VIEW" /> |
|
19 |
</extension> |
|
20 |
</extensions> |
|
21 |
</plugin-config> |
|
0 | 22 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/resources/org/gvsig/daltransform/i18n/text.properties | ||
---|---|---|
1 |
transform_wizard=Aplicar una transformaci?n |
|
2 |
transform_selection=Selecciona una transformaci?n |
|
3 |
transform_datastore_selection=Selecciona un origen de datos |
|
4 |
transform_parameters=Selecciona los par?metros de la transformaci?n |
|
5 |
feature_transform=Transformaciones |
|
6 |
transform_apply=Aplicar la transformaci?n |
|
7 |
transform_load_layer_query=Cargar el resultado de la transformaci?n como una capa |
|
8 |
transform_layer=Ha aplicado una transformaci?n sobre una capa. Si contin?a, el resultado de la transformaci?n de aplicar? sobre la capa. |
|
9 |
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. |
|
10 |
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. |
|
11 |
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. |
|
12 |
transform_view_to_load=Selecciona la vista en la que quiere cargar la transformaci?n |
|
13 |
transform_second_datastore_selection=Selecciona el segundo origen de datos |
|
14 |
transform_create_wizard_exception=Excepci?n creando el wizard para aplicar trasnformaciones. |
|
15 |
create=Crear |
|
16 |
view=Ver |
|
17 |
select_transform=Selecciona una transformaci?n |
|
18 |
select_layer=Selecciona una capa |
|
19 |
view_transforms=Ver transformaciones |
|
20 |
not_featurestore_loaded=No hay ning?n almac?n de datos vectorial cargado |
|
0 | 21 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/resources/org/gvsig/daltransform/i18n/text_en.properties | ||
---|---|---|
1 |
transform_wizard=Apply a transform |
|
2 |
transform_selection=Select a transform |
|
3 |
transform_datastore_selection=Select a data store |
|
4 |
transform_parameters=Select the transformation parameters |
|
5 |
feature_transform=Transforms |
|
6 |
transform_apply=Apply the transform |
|
7 |
transform_load_layer_query=Load the transformation output like a layer |
|
8 |
transform_layer=You have applied the transformation in a layer. If you continue, the result will be applied in the layer. |
|
9 |
transform_layout_geometry=You have applied the transformation in a table. The result of the transformation has a geometric attribute and it is possible to load it like a layer. |
|
10 |
transform_layout_no_geometry==You have applied the transformation in a table The result of the transformation DOESN'T have a geometric attribute and it can NOT be loaded like a layer. |
|
11 |
transform_layout_not_view_to_load=You have applied the transformation in a table.The result of the transformation has a geometric attribute and it is possible to load it like a layer but there is not a view created. If you want to visualize it, just create a view and apply other time the transformation. |
|
12 |
transform_view_to_load=Select the view to load the transformation. |
|
13 |
transform_second_datastore_selection=Select the second data store. |
|
14 |
transform_create_wizard_exception=Exception creating a wizard to apply transformations. |
|
15 |
create=Create |
|
16 |
view=View |
|
17 |
select_transform=Select a transform |
|
18 |
select_layer=Select a layer |
|
19 |
view_transforms=View transforms |
|
20 |
not_featurestore_loaded=There is not any feature store loaded |
|
0 | 21 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/CreateWizardException.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform; |
|
29 |
|
|
30 |
import org.gvsig.tools.exception.BaseException; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class CreateWizardException extends BaseException{ |
|
36 |
private static final long serialVersionUID = 3062621423281216473L; |
|
37 |
|
|
38 |
/** |
|
39 |
* @param message |
|
40 |
* @param cause |
|
41 |
* @param key |
|
42 |
* @param code |
|
43 |
*/ |
|
44 |
public CreateWizardException(Throwable cause) { |
|
45 |
init(); |
|
46 |
initCause(cause); |
|
47 |
} |
|
48 |
|
|
49 |
private void init() { |
|
50 |
messageKey = "transform_create_wizard_exception"; |
|
51 |
formatString = "Can?t create the wizard to apply transformations."; |
|
52 |
} |
|
53 |
|
|
54 |
} |
|
55 |
|
|
0 | 56 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/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.daltransform.swing; |
|
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 |
|
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/DataTransformWizardPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing; |
|
29 |
|
|
30 |
import javax.swing.JPanel; |
|
31 |
|
|
32 |
/** |
|
33 |
* This class has to be inherited by all the classes |
|
34 |
* that appears on the transformation wizard. It contains |
|
35 |
* methods to manage the wizard. |
|
36 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
37 |
*/ |
|
38 |
public interface DataTransformWizardPanel { |
|
39 |
|
|
40 |
/** |
|
41 |
* Returns a title for the panel. |
|
42 |
* @return |
|
43 |
* The panel title. |
|
44 |
*/ |
|
45 |
public String getPanelTitle(); |
|
46 |
|
|
47 |
/** |
|
48 |
* This method is called when the next button is clicked |
|
49 |
*/ |
|
50 |
public void nextPanel(); |
|
51 |
|
|
52 |
/** |
|
53 |
* This method is called when the last button is clicked |
|
54 |
*/ |
|
55 |
public void lastPanel(); |
|
56 |
|
|
57 |
/** |
|
58 |
* This method is called when the panel is displayed |
|
59 |
*/ |
|
60 |
public void updatePanel(); |
|
61 |
|
|
62 |
/** |
|
63 |
* Return the panel to display. |
|
64 |
* @return |
|
65 |
* The panel. |
|
66 |
*/ |
|
67 |
public JPanel getJPanel(); |
|
68 |
|
|
69 |
/** |
|
70 |
* Sets the DataTransformWizard that contains information about |
|
71 |
* all the wizard. |
|
72 |
* @param dataTransformWizard |
|
73 |
* The wizard to set. |
|
74 |
*/ |
|
75 |
public void setDataTransformWizard(DataTransformWizard dataTransformWizard); |
|
76 |
} |
|
77 |
|
|
78 |
|
|
0 | 79 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/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.daltransform.swing; |
|
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 |
* Return if the transformation can be applied in a {@link FeatureStore}. |
|
62 |
* @param featureStore |
|
63 |
* the original feature store |
|
64 |
* @return |
|
65 |
* <code>true</code> if the transformation can be applied. |
|
66 |
*/ |
|
67 |
public boolean accept(FeatureStore featureStore); |
|
68 |
|
|
69 |
/** |
|
70 |
* Creates a list of panels to set the parameters used on the transformation. |
|
71 |
* @return |
|
72 |
* a set of panels with the parameters of the transformation |
|
73 |
*/ |
|
74 |
public List<DataTransformWizardPanel> createPanels(); |
|
75 |
|
|
76 |
/** |
|
77 |
* @return the name that is displayed in the feature transformation |
|
78 |
* list |
|
79 |
*/ |
|
80 |
public String getName(); |
|
81 |
|
|
82 |
/** |
|
83 |
* @return a description of the feature transformation |
|
84 |
*/ |
|
85 |
public String getDescription(); |
|
86 |
|
|
87 |
/** |
|
88 |
* Returns the minimum size that has to be the wizard to display |
|
89 |
* the forms. |
|
90 |
* @return |
|
91 |
* The minimum size for the panels. |
|
92 |
*/ |
|
93 |
public Dimension getMinDimension(); |
|
94 |
|
|
95 |
|
|
96 |
} |
|
97 |
|
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/JDataTransformList.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.daltransform.swing; |
|
23 |
|
|
24 |
import javax.swing.JPanel; |
|
25 |
import javax.swing.event.ListSelectionListener; |
|
26 |
|
|
27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
28 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransform; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
|
30 |
|
|
31 |
/** |
|
32 |
* @author gvSIG Team |
|
33 |
* @version $Id$ |
|
34 |
* |
|
35 |
*/ |
|
36 |
public abstract class JDataTransformList extends JPanel { |
|
37 |
|
|
38 |
private static final long serialVersionUID = -6577975265992377228L; |
|
39 |
|
|
40 |
public abstract FeatureStoreTransform getSelected(); |
|
41 |
|
|
42 |
public abstract void remove(FeatureStoreTransform transform); |
|
43 |
|
|
44 |
public <ListSelectionListenerHandler> void addListSelectionListener( |
|
45 |
ListSelectionListenerHandler listSelectionListenerHandler) { |
|
46 |
} |
|
47 |
|
|
48 |
public abstract void addTransforms(FeatureStoreTransforms transforms); |
|
49 |
|
|
50 |
public abstract void removeAllTransforms(); |
|
51 |
|
|
52 |
public abstract void changeStore(FeatureStore featureStore); |
|
53 |
|
|
54 |
public abstract int getTransformsCount(); |
|
55 |
|
|
56 |
public abstract boolean isLastTransform(FeatureStoreTransform selected); |
|
57 |
|
|
58 |
public abstract void addListSelectionListener( |
|
59 |
ListSelectionListener actionListener); |
|
60 |
|
|
61 |
public abstract int getSelectedIndex(); |
|
62 |
|
|
63 |
} |
|
0 | 64 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/JDialogDataTransformList.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.daltransform.swing; |
|
23 |
|
|
24 |
import javax.swing.JPanel; |
|
25 |
|
|
26 |
/** |
|
27 |
* @author gvSIG Team |
|
28 |
* @version $Id$ |
|
29 |
* |
|
30 |
*/ |
|
31 |
public abstract class JDialogDataTransformList extends JPanel { |
|
32 |
|
|
33 |
private static final long serialVersionUID = -4119133113380461961L; |
|
34 |
|
|
35 |
public abstract void setDeleteButton(boolean active); |
|
36 |
|
|
37 |
} |
|
0 | 38 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/DefaultJDataTransformList.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.daltransform.swing.impl; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
|
|
26 |
import javax.swing.DefaultListModel; |
|
27 |
import javax.swing.JList; |
|
28 |
import javax.swing.ListSelectionModel; |
|
29 |
import javax.swing.event.ListSelectionEvent; |
|
30 |
import javax.swing.event.ListSelectionListener; |
|
31 |
|
|
32 |
import org.gvsig.daltransform.swing.JDataTransformList; |
|
33 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
34 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransform; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
|
36 |
|
|
37 |
/** |
|
38 |
* @author gvSIG Team |
|
39 |
* @version $Id$ |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class DefaultJDataTransformList extends JDataTransformList { |
|
43 |
|
|
44 |
private static final long serialVersionUID = 3179282558802329381L; |
|
45 |
|
|
46 |
private FeatureStore store; |
|
47 |
private JList l; |
|
48 |
DefaultListModel model; |
|
49 |
|
|
50 |
public DefaultJDataTransformList(FeatureStore store) { |
|
51 |
this.store = store; |
|
52 |
createComponents(); |
|
53 |
} |
|
54 |
|
|
55 |
private void createComponents() { |
|
56 |
FeatureStoreTransforms transforms = this.store.getTransforms(); |
|
57 |
model = new DefaultListModel(); |
|
58 |
for (int i = 0; i < transforms.size(); i++) { |
|
59 |
model.addElement(new ItemData(transforms.getTransform(i))); |
|
60 |
} |
|
61 |
l = new JList(model); |
|
62 |
l.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|
63 |
this.add(l); |
|
64 |
this.setBackground(Color.WHITE); |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public void addListSelectionListener(ListSelectionListener actionListener) { |
|
70 |
this.l.addListSelectionListener(new ListSelectionListenerWrapper(this, |
|
71 |
actionListener)); |
|
72 |
} |
|
73 |
|
|
74 |
private class ListSelectionListenerWrapper implements ListSelectionListener { |
|
75 |
|
|
76 |
private DefaultJDataTransformList list; |
|
77 |
private ListSelectionListener listListener; |
|
78 |
|
|
79 |
public ListSelectionListenerWrapper(DefaultJDataTransformList list, |
|
80 |
ListSelectionListener listListener) { |
|
81 |
this.list = list; |
|
82 |
this.listListener = listListener; |
|
83 |
} |
|
84 |
|
|
85 |
public void valueChanged(ListSelectionEvent e) { |
|
86 |
listListener.valueChanged(new ListSelectionEventWrapper(e, list)); |
|
87 |
} |
|
88 |
} |
|
89 |
|
|
90 |
private class ListSelectionEventWrapper extends ListSelectionEvent { |
|
91 |
|
|
92 |
private static final long serialVersionUID = -8159225017709144435L; |
|
93 |
|
|
94 |
public ListSelectionEventWrapper(ListSelectionEvent e, |
|
95 |
DefaultJDataTransformList transformList) { |
|
96 |
super(transformList, e.getFirstIndex(), e.getLastIndex(), e |
|
97 |
.getValueIsAdjusting()); |
|
98 |
} |
|
99 |
|
|
100 |
} |
|
101 |
|
|
102 |
private class ItemData { |
|
103 |
|
|
104 |
public FeatureStoreTransform transform; |
|
105 |
|
|
106 |
ItemData(FeatureStoreTransform transform) { |
|
107 |
this.transform = transform; |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
public String toString() { |
|
112 |
return this.transform.getName(); |
|
113 |
} |
|
114 |
|
|
115 |
public FeatureStoreTransform getTransform() { |
|
116 |
return transform; |
|
117 |
} |
|
118 |
|
|
119 |
@Override |
|
120 |
public boolean equals(Object obj) { |
|
121 |
return this.transform.equals(((ItemData) obj).transform); |
|
122 |
} |
|
123 |
} |
|
124 |
|
|
125 |
@Override |
|
126 |
public FeatureStoreTransform getSelected() { |
|
127 |
if ((l != null) && (l.getSelectedValue() != null)) { |
|
128 |
return ((ItemData) l.getSelectedValue()).getTransform(); |
|
129 |
} |
|
130 |
return null; |
|
131 |
} |
|
132 |
|
|
133 |
@Override |
|
134 |
public void remove(FeatureStoreTransform transform) { |
|
135 |
this.store.getTransforms().remove(transform); |
|
136 |
model.removeElement(new ItemData(transform)); |
|
137 |
} |
|
138 |
|
|
139 |
@Override |
|
140 |
public void addTransforms(FeatureStoreTransforms transforms) { |
|
141 |
for (int i = 0; i < transforms.size(); i++) { |
|
142 |
model.addElement(new ItemData(transforms.getTransform(i))); |
|
143 |
} |
|
144 |
} |
|
145 |
|
|
146 |
@Override |
|
147 |
public void removeAllTransforms() { |
|
148 |
model.removeAllElements(); |
|
149 |
} |
|
150 |
|
|
151 |
@Override |
|
152 |
public void changeStore(FeatureStore featureStore) { |
|
153 |
this.store = featureStore; |
|
154 |
} |
|
155 |
|
|
156 |
@Override |
|
157 |
public int getTransformsCount() { |
|
158 |
return model.getSize(); |
|
159 |
} |
|
160 |
|
|
161 |
@Override |
|
162 |
public boolean isLastTransform(FeatureStoreTransform selectedTransform) { |
|
163 |
|
|
164 |
ItemData selectedTransformItem = new ItemData(selectedTransform); |
|
165 |
ItemData lastTransformItem = (ItemData) model.get(model.size() - 1); |
|
166 |
|
|
167 |
if (selectedTransformItem.equals(lastTransformItem)) { |
|
168 |
return true; |
|
169 |
} else { |
|
170 |
return false; |
|
171 |
} |
|
172 |
} |
|
173 |
|
|
174 |
@Override |
|
175 |
public int getSelectedIndex() { |
|
176 |
return this.l.getSelectedIndex(); |
|
177 |
} |
|
178 |
|
|
179 |
} |
|
0 | 180 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/DefaultJDialogDataTransformList.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.daltransform.swing.impl; |
|
23 |
|
|
24 |
import java.awt.Dimension; |
|
25 |
import java.awt.FlowLayout; |
|
26 |
import java.awt.event.ActionEvent; |
|
27 |
import java.awt.event.ActionListener; |
|
28 |
import java.beans.PropertyChangeListener; |
|
29 |
import java.util.ArrayList; |
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import javax.swing.Action; |
|
33 |
import javax.swing.ComboBoxModel; |
|
34 |
import javax.swing.JButton; |
|
35 |
import javax.swing.JComboBox; |
|
36 |
import javax.swing.JLabel; |
|
37 |
import javax.swing.JPanel; |
|
38 |
import javax.swing.JScrollPane; |
|
39 |
import javax.swing.border.EmptyBorder; |
|
40 |
import javax.swing.event.ListDataListener; |
|
41 |
import javax.swing.event.ListSelectionEvent; |
|
42 |
import javax.swing.event.ListSelectionListener; |
|
43 |
|
|
44 |
import org.gvsig.app.ApplicationLocator; |
|
45 |
import org.gvsig.app.ApplicationManager; |
|
46 |
import org.gvsig.app.project.Project; |
|
47 |
import org.gvsig.app.project.documents.Document; |
|
48 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
49 |
import org.gvsig.app.project.documents.table.TableManager; |
|
50 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
51 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
52 |
import org.gvsig.daltransform.DataTransformLocator; |
|
53 |
import org.gvsig.daltransform.swing.JDataTransformList; |
|
54 |
import org.gvsig.daltransform.swing.JDialogDataTransformList; |
|
55 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
56 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
|
57 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
58 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
59 |
import org.gvsig.i18n.Messages; |
|
60 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
61 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
62 |
|
|
63 |
/** |
|
64 |
* @author gvSIG Team |
|
65 |
* @version $Id$ |
|
66 |
* |
|
67 |
*/ |
|
68 |
public class DefaultJDialogDataTransformList extends JDialogDataTransformList { |
|
69 |
|
|
70 |
private static final long serialVersionUID = 8666781163497235054L; |
|
71 |
private JDataTransformList transforms = null; |
|
72 |
|
|
73 |
private JButton botonEliminar; |
|
74 |
private JButton botonCerrar; |
|
75 |
private JComboBox comboBox; |
|
76 |
|
|
77 |
public DefaultJDialogDataTransformList() { |
|
78 |
super(); |
|
79 |
initComponents(); |
|
80 |
createGUI(); |
|
81 |
} |
|
82 |
|
|
83 |
private class MyComboBoxItem { |
|
84 |
|
|
85 |
private String label; |
|
86 |
private FeatureStore store; |
|
87 |
|
|
88 |
MyComboBoxItem(String label, FeatureStore store) { |
|
89 |
this.label = label; |
|
90 |
this.store = store; |
|
91 |
} |
|
92 |
|
|
93 |
@Override |
|
94 |
public String toString() { |
|
95 |
return label; |
|
96 |
} |
|
97 |
|
|
98 |
public FeatureStore getStore() { |
|
99 |
return this.store; |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
private class MyComboBoxModel implements ComboBoxModel { |
|
104 |
|
|
105 |
private List<MyComboBoxItem> items = new ArrayList<MyComboBoxItem>(); |
|
106 |
private MyComboBoxItem selected = null; |
|
107 |
|
|
108 |
public MyComboBoxModel(List<MyComboBoxItem> items) { |
|
109 |
this.items.addAll(items); |
|
110 |
} |
|
111 |
|
|
112 |
public Object getSelectedItem() { |
|
113 |
return this.selected; |
|
114 |
} |
|
115 |
|
|
116 |
public MyComboBoxItem getSelected() { |
|
117 |
return this.selected; |
|
118 |
} |
|
119 |
|
|
120 |
public void setSelectedItem(Object arg0) { |
|
121 |
this.selected = (MyComboBoxItem) arg0; |
|
122 |
} |
|
123 |
|
|
124 |
public Object getElementAt(int arg0) { |
|
125 |
return this.items.get(arg0); |
|
126 |
} |
|
127 |
|
|
128 |
public MyComboBoxItem get(int arg0) { |
|
129 |
return this.items.get(arg0); |
|
130 |
} |
|
131 |
|
|
132 |
public int getSize() { |
|
133 |
return this.items.size(); |
|
134 |
} |
|
135 |
|
|
136 |
public void removeListDataListener(ListDataListener arg0) { |
|
137 |
// TODO Auto-generated method stub |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
public void addListDataListener(ListDataListener arg0) { |
|
142 |
// TODO Auto-generated method stub |
|
143 |
|
|
144 |
} |
|
145 |
|
|
146 |
} |
|
147 |
|
|
148 |
private void initComponents() { |
|
149 |
MyComboBoxModel comboModel = new MyComboBoxModel(getAllStores()); |
|
150 |
|
|
151 |
comboBox = new JComboBox(comboModel); |
|
152 |
|
|
153 |
comboBox.addActionListener(new ActionListener() { |
|
154 |
|
|
155 |
public void actionPerformed(ActionEvent e) { |
|
156 |
JComboBox jcmbType = (JComboBox) e.getSource(); |
|
157 |
MyComboBoxModel model = (MyComboBoxModel) jcmbType.getModel(); |
|
158 |
updatePanel(model.getSelected().getStore()); |
|
159 |
} |
|
160 |
}); |
|
161 |
|
|
162 |
if (comboModel.getSize() > 0) { |
|
163 |
transforms = |
|
164 |
DataTransformLocator.getDataTransformManager() |
|
165 |
.createJDataTransformList(comboModel.get(0).getStore()); |
|
166 |
comboModel.setSelectedItem(comboModel.get(0)); |
|
167 |
} |
|
168 |
if (transforms != null) { |
|
169 |
transforms.addListSelectionListener(new ListSelectionHandler()); |
|
170 |
} |
|
171 |
} |
|
172 |
|
|
173 |
private List<MyComboBoxItem> getAllStores() { |
|
174 |
List<MyComboBoxItem> stores = new ArrayList<MyComboBoxItem>(); |
|
175 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
176 |
Project project = application.getCurrentProject(); |
|
177 |
|
|
178 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
|
179 |
for (Document doc : views) { |
|
180 |
ViewDocument viewDocument = (ViewDocument) doc; |
|
181 |
|
|
182 |
FLayer[] layers = |
|
183 |
viewDocument.getMapContext().getLayers().getVisibles(); |
|
184 |
if (layers.length > 1) { |
|
185 |
for (int i = 1; i < layers.length; i++) { |
|
186 |
if (layers[i] instanceof FLyrVect) { |
|
187 |
FLyrVect layer = (FLyrVect) layers[i]; |
|
188 |
stores.add(new MyComboBoxItem(layer.getName(), layer |
|
189 |
.getFeatureStore())); |
|
190 |
} |
|
191 |
} |
|
192 |
} |
|
193 |
} |
|
194 |
List<Document> tables = project.getDocuments(TableManager.TYPENAME); |
|
195 |
for (Document doc : tables) { |
|
196 |
TableDocument tableDocument = (TableDocument) doc; |
|
197 |
stores.add(new MyComboBoxItem(doc.getName(), tableDocument |
|
198 |
.getStore())); |
|
199 |
} |
|
200 |
|
|
201 |
return stores; |
|
202 |
} |
|
203 |
|
|
204 |
private void createGUI() { |
|
205 |
|
|
206 |
java.awt.GridBagConstraints gridBagConstraints; |
|
207 |
this.setLayout(new java.awt.GridBagLayout()); |
|
208 |
|
|
209 |
// Add an empty margin |
|
210 |
this.setBorder(new EmptyBorder(15, 15, 15, 15)); |
|
211 |
|
|
212 |
UsabilitySwingManager usabilitymanager = |
|
213 |
ToolsSwingLocator.getUsabilitySwingManager(); |
|
214 |
|
|
215 |
JLabel layerText = new JLabel(Messages.getText("select_layer")); |
|
216 |
JLabel transformText = new JLabel(Messages.getText("select_transform")); |
|
217 |
JPanel botones = new JPanel(); |
|
218 |
|
|
219 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
220 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
|
221 |
gridBagConstraints.gridx = 0; |
|
222 |
gridBagConstraints.gridy = 0; |
|
223 |
gridBagConstraints.weightx = 0.0; |
|
224 |
gridBagConstraints.weighty = 0.0; |
|
225 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
226 |
this.add(layerText, gridBagConstraints); |
|
227 |
|
|
228 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
229 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
230 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
|
231 |
gridBagConstraints.gridx = 0; |
|
232 |
gridBagConstraints.gridy = 1; |
|
233 |
gridBagConstraints.weightx = 1.0; |
|
234 |
gridBagConstraints.weighty = 0.0; |
|
235 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); |
|
236 |
this.add(comboBox, gridBagConstraints); |
|
237 |
|
|
238 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
239 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
|
240 |
gridBagConstraints.gridx = 0; |
|
241 |
gridBagConstraints.gridy = 2; |
|
242 |
gridBagConstraints.weightx = 0.0; |
|
243 |
gridBagConstraints.weighty = 0.0; |
|
244 |
gridBagConstraints.insets = new java.awt.Insets(10, 2, 5, 2); |
|
245 |
this.add(transformText, gridBagConstraints); |
|
246 |
|
|
247 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
248 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
|
249 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER; |
|
250 |
gridBagConstraints.gridx = 0; |
|
251 |
gridBagConstraints.gridy = 3; |
|
252 |
gridBagConstraints.weightx = 1.0; |
|
253 |
gridBagConstraints.weighty = 1.0; |
|
254 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
255 |
if (transforms != null) { |
|
256 |
JScrollPane scroller = new JScrollPane(transforms); |
|
257 |
this.add(scroller, gridBagConstraints); |
|
258 |
} else { |
|
259 |
JPanel emptyPanel = new JPanel(); |
|
260 |
this.add(emptyPanel, gridBagConstraints); |
|
261 |
} |
|
262 |
|
|
263 |
botones.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 0)); |
|
264 |
botonCerrar = usabilitymanager.createJButton(new ActionClose(this)); |
|
265 |
botonCerrar.setText(Messages.getText("close")); |
|
266 |
botonEliminar = usabilitymanager.createJButton(new ActionRemove(this)); |
|
267 |
botonEliminar.setText(Messages.getText("remove")); |
|
268 |
botones.add(botonEliminar); |
|
269 |
botones.add(botonCerrar); |
|
270 |
botonEliminar.setEnabled(false); |
|
271 |
|
|
272 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
273 |
gridBagConstraints.gridx = 0; |
|
274 |
gridBagConstraints.gridy = 4; |
|
275 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; |
|
276 |
gridBagConstraints.weightx = 0.0; |
|
277 |
gridBagConstraints.weighty = 0.0; |
|
278 |
gridBagConstraints.insets = new java.awt.Insets(10, 2, 2, 2); |
|
279 |
this.add(botones, gridBagConstraints); |
|
280 |
|
|
281 |
botonEliminar.setEnabled(false); |
|
282 |
|
|
283 |
updatePanel(null); |
|
284 |
} |
|
285 |
|
|
286 |
class ListSelectionHandler implements ListSelectionListener { |
|
287 |
|
|
288 |
public void valueChanged(ListSelectionEvent e) { |
|
289 |
|
|
290 |
if ((transforms != null) && (transforms.getSelected() != null)) { |
|
291 |
if (transforms.isLastTransform(transforms.getSelected())) { |
|
292 |
botonEliminar.setEnabled(true); |
|
293 |
return; |
|
294 |
} |
|
295 |
} |
|
296 |
botonEliminar.setEnabled(false); |
|
297 |
} |
|
298 |
|
|
299 |
} |
|
300 |
|
|
301 |
@Override |
|
302 |
public Dimension getPreferredSize() { |
|
303 |
return new Dimension(250, 300); |
|
304 |
} |
|
305 |
|
|
306 |
private class ActionRemove implements Action { |
|
307 |
|
|
308 |
private DefaultJDialogDataTransformList parent; |
|
309 |
|
|
310 |
public ActionRemove(DefaultJDialogDataTransformList parent) { |
|
311 |
this.parent = parent; |
|
312 |
} |
|
313 |
|
|
314 |
public void addPropertyChangeListener(PropertyChangeListener listener) { |
|
315 |
} |
|
316 |
|
|
317 |
public Object getValue(String key) { |
|
318 |
return null; |
|
319 |
} |
|
320 |
|
|
321 |
public boolean isEnabled() { |
|
322 |
return true; |
|
323 |
} |
|
324 |
|
|
325 |
public void putValue(String key, Object value) { |
|
326 |
} |
|
327 |
|
|
328 |
public void removePropertyChangeListener(PropertyChangeListener listener) { |
|
329 |
} |
|
330 |
|
|
331 |
public void setEnabled(boolean b) { |
|
332 |
} |
|
333 |
|
|
334 |
public void actionPerformed(ActionEvent e) { |
|
335 |
if (this.parent.transforms.getSelected() != null) { |
|
336 |
this.parent.transforms.remove(this.parent.transforms |
|
337 |
.getSelected()); |
|
338 |
} |
|
339 |
updatePanel(null); |
|
340 |
} |
|
341 |
|
|
342 |
} |
|
343 |
|
|
344 |
private class ActionClose implements Action { |
|
345 |
|
|
346 |
private DefaultJDialogDataTransformList parent; |
|
347 |
|
|
348 |
public ActionClose(DefaultJDialogDataTransformList parent) { |
|
349 |
this.parent = parent; |
|
350 |
} |
|
351 |
|
|
352 |
public void addPropertyChangeListener(PropertyChangeListener listener) { |
|
353 |
} |
|
354 |
|
|
355 |
public Object getValue(String key) { |
|
356 |
return null; |
|
357 |
} |
|
358 |
|
|
359 |
public boolean isEnabled() { |
|
360 |
return true; |
|
361 |
} |
|
362 |
|
|
363 |
public void putValue(String key, Object value) { |
|
364 |
} |
|
365 |
|
|
366 |
public void removePropertyChangeListener(PropertyChangeListener listener) { |
|
367 |
} |
|
368 |
|
|
369 |
public void setEnabled(boolean b) { |
|
370 |
} |
|
371 |
|
|
372 |
public void actionPerformed(ActionEvent e) { |
|
373 |
this.parent.setVisible(false); |
|
374 |
} |
|
375 |
|
|
376 |
} |
|
377 |
|
|
378 |
private void updatePanel(FeatureStore store) { |
|
379 |
|
|
380 |
if (transforms != null) { |
|
381 |
|
|
382 |
if (store != null) { |
|
383 |
FeatureStoreTransforms layerTransforms = store.getTransforms(); |
|
384 |
|
|
385 |
transforms.changeStore(store); |
|
386 |
transforms.removeAllTransforms(); |
|
387 |
transforms.addTransforms(layerTransforms); |
|
388 |
} |
|
389 |
|
|
390 |
// disable the remove button if the transforms list is empty |
|
391 |
if (transforms.getSelected() != null) { |
|
392 |
botonEliminar.setEnabled(transforms.getTransformsCount() > 0); |
|
393 |
} |
|
394 |
|
|
395 |
} else { |
|
396 |
botonEliminar.setEnabled(false); |
|
397 |
} |
|
398 |
|
|
399 |
} |
|
400 |
|
|
401 |
@Override |
|
402 |
public void setDeleteButton(boolean active) { |
|
403 |
botonEliminar.setEnabled(active); |
|
404 |
} |
|
405 |
|
|
406 |
} |
|
0 | 407 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeCombo.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import javax.swing.DefaultComboBoxModel; |
|
33 |
import javax.swing.JComboBox; |
|
34 |
|
|
35 |
import org.gvsig.fmap.dal.exception.DataException; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
38 |
import org.slf4j.Logger; |
|
39 |
import org.slf4j.LoggerFactory; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
43 |
*/ |
|
44 |
public class FeatureTypeCombo extends JComboBox{ |
|
45 |
/** |
|
46 |
* |
|
47 |
*/ |
|
48 |
private static final long serialVersionUID = -3689986732982756932L; |
|
49 |
protected static final Logger logger = LoggerFactory.getLogger(FeatureTypeCombo.class); |
|
50 |
|
|
51 |
public FeatureTypeCombo() { |
|
52 |
super(); |
|
53 |
this.setModel(new DefaultComboBoxModel()); |
|
54 |
} |
|
55 |
|
|
56 |
@SuppressWarnings("unchecked") |
|
57 |
public void addFeatureStore(FeatureStore featureStore){ |
|
58 |
removeAllItems(); |
|
59 |
List<FeatureType> featureTypes; |
|
60 |
try { |
|
61 |
featureTypes = featureStore.getFeatureTypes(); |
|
62 |
for (int i=0 ; i<featureTypes.size() ; i++){ |
|
63 |
((DefaultComboBoxModel)getModel()).addElement(featureTypes.get(i)); |
|
64 |
} |
|
65 |
} catch (DataException e) { |
|
66 |
logger.error("Error updating the panel", e); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public FeatureType getSelectedFeatureType(){ |
|
71 |
return (FeatureType)getSelectedItem(); |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
0 | 75 |
tags/v2_0_0_Build_2061/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeWrapper.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class FeatureTypeWrapper { |
|
36 |
private FeatureType featureType = null; |
|
37 |
|
|
38 |
/** |
|
39 |
* @param featureType |
|
40 |
*/ |
|
41 |
public FeatureTypeWrapper(FeatureType featureType) { |
|
42 |
super(); |
|
43 |
this.featureType = featureType; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @return the featureType |
|
48 |
*/ |
|
49 |
public FeatureType getFeatureType() { |
|
50 |
return featureType; |
|
51 |
} |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see java.lang.Object#toString() |
|
55 |
*/ |
|
56 |
public String toString() { |
|
57 |
return featureType.toString(); |
Also available in: Unified diff