Revision 37391
tags/v2_0_0_Build_2041/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_2041/extensions/org.gvsig.daltransform.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Fri Nov 18 13:17:22 CET 2011 |
|
3 |
buildNumber=2041 |
tags/v2_0_0_Build_2041/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_2041/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_2041/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_2041/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_2041/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_2041/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.tools.swing.api.ToolsSwingLocator; |
|
60 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
61 |
|
|
62 |
/** |
|
63 |
* @author gvSIG Team |
|
64 |
* @version $Id$ |
|
65 |
* |
|
66 |
*/ |
|
67 |
public class DefaultJDialogDataTransformList extends JDialogDataTransformList { |
|
68 |
|
|
69 |
private static final long serialVersionUID = 8666781163497235054L; |
|
70 |
private JDataTransformList transforms = null; |
|
71 |
|
|
72 |
private JButton botonEliminar; |
|
73 |
private JButton botonCerrar; |
|
74 |
private JComboBox comboBox; |
|
75 |
|
|
76 |
public DefaultJDialogDataTransformList() { |
|
77 |
super(); |
|
78 |
initComponents(); |
|
79 |
createGUI(); |
|
80 |
} |
|
81 |
|
|
82 |
private class MyComboBoxItem { |
|
83 |
|
|
84 |
private String label; |
|
85 |
private FeatureStore store; |
|
86 |
|
|
87 |
MyComboBoxItem(String label, FeatureStore store) { |
|
88 |
this.label = label; |
|
89 |
this.store = store; |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public String toString() { |
|
94 |
return label; |
|
95 |
} |
|
96 |
|
|
97 |
public FeatureStore getStore() { |
|
98 |
return this.store; |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
private class MyComboBoxModel implements ComboBoxModel { |
|
103 |
|
|
104 |
private List<MyComboBoxItem> items = new ArrayList<MyComboBoxItem>(); |
|
105 |
private MyComboBoxItem selected = null; |
|
106 |
|
|
107 |
public MyComboBoxModel(List<MyComboBoxItem> items) { |
|
108 |
this.items.addAll(items); |
|
109 |
} |
|
110 |
|
|
111 |
public Object getSelectedItem() { |
|
112 |
return this.selected; |
|
113 |
} |
|
114 |
|
|
115 |
public MyComboBoxItem getSelected() { |
|
116 |
return this.selected; |
|
117 |
} |
|
118 |
|
|
119 |
public void setSelectedItem(Object arg0) { |
|
120 |
this.selected = (MyComboBoxItem) arg0; |
|
121 |
} |
|
122 |
|
|
123 |
public Object getElementAt(int arg0) { |
|
124 |
return this.items.get(arg0); |
|
125 |
} |
|
126 |
|
|
127 |
public MyComboBoxItem get(int arg0) { |
|
128 |
return this.items.get(arg0); |
|
129 |
} |
|
130 |
|
|
131 |
public int getSize() { |
|
132 |
return this.items.size(); |
|
133 |
} |
|
134 |
|
|
135 |
public void removeListDataListener(ListDataListener arg0) { |
|
136 |
// TODO Auto-generated method stub |
|
137 |
|
|
138 |
} |
|
139 |
|
|
140 |
public void addListDataListener(ListDataListener arg0) { |
|
141 |
// TODO Auto-generated method stub |
|
142 |
|
|
143 |
} |
|
144 |
|
|
145 |
} |
|
146 |
|
|
147 |
private void initComponents() { |
|
148 |
MyComboBoxModel comboModel = new MyComboBoxModel(getAllStores()); |
|
149 |
|
|
150 |
comboBox = new JComboBox(comboModel); |
|
151 |
|
|
152 |
comboBox.addActionListener(new ActionListener() { |
|
153 |
|
|
154 |
public void actionPerformed(ActionEvent e) { |
|
155 |
JComboBox jcmbType = (JComboBox) e.getSource(); |
|
156 |
MyComboBoxModel model = (MyComboBoxModel) jcmbType.getModel(); |
|
157 |
updatePanel(model.getSelected().getStore()); |
|
158 |
} |
|
159 |
}); |
|
160 |
|
|
161 |
if (comboModel.getSize() > 0) { |
|
162 |
transforms = |
|
163 |
DataTransformLocator.getDataTransformManager() |
|
164 |
.createJDataTransformList(comboModel.get(0).getStore()); |
|
165 |
comboModel.setSelectedItem(comboModel.get(0)); |
|
166 |
} |
|
167 |
if (transforms != null) { |
|
168 |
transforms.addListSelectionListener(new ListSelectionHandler()); |
|
169 |
} |
|
170 |
} |
|
171 |
|
|
172 |
private List<MyComboBoxItem> getAllStores() { |
|
173 |
List<MyComboBoxItem> stores = new ArrayList<MyComboBoxItem>(); |
|
174 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
175 |
Project project = application.getCurrentProject(); |
|
176 |
|
|
177 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
|
178 |
for (Document doc : views) { |
|
179 |
ViewDocument viewDocument = (ViewDocument) doc; |
|
180 |
|
|
181 |
FLayer[] layers = |
|
182 |
viewDocument.getMapContext().getLayers().getVisibles(); |
|
183 |
if (layers.length > 1) { |
|
184 |
for (int i = 1; i < layers.length; i++) { |
|
185 |
if (layers[i] instanceof FLyrVect) { |
|
186 |
FLyrVect layer = (FLyrVect) layers[i]; |
|
187 |
stores.add(new MyComboBoxItem(layer.getName(), layer |
|
188 |
.getFeatureStore())); |
|
189 |
} |
|
190 |
} |
|
191 |
} |
|
192 |
} |
|
193 |
List<Document> tables = project.getDocuments(TableManager.TYPENAME); |
|
194 |
for (Document doc : tables) { |
|
195 |
TableDocument tableDocument = (TableDocument) doc; |
|
196 |
stores.add(new MyComboBoxItem(doc.getName(), tableDocument |
|
197 |
.getStore())); |
|
198 |
} |
|
199 |
|
|
200 |
return stores; |
|
201 |
} |
|
202 |
|
|
203 |
private void createGUI() { |
|
204 |
|
|
205 |
java.awt.GridBagConstraints gridBagConstraints; |
|
206 |
this.setLayout(new java.awt.GridBagLayout()); |
|
207 |
|
|
208 |
// Add an empty margin |
|
209 |
this.setBorder(new EmptyBorder(15, 15, 15, 15)); |
|
210 |
|
|
211 |
UsabilitySwingManager usabilitymanager = |
|
212 |
ToolsSwingLocator.getUsabilitySwingManager(); |
|
213 |
|
|
214 |
JLabel layerText = new JLabel("_Select_a_layer:"); |
|
215 |
JLabel transformText = new JLabel("_Select_a_transform:"); |
|
216 |
JPanel botones = new JPanel(); |
|
217 |
|
|
218 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
219 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
|
220 |
gridBagConstraints.gridx = 0; |
|
221 |
gridBagConstraints.gridy = 0; |
|
222 |
gridBagConstraints.weightx = 0.0; |
|
223 |
gridBagConstraints.weighty = 0.0; |
|
224 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
225 |
this.add(layerText, gridBagConstraints); |
|
226 |
|
|
227 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
228 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
229 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
|
230 |
gridBagConstraints.gridx = 0; |
|
231 |
gridBagConstraints.gridy = 1; |
|
232 |
gridBagConstraints.weightx = 0.0; |
|
233 |
gridBagConstraints.weighty = 0.0; |
|
234 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); |
|
235 |
this.add(comboBox, gridBagConstraints); |
|
236 |
|
|
237 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
238 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
|
239 |
gridBagConstraints.gridx = 0; |
|
240 |
gridBagConstraints.gridy = 2; |
|
241 |
gridBagConstraints.weightx = 0.0; |
|
242 |
gridBagConstraints.weighty = 0.0; |
|
243 |
gridBagConstraints.insets = new java.awt.Insets(10, 2, 5, 2); |
|
244 |
this.add(transformText, gridBagConstraints); |
|
245 |
|
|
246 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
247 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
|
248 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER; |
|
249 |
gridBagConstraints.gridx = 0; |
|
250 |
gridBagConstraints.gridy = 3; |
|
251 |
gridBagConstraints.weightx = 0.0; |
|
252 |
gridBagConstraints.weighty = 1.0; |
|
253 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
254 |
if (transforms != null) { |
|
255 |
JScrollPane scroller = new JScrollPane(transforms); |
|
256 |
this.add(scroller, gridBagConstraints); |
|
257 |
} else { |
|
258 |
JPanel emptyPanel = new JPanel(); |
|
259 |
this.add(emptyPanel, gridBagConstraints); |
|
260 |
} |
|
261 |
|
|
262 |
botones.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 0)); |
|
263 |
botonCerrar = usabilitymanager.createJButton(new ActionClose(this)); |
|
264 |
botonCerrar.setText("_close"); |
|
265 |
botonEliminar = usabilitymanager.createJButton(new ActionRemove(this)); |
|
266 |
botonEliminar.setText("_remove"); |
|
267 |
botones.add(botonEliminar); |
|
268 |
botones.add(botonCerrar); |
|
269 |
botonEliminar.setEnabled(false); |
|
270 |
|
|
271 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
272 |
gridBagConstraints.gridx = 0; |
|
273 |
gridBagConstraints.gridy = 4; |
|
274 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; |
|
275 |
gridBagConstraints.weightx = 0.0; |
|
276 |
gridBagConstraints.weighty = 0.0; |
|
277 |
gridBagConstraints.insets = new java.awt.Insets(10, 2, 2, 2); |
|
278 |
this.add(botones, gridBagConstraints); |
|
279 |
|
|
280 |
botonEliminar.setEnabled(false); |
|
281 |
|
|
282 |
updatePanel(null); |
|
283 |
} |
|
284 |
|
|
285 |
class ListSelectionHandler implements ListSelectionListener { |
|
286 |
|
|
287 |
public void valueChanged(ListSelectionEvent e) { |
|
288 |
|
|
289 |
if ((transforms != null) && (transforms.getSelected() != null)) { |
|
290 |
if (transforms.isLastTransform(transforms.getSelected())) { |
|
291 |
botonEliminar.setEnabled(true); |
|
292 |
return; |
|
293 |
} |
|
294 |
} |
|
295 |
botonEliminar.setEnabled(false); |
|
296 |
} |
|
297 |
|
|
298 |
} |
|
299 |
|
|
300 |
@Override |
|
301 |
public Dimension getPreferredSize() { |
|
302 |
return new Dimension(250, 300); |
|
303 |
} |
|
304 |
|
|
305 |
private class ActionRemove implements Action { |
|
306 |
|
|
307 |
private DefaultJDialogDataTransformList parent; |
|
308 |
|
|
309 |
public ActionRemove(DefaultJDialogDataTransformList parent) { |
|
310 |
this.parent = parent; |
|
311 |
} |
|
312 |
|
|
313 |
public void addPropertyChangeListener(PropertyChangeListener listener) { |
|
314 |
} |
|
315 |
|
|
316 |
public Object getValue(String key) { |
|
317 |
return null; |
|
318 |
} |
|
319 |
|
|
320 |
public boolean isEnabled() { |
|
321 |
return true; |
|
322 |
} |
|
323 |
|
|
324 |
public void putValue(String key, Object value) { |
|
325 |
} |
|
326 |
|
|
327 |
public void removePropertyChangeListener(PropertyChangeListener listener) { |
|
328 |
} |
|
329 |
|
|
330 |
public void setEnabled(boolean b) { |
|
331 |
} |
|
332 |
|
|
333 |
public void actionPerformed(ActionEvent e) { |
|
334 |
if (this.parent.transforms.getSelected() != null) { |
|
335 |
this.parent.transforms.remove(this.parent.transforms |
|
336 |
.getSelected()); |
|
337 |
} |
|
338 |
updatePanel(null); |
|
339 |
} |
|
340 |
|
|
341 |
} |
|
342 |
|
|
343 |
private class ActionClose implements Action { |
|
344 |
|
|
345 |
private DefaultJDialogDataTransformList parent; |
|
346 |
|
|
347 |
public ActionClose(DefaultJDialogDataTransformList parent) { |
|
348 |
this.parent = parent; |
|
349 |
} |
|
350 |
|
|
351 |
public void addPropertyChangeListener(PropertyChangeListener listener) { |
|
352 |
} |
|
353 |
|
|
354 |
public Object getValue(String key) { |
|
355 |
return null; |
|
356 |
} |
|
357 |
|
|
358 |
public boolean isEnabled() { |
|
359 |
return true; |
|
360 |
} |
|
361 |
|
|
362 |
public void putValue(String key, Object value) { |
|
363 |
} |
|
364 |
|
|
365 |
public void removePropertyChangeListener(PropertyChangeListener listener) { |
|
366 |
} |
|
367 |
|
|
368 |
public void setEnabled(boolean b) { |
|
369 |
} |
|
370 |
|
|
371 |
public void actionPerformed(ActionEvent e) { |
|
372 |
this.parent.setVisible(false); |
|
373 |
} |
|
374 |
|
|
375 |
} |
|
376 |
|
|
377 |
private void updatePanel(FeatureStore store) { |
|
378 |
|
|
379 |
if (transforms != null) { |
|
380 |
|
|
381 |
if (store != null) { |
|
382 |
FeatureStoreTransforms layerTransforms = store.getTransforms(); |
|
383 |
|
|
384 |
transforms.changeStore(store); |
|
385 |
transforms.removeAllTransforms(); |
|
386 |
transforms.addTransforms(layerTransforms); |
|
387 |
} |
|
388 |
|
|
389 |
// disable the remove button if the transforms list is empty |
|
390 |
if (transforms.getSelected() != null) { |
|
391 |
botonEliminar.setEnabled(transforms.getTransformsCount() > 0); |
|
392 |
} |
|
393 |
|
|
394 |
} else { |
|
395 |
botonEliminar.setEnabled(false); |
|
396 |
} |
|
397 |
|
|
398 |
} |
|
399 |
|
|
400 |
@Override |
|
401 |
public void setDeleteButton(boolean active) { |
|
402 |
botonEliminar.setEnabled(active); |
|
403 |
} |
|
404 |
|
|
405 |
} |
|
0 | 406 |
tags/v2_0_0_Build_2041/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_2041/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(); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
0 | 61 |
tags/v2_0_0_Build_2041/extensions/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_2041/extensions/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_2041/extensions/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_2041/extensions/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_2041/extensions/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.fmap.dal.feature.FeatureStore; |
|
44 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
45 |
import org.gvsig.fmap.mapcontext.layers.LayersIterator; |
|
46 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
47 |
|
|
48 |
|
|
49 |
/** |
|
50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
51 |
*/ |
|
52 |
public class SelectDataStoreWizardPanel extends AbstractDataTransformWizardPanel{ |
|
53 |
private static final long serialVersionUID = -1841990357325903449L; |
|
54 |
private JList dataStoreList; |
|
55 |
private JScrollPane dataStoreScrollPane; |
|
56 |
|
|
57 |
/** |
|
58 |
* @param wizardComponents |
|
59 |
*/ |
|
60 |
public SelectDataStoreWizardPanel() { |
|
61 |
super(); |
|
62 |
initComponents(); |
|
63 |
addDataStores(); |
Also available in: Unified diff