Revision 38353
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Tue May 29 16:39:52 CEST 2012 |
|
3 |
buildNumber=2047 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/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_2047/extensions/org.gvsig.daltransform.app.mainplugin/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 |
|
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/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_2047/extensions/org.gvsig.daltransform.app.mainplugin/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_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeCombo.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import javax.swing.DefaultComboBoxModel; |
|
33 |
import javax.swing.JComboBox; |
|
34 |
|
|
35 |
import org.gvsig.fmap.dal.exception.DataException; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
38 |
import org.slf4j.Logger; |
|
39 |
import org.slf4j.LoggerFactory; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
43 |
*/ |
|
44 |
public class FeatureTypeCombo extends JComboBox{ |
|
45 |
/** |
|
46 |
* |
|
47 |
*/ |
|
48 |
private static final long serialVersionUID = -3689986732982756932L; |
|
49 |
protected static final Logger logger = LoggerFactory.getLogger(FeatureTypeCombo.class); |
|
50 |
|
|
51 |
public FeatureTypeCombo() { |
|
52 |
super(); |
|
53 |
this.setModel(new DefaultComboBoxModel()); |
|
54 |
} |
|
55 |
|
|
56 |
@SuppressWarnings("unchecked") |
|
57 |
public void addFeatureStore(FeatureStore featureStore){ |
|
58 |
removeAllItems(); |
|
59 |
List<FeatureType> featureTypes; |
|
60 |
try { |
|
61 |
featureTypes = featureStore.getFeatureTypes(); |
|
62 |
for (int i=0 ; i<featureTypes.size() ; i++){ |
|
63 |
((DefaultComboBoxModel)getModel()).addElement(featureTypes.get(i)); |
|
64 |
} |
|
65 |
} catch (DataException e) { |
|
66 |
logger.error("Error updating the panel", e); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public FeatureType getSelectedFeatureType(){ |
|
71 |
return (FeatureType)getSelectedItem(); |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
0 | 75 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeWrapper.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class FeatureTypeWrapper { |
|
36 |
private FeatureType featureType = null; |
|
37 |
|
|
38 |
/** |
|
39 |
* @param featureType |
|
40 |
*/ |
|
41 |
public FeatureTypeWrapper(FeatureType featureType) { |
|
42 |
super(); |
|
43 |
this.featureType = featureType; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @return the featureType |
|
48 |
*/ |
|
49 |
public FeatureType getFeatureType() { |
|
50 |
return featureType; |
|
51 |
} |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see java.lang.Object#toString() |
|
55 |
*/ |
|
56 |
public String toString() { |
|
57 |
return featureType.toString(); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
0 | 61 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeAttributesList.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
|
|
32 |
import javax.swing.DefaultListModel; |
|
33 |
import javax.swing.JList; |
|
34 |
|
|
35 |
import org.gvsig.fmap.dal.exception.DataException; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
42 |
*/ |
|
43 |
public class FeatureTypeAttributesList extends JList { |
|
44 |
|
|
45 |
/** |
|
46 |
* |
|
47 |
*/ |
|
48 |
private static final long serialVersionUID = -3457322116557877761L; |
|
49 |
|
|
50 |
public FeatureTypeAttributesList() { |
|
51 |
super(); |
|
52 |
setModel(new DefaultListModel()); |
|
53 |
} |
|
54 |
|
|
55 |
public void addFeatureAttrubutes(FeatureStore featureStore) throws DataException{ |
|
56 |
addFeatureAttributes(featureStore.getDefaultFeatureType()); |
|
57 |
} |
|
58 |
|
|
59 |
public void addFeatureAttributes(FeatureType featureType){ |
|
60 |
removeAll(); |
|
61 |
FeatureAttributeDescriptor[] descriptors = featureType.getAttributeDescriptors(); |
|
62 |
for (int i=0 ; i<descriptors.length ; i++){ |
|
63 |
addFeatureAttributeDescriptor(descriptors[i]); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
public void addFeatureAttributeDescriptor(FeatureAttributeDescriptor featureAttributeDescriptor){ |
|
68 |
((DefaultListModel)getModel()).addElement(new FeatureTypeAttributeWrapper(featureAttributeDescriptor)); |
|
69 |
} |
|
70 |
|
|
71 |
public ArrayList<FeatureAttributeDescriptor> getSelectedFeatureTypes(){ |
|
72 |
ArrayList<FeatureAttributeDescriptor> featureTypes = new ArrayList<FeatureAttributeDescriptor>(); |
|
73 |
Object[] objects = getSelectedValues(); |
|
74 |
for (int i=0 ; i<objects.length ; i++){ |
|
75 |
featureTypes.add(((FeatureTypeAttributeWrapper)objects[i]).getFeatureAttributeDescriptor()); |
|
76 |
} |
|
77 |
return featureTypes; |
|
78 |
} |
|
79 |
|
|
80 |
public String[] getAttributesName(){ |
|
81 |
Object[] objects = getSelectedValues(); |
|
82 |
String[] featureTypes = new String[objects.length]; |
|
83 |
for (int i=0 ; i<objects.length ; i++){ |
|
84 |
featureTypes[i] = ((FeatureTypeAttributeWrapper)objects[i]).getFeatureAttributeDescriptor().getName(); |
|
85 |
} |
|
86 |
return featureTypes; |
|
87 |
} |
|
88 |
} |
|
89 |
|
|
0 | 90 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeAttributeWrapper.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class FeatureTypeAttributeWrapper { |
|
36 |
private FeatureAttributeDescriptor attributeDescriptor = null; |
|
37 |
|
|
38 |
/** |
|
39 |
* @param featureType |
|
40 |
*/ |
|
41 |
public FeatureTypeAttributeWrapper(FeatureAttributeDescriptor attributeDescriptor) { |
|
42 |
super(); |
|
43 |
this.attributeDescriptor = attributeDescriptor; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @return the featureType |
|
48 |
*/ |
|
49 |
public FeatureAttributeDescriptor getFeatureAttributeDescriptor() { |
|
50 |
return attributeDescriptor; |
|
51 |
} |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see java.lang.Object#toString() |
|
55 |
*/ |
|
56 |
public String toString() { |
|
57 |
return attributeDescriptor.getName(); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
0 | 61 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/FeatureTypeAttributesCombo.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import javax.swing.DefaultComboBoxModel; |
|
31 |
import javax.swing.JComboBox; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.exception.DataException; |
|
34 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
37 |
import org.slf4j.Logger; |
|
38 |
import org.slf4j.LoggerFactory; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
42 |
*/ |
|
43 |
public class FeatureTypeAttributesCombo extends JComboBox { |
|
44 |
/** |
|
45 |
* |
|
46 |
*/ |
|
47 |
private static final long serialVersionUID = -8843843810490892699L; |
|
48 |
protected static final Logger logger = LoggerFactory.getLogger(FeatureTypeAttributesCombo.class); |
|
49 |
|
|
50 |
public FeatureTypeAttributesCombo() { |
|
51 |
super(); |
|
52 |
this.setModel(new DefaultComboBoxModel()); |
|
53 |
} |
|
54 |
|
|
55 |
public void addFeatureAttrubutes(FeatureStore featureStore) throws DataException{ |
|
56 |
addFeatureAttributes(featureStore.getDefaultFeatureType()); |
|
57 |
} |
|
58 |
|
|
59 |
public void addFeatureAttributes(FeatureType featureType){ |
|
60 |
removeAllItems(); |
|
61 |
FeatureAttributeDescriptor[] descriptors = featureType.getAttributeDescriptors(); |
|
62 |
for (int i=0 ; i<descriptors.length ; i++){ |
|
63 |
addFeatureAttributeDescriptor(descriptors[i]); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
public void addFeatureAttributeDescriptor(FeatureAttributeDescriptor featureAttributeDescriptor){ |
|
68 |
((DefaultComboBoxModel)getModel()).addElement(new FeatureTypeAttributeWrapper(featureAttributeDescriptor)); |
|
69 |
} |
|
70 |
|
|
71 |
public FeatureAttributeDescriptor getSelectedFeatureAttributeDescriptor(){ |
|
72 |
return ((FeatureTypeAttributeWrapper)getSelectedItem()).getFeatureAttributeDescriptor(); |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
0 | 76 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/components/NumericFeatureTypeAttributesCombo.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl.components; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.DataTypes; |
|
31 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
35 |
*/ |
|
36 |
public class NumericFeatureTypeAttributesCombo extends FeatureTypeAttributesCombo{ |
|
37 |
|
|
38 |
/** |
|
39 |
* |
|
40 |
*/ |
|
41 |
private static final long serialVersionUID = -1694488470656611290L; |
|
42 |
|
|
43 |
/* (non-Javadoc) |
|
44 |
* @see org.gvsig.app.daltransform.gui.combos.FeatureTypeAttributesCombo#addFeatureAttributeDescriptor(org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor) |
|
45 |
*/ |
|
46 |
public void addFeatureAttributeDescriptor( |
|
47 |
FeatureAttributeDescriptor featureAttributeDescriptor) { |
|
48 |
int type = featureAttributeDescriptor.getType(); |
|
49 |
if ((type == DataTypes.DOUBLE) || |
|
50 |
(type == DataTypes.FLOAT) || |
|
51 |
(type == DataTypes.INT) || |
|
52 |
(type == DataTypes.LONG)){ |
|
53 |
super.addFeatureAttributeDescriptor(featureAttributeDescriptor); |
|
54 |
} |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
0 | 58 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/SelectDataStoreWizardPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import javax.swing.DefaultListModel; |
|
33 |
import javax.swing.JList; |
|
34 |
import javax.swing.JScrollPane; |
|
35 |
|
|
36 |
import org.gvsig.andami.PluginServices; |
|
37 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
38 |
import org.gvsig.app.project.ProjectManager; |
|
39 |
import org.gvsig.app.project.documents.Document; |
|
40 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
41 |
import org.gvsig.app.project.documents.table.TableManager; |
|
42 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
43 |
import org.gvsig.daltransform.swing.DataTransformGui; |
|
44 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
45 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
46 |
import org.gvsig.fmap.mapcontext.layers.LayersIterator; |
|
47 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
48 |
|
|
49 |
|
|
50 |
/** |
|
51 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
52 |
*/ |
|
53 |
public class SelectDataStoreWizardPanel extends AbstractDataTransformWizardPanel{ |
|
54 |
private static final long serialVersionUID = -1841990357325903449L; |
|
55 |
private JList dataStoreList; |
|
56 |
private JScrollPane dataStoreScrollPane; |
|
57 |
|
|
58 |
/** |
|
59 |
* @param wizardComponents |
|
60 |
*/ |
|
61 |
public SelectDataStoreWizardPanel() { |
|
62 |
super(); |
|
63 |
initComponents(); |
|
64 |
} |
|
65 |
|
|
66 |
private void initComponents() { |
|
67 |
java.awt.GridBagConstraints gridBagConstraints; |
|
68 |
|
|
69 |
dataStoreScrollPane = new javax.swing.JScrollPane(); |
|
70 |
dataStoreList = new javax.swing.JList(); |
|
71 |
|
|
72 |
setLayout(new java.awt.GridBagLayout()); |
|
73 |
|
|
74 |
dataStoreScrollPane.setViewportView(dataStoreList); |
|
75 |
|
|
76 |
dataStoreList.setModel(new DefaultListModel()); |
|
77 |
|
|
78 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
79 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
|
80 |
gridBagConstraints.weightx = 1.0; |
|
81 |
gridBagConstraints.weighty = 1.0; |
|
82 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
83 |
add(dataStoreScrollPane, gridBagConstraints); |
|
84 |
} |
|
85 |
|
|
86 |
public void removeFeatureStore(FeatureStore featureStore){ |
|
87 |
DefaultListModel model =( DefaultListModel)dataStoreList.getModel(); |
|
88 |
for (int i=model.getSize()-1 ; i>=0 ; i--){ |
|
89 |
if (((FeatureStoreCombo)model.get(i)).getFeatureStore().equals(featureStore)){ |
|
90 |
model.remove(i); |
|
91 |
break; |
|
92 |
} |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* Adding the objects |
|
98 |
*/ |
|
99 |
private void addDataStores(){ |
|
100 |
((DefaultListModel)dataStoreList.getModel()).removeAllElements(); |
|
101 |
DataTransformGui dataTransformGui = |
|
102 |
getDataTransformWizard().getDataTransformGui(); |
|
103 |
|
|
104 |
//Add all the tables |
|
105 |
List<Document> tables = ProjectManager.getInstance().getCurrentProject() |
|
106 |
.getDocuments(TableManager.TYPENAME); |
|
107 |
for (Document table : tables) { |
|
108 |
if (dataTransformGui.accept(((TableDocument)table).getStore())){ |
|
109 |
((DefaultListModel)dataStoreList.getModel()).addElement( |
|
110 |
new FeatureStoreCombo( |
|
111 |
table.getName(), |
|
112 |
((TableDocument)table).getStore(), |
|
113 |
false |
|
114 |
) |
|
115 |
); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
//Add the layers from the current view |
|
120 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
121 |
if (window instanceof IView){ |
|
122 |
IView view = (IView)window; |
|
123 |
LayersIterator it = new LayersIterator( |
|
124 |
view.getMapControl().getMapContext().getLayers()); |
|
125 |
while(it.hasNext()){ |
|
126 |
FLayer layer = it.nextLayer(); |
|
127 |
if (layer instanceof FLyrVect){ |
|
128 |
FLyrVect layerVect = (FLyrVect)layer; |
|
129 |
FeatureStore featureStore = layerVect.getFeatureStore(); |
|
130 |
boolean found = false; |
|
131 |
for (int i=0 ; i<tables.size() ; i++){ |
|
132 |
TableDocument table = (TableDocument)tables.get(i); |
|
133 |
if (table.getStore().equals(featureStore)) { |
|
134 |
found = true; |
|
135 |
} |
|
136 |
} |
|
137 |
if (!found){ |
|
138 |
if (dataTransformGui.accept(featureStore)){ |
|
139 |
((DefaultListModel)dataStoreList.getModel()).addElement( |
|
140 |
new FeatureStoreCombo(layerVect.getName(), |
|
141 |
featureStore, |
|
142 |
true)); |
|
143 |
} |
|
144 |
} |
|
145 |
} |
|
146 |
} |
|
147 |
} |
|
148 |
} |
|
149 |
|
|
150 |
|
|
151 |
/** |
|
152 |
* @return the selected feature store |
|
153 |
*/ |
|
154 |
public FeatureStore getSelectedFeatureStore(){ |
|
155 |
Object obj = dataStoreList.getSelectedValue(); |
|
156 |
if (obj != null){ |
|
157 |
return ((FeatureStoreCombo)obj).getFeatureStore(); |
|
158 |
} |
|
159 |
return null; |
|
160 |
} |
|
161 |
|
|
162 |
/* (non-Javadoc) |
|
163 |
* @see org.gvsig.app.daltransform.impl.AbstractDataTransformWizardPanel#getFeatureStore() |
|
164 |
*/ |
|
165 |
@Override |
|
166 |
public FeatureStore getFeatureStore() { |
|
167 |
return getSelectedFeatureStore(); |
|
168 |
} |
|
169 |
|
|
170 |
/** |
|
171 |
* @return the selected feature store |
|
172 |
*/ |
|
173 |
public boolean isSelectedFeatureStoreLoaded(){ |
|
174 |
Object obj = dataStoreList.getSelectedValue(); |
|
175 |
if (obj != null){ |
|
176 |
return ((FeatureStoreCombo)obj).isLoaded(); |
|
177 |
} |
|
178 |
return false; |
|
179 |
} |
|
180 |
|
|
181 |
/** |
|
182 |
* Used to fill the combo |
|
183 |
* @author jpiera |
|
184 |
*/ |
|
185 |
private class FeatureStoreCombo{ |
|
186 |
private FeatureStore featureStore = null; |
|
187 |
private String name = null; |
|
188 |
private boolean isLoaded = false; |
|
189 |
|
|
190 |
public FeatureStoreCombo(String name, FeatureStore featureStore, boolean isLoaded) { |
|
191 |
super(); |
|
192 |
this.name = name; |
|
193 |
this.featureStore = featureStore; |
|
194 |
this.isLoaded = isLoaded; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* @return the isLoaded |
|
199 |
*/ |
|
200 |
public boolean isLoaded() { |
|
201 |
return isLoaded; |
|
202 |
} |
|
203 |
|
|
204 |
/** |
|
205 |
* @return the featureStore |
|
206 |
*/ |
|
207 |
public FeatureStore getFeatureStore() { |
|
208 |
return featureStore; |
|
209 |
} |
|
210 |
|
|
211 |
/* (non-Javadoc) |
|
212 |
* @see java.lang.Object#toString() |
|
213 |
*/ |
|
214 |
public String toString() { |
|
215 |
return name; |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 |
/* |
|
220 |
* (non-Javadoc) |
|
221 |
* @see org.gvsig.app.daltransform.gui.FeatureTransformWizard#getPanelTitle() |
|
222 |
*/ |
|
223 |
public String getPanelTitle() { |
|
224 |
return PluginServices.getText(this, "transform_datastore_selection"); |
|
225 |
} |
|
226 |
|
|
227 |
/* (non-Javadoc) |
|
228 |
* @see org.gvsig.app.daltransform.DataTransformWizard#updatePanel() |
|
229 |
*/ |
|
230 |
public void updatePanel() { |
|
231 |
addDataStores(); |
|
232 |
if (dataStoreList.getSelectedIndex() == -1){ |
|
233 |
if (dataStoreList.getModel().getSize() > 0){ |
|
234 |
dataStoreList.setSelectedIndex(0); |
|
235 |
getDataTransformWizard().setApplicable(true); |
|
236 |
}else{ |
|
237 |
getDataTransformWizard().setApplicable(false); |
|
238 |
} |
|
239 |
} |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* @return |
|
244 |
*/ |
|
245 |
public boolean isFeatureStoreLayer() { |
|
246 |
Object obj = dataStoreList.getSelectedValue(); |
|
247 |
if (obj != null){ |
|
248 |
return ((FeatureStoreCombo)obj).isLoaded; |
|
249 |
} |
|
250 |
return false; |
|
251 |
} |
|
252 |
|
|
253 |
/* (non-Javadoc) |
|
254 |
* @see org.gvsig.app.daltransform.impl.AbstractDataTransformWizardPanel#nextPanel() |
|
255 |
*/ |
|
256 |
@Override |
|
257 |
public void nextPanel() { |
|
258 |
getDataTransformWizard().updateGui(); |
|
259 |
} |
|
260 |
|
|
261 |
|
|
262 |
} |
|
263 |
|
|
0 | 264 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/DataTransformSelectionAction.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl; |
|
29 |
|
|
30 |
import jwizardcomponent.FinishAction; |
|
31 |
|
|
32 |
import org.slf4j.Logger; |
|
33 |
import org.slf4j.LoggerFactory; |
|
34 |
|
|
35 |
import org.gvsig.andami.PluginServices; |
|
36 |
import org.gvsig.daltransform.swing.DataTransformGui; |
|
37 |
import org.gvsig.fmap.crs.CRSFactory; |
|
38 |
import org.gvsig.fmap.dal.exception.DataException; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
40 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransform; |
|
41 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
42 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
43 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
44 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
45 |
|
|
46 |
|
|
47 |
/** |
|
48 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
49 |
*/ |
|
50 |
public class DataTransformSelectionAction extends FinishAction{ |
|
51 |
private static final Logger logger = LoggerFactory.getLogger(DataTransformSelectionAction.class); |
|
52 |
private DefaultDataTransformWizard dataTransformWizard = null; |
|
53 |
|
|
54 |
public DataTransformSelectionAction(DefaultDataTransformWizard dataTransformWizard) { |
|
55 |
super(dataTransformWizard.getWizardComponents()); |
|
56 |
this.dataTransformWizard = dataTransformWizard; |
|
57 |
} |
|
58 |
|
|
59 |
/* (non-Javadoc) |
|
60 |
* @see jwizardcomponent.Action#performAction() |
|
61 |
*/ |
|
62 |
public void performAction() { |
|
63 |
//Gets the selected transformation |
|
64 |
DataTransformGui featureTransformGui = dataTransformWizard.getDataTransformGui(); |
|
65 |
|
|
66 |
//Gets the selected FeatureStore |
|
67 |
FeatureStore featureStore = dataTransformWizard.getFeatureStore(); |
|
68 |
|
|
69 |
try { |
|
70 |
//Gets the transform |
|
71 |
FeatureStoreTransform featureStoreTransform = featureTransformGui.createFeatureStoreTransform(featureStore); |
|
72 |
|
|
73 |
//Apply the transformation |
|
74 |
featureStore.getTransforms().add(featureStoreTransform); |
|
75 |
|
|
76 |
//Create and load a new layer... |
|
77 |
if (dataTransformWizard.isLayerLoaded()){ |
|
78 |
MapContextManager manager = MapContextLocator.getMapContextManager(); |
|
79 |
FLayer layer = manager.createLayer(featureTransformGui.toString(), featureStore); |
|
80 |
dataTransformWizard.getMapContext().getLayers().addLayer(layer); |
|
81 |
layer.dispose(); |
|
82 |
} |
|
83 |
} catch (DataException e) { |
|
84 |
logger.error("Error creating the transformation", e); |
|
85 |
} catch (LoadLayerException e) { |
|
86 |
logger.error("Error loading the layer", e); |
|
87 |
} |
|
88 |
//Closing the window |
|
89 |
PluginServices.getMDIManager().closeWindow(dataTransformWizard); |
|
90 |
} |
|
91 |
|
|
92 |
} |
|
93 |
|
|
0 | 94 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/DataTransformWizardContainer.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl; |
|
29 |
|
|
30 |
import java.awt.BorderLayout; |
|
31 |
|
|
32 |
import jwizardcomponent.JWizardComponents; |
|
33 |
import jwizardcomponent.JWizardPanel; |
|
34 |
|
|
35 |
import org.gvsig.daltransform.swing.DataTransformWizardPanel; |
|
36 |
|
|
37 |
|
|
38 |
/** |
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
40 |
*/ |
|
41 |
public class DataTransformWizardContainer extends JWizardPanel { |
|
42 |
private static final long serialVersionUID = -3410258554443619626L; |
|
43 |
private DataTransformWizardPanel wizard = null; |
|
44 |
|
|
45 |
/** |
|
46 |
* @param wizardComponents |
|
47 |
*/ |
|
48 |
public DataTransformWizardContainer(JWizardComponents wizardComponents, DataTransformWizardPanel wizard) { |
|
49 |
super(wizardComponents); |
|
50 |
this.wizard = wizard; |
|
51 |
setLayout(new BorderLayout()); |
|
52 |
setBorder(javax.swing.BorderFactory.createTitledBorder(wizard.getPanelTitle())); |
|
53 |
add(wizard.getJPanel(), BorderLayout.CENTER); |
|
54 |
} |
|
55 |
|
|
56 |
/* (non-Javadoc) |
|
57 |
* @see jwizardcomponent.WizardPanel#back() |
|
58 |
*/ |
|
59 |
@Override |
|
60 |
public void back() { |
|
61 |
wizard.lastPanel(); |
|
62 |
super.back(); |
|
63 |
} |
|
64 |
|
|
65 |
/* (non-Javadoc) |
|
66 |
* @see jwizardcomponent.WizardPanel#next() |
|
67 |
*/ |
|
68 |
@Override |
|
69 |
public void next() { |
|
70 |
wizard.nextPanel(); |
|
71 |
super.next(); |
|
72 |
} |
|
73 |
|
|
74 |
/* (non-Javadoc) |
|
75 |
* @see jwizardcomponent.JWizardPanel#update() |
|
76 |
*/ |
|
77 |
@Override |
|
78 |
public void update() { |
|
79 |
wizard.updatePanel(); |
|
80 |
super.update(); |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
0 | 84 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/AbstractDataTransformWizardPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl; |
|
29 |
|
|
30 |
import javax.swing.JPanel; |
|
31 |
|
|
32 |
import org.gvsig.andami.PluginServices; |
|
33 |
import org.gvsig.daltransform.swing.DataTransformWizard; |
|
34 |
import org.gvsig.daltransform.swing.DataTransformWizardPanel; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
36 |
import org.slf4j.Logger; |
|
37 |
import org.slf4j.LoggerFactory; |
|
38 |
|
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
42 |
*/ |
|
43 |
public abstract class AbstractDataTransformWizardPanel extends JPanel implements DataTransformWizardPanel { |
|
44 |
/** |
|
45 |
* |
|
46 |
*/ |
|
47 |
private static final long serialVersionUID = 3397225908470941630L; |
|
48 |
protected static final Logger logger = LoggerFactory.getLogger(AbstractDataTransformWizardPanel.class); |
|
49 |
private DefaultDataTransformWizard dataTransformWizard = null; |
|
50 |
|
|
51 |
/** |
|
52 |
* @param featureStore |
|
53 |
*/ |
|
54 |
public AbstractDataTransformWizardPanel() { |
|
55 |
super(); |
|
56 |
} |
|
57 |
|
|
58 |
/* (non-Javadoc) |
|
59 |
* @see org.gvsig.app.daltransform.DataTransformWizardPanel#setDataTransformWizard(org.gvsig.app.daltransform.DataTransformWizard) |
|
60 |
*/ |
|
61 |
public void setDataTransformWizard(DataTransformWizard dataTransformWizard) { |
|
62 |
this.dataTransformWizard = (DefaultDataTransformWizard)dataTransformWizard; |
|
63 |
} |
|
64 |
|
|
65 |
/* (non-Javadoc) |
|
66 |
* @see org.gvsig.app.daltransform.DataTransformWizard#getJPanel() |
|
67 |
*/ |
|
68 |
public JPanel getJPanel() { |
|
69 |
return this; |
|
70 |
} |
|
71 |
|
|
72 |
/* (non-Javadoc) |
|
73 |
* @see org.gvsig.app.daltransform.DataTransformWizard#getPanelTitle() |
|
74 |
*/ |
|
75 |
public String getPanelTitle() { |
|
76 |
return PluginServices.getText(this, "transform_parameters"); |
|
77 |
} |
|
78 |
|
|
79 |
/* (non-Javadoc) |
|
80 |
* @see org.gvsig.app.daltransform.DataTransformWizard#isNextButtonEnabled() |
|
81 |
*/ |
|
82 |
public boolean isNextButtonEnabled() { |
|
83 |
return true; |
|
84 |
} |
|
85 |
|
|
86 |
/* (non-Javadoc) |
|
87 |
* @see org.gvsig.app.daltransform.DataTransformWizard#lastPanel() |
|
88 |
*/ |
|
89 |
public void lastPanel() { |
|
90 |
// TODO Auto-generated method stub |
|
91 |
|
|
92 |
} |
|
93 |
|
|
94 |
/* (non-Javadoc) |
|
95 |
* @see org.gvsig.app.daltransform.DataTransformWizard#nextPanel() |
|
96 |
*/ |
|
97 |
public void nextPanel() { |
|
98 |
// TODO Auto-generated method stub |
|
99 |
|
|
100 |
} |
|
101 |
|
|
102 |
/* (non-Javadoc) |
|
103 |
* @see org.gvsig.app.daltransform.DataTransformWizard#updatePanel() |
|
104 |
*/ |
|
105 |
public void updatePanel() { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* @return the featureStore |
|
112 |
*/ |
|
113 |
public FeatureStore getFeatureStore() { |
|
114 |
if (dataTransformWizard != null){ |
|
115 |
return dataTransformWizard.getFeatureStore(); |
|
116 |
} |
|
117 |
return null; |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* @return the dataTransformWizard |
|
122 |
*/ |
|
123 |
public DefaultDataTransformWizard getDataTransformWizard() { |
|
124 |
return dataTransformWizard; |
|
125 |
} |
|
126 |
|
|
127 |
} |
|
128 |
|
|
0 | 129 |
tags/v2_0_0_Build_2047/extensions/org.gvsig.daltransform.app.mainplugin/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/DefaultDataTransformWizard.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.daltransform.swing.impl; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import org.gvsig.andami.PluginServices; |
|
33 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
34 |
import org.gvsig.andami.ui.wizard.WizardAndami; |
|
35 |
import org.gvsig.daltransform.swing.DataTransformGui; |
|
36 |
import org.gvsig.daltransform.swing.DataTransformWizard; |
|
37 |
import org.gvsig.daltransform.swing.DataTransformWizardPanel; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
39 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
43 |
*/ |
|
44 |
public class DefaultDataTransformWizard extends WizardAndami implements |
|
45 |
DataTransformWizard { |
|
46 |
|
|
47 |
/** |
|
48 |
* |
|
49 |
*/ |
|
50 |
private static final long serialVersionUID = 8346790424453722486L; |
|
51 |
private List<DataTransformWizardPanel> transformWizardPanels = null; |
|
52 |
// The three default panels |
|
53 |
private LoadLayerWizardPanel loadLayerWizardPanel = null; |
|
54 |
private SelectDataStoreWizardPanel selectDataStoreWizardPanel = null; |
|
55 |
private SelectTransformWizardPanel selectTransformWizardPanel = null; |
|
56 |
// If the wizard has to use a concrete transformation |
|
57 |
private DataTransformGui dataTransformGui = null; |
|
58 |
private int PANELS_TO_REFRESH = 2; |
|
59 |
|
|
60 |
/** |
|
61 |
* @param wizard |
|
62 |
*/ |
|
63 |
public DefaultDataTransformWizard() { |
|
64 |
super(PluginServices.getIconTheme().get("feature-transform")); |
|
65 |
loadLayerWizardPanel = new LoadLayerWizardPanel(); |
|
66 |
selectDataStoreWizardPanel = new SelectDataStoreWizardPanel(); |
|
67 |
selectTransformWizardPanel = new SelectTransformWizardPanel(); |
Also available in: Unified diff