svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extDalTransformJoin / src / org / gvsig / app / join / daltransform / SelectParametersWizard.java @ 28897
History | View | Annotate | Download (7.53 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 {Iver T.I.} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.app.join.daltransform; |
29 |
|
30 |
import org.gvsig.app.daltransform.gui.DataTransformWizard; |
31 |
import org.gvsig.app.daltransform.gui.DataTransformWizardModel; |
32 |
import org.gvsig.app.daltransform.gui.components.FeatureTypeAttributeWrapper; |
33 |
import org.gvsig.app.daltransform.gui.components.FeatureTypeAttributesCombo; |
34 |
import org.gvsig.app.daltransform.gui.components.FeatureTypeAttributesList; |
35 |
import org.gvsig.fmap.dal.exception.DataException; |
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
37 |
|
38 |
import com.iver.andami.PluginServices; |
39 |
|
40 |
/**
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
42 |
*/
|
43 |
public class SelectParametersWizard extends DataTransformWizard{ |
44 |
private javax.swing.JLabel attributesLabel;
|
45 |
private FeatureTypeAttributesList attributesList;
|
46 |
private javax.swing.JScrollPane attributesScroll;
|
47 |
private FeatureTypeAttributesCombo key1Combo;
|
48 |
private javax.swing.JLabel key1Label;
|
49 |
private FeatureTypeAttributesCombo key2Combo;
|
50 |
private javax.swing.JLabel key2Label;
|
51 |
private javax.swing.JLabel prefix1Label;
|
52 |
private javax.swing.JTextField prefix1Text;
|
53 |
private javax.swing.JLabel prefix2Label;
|
54 |
private javax.swing.JTextField prefix2Text;
|
55 |
|
56 |
/**
|
57 |
* @param featureTransformWizardModel
|
58 |
*/
|
59 |
public SelectParametersWizard(
|
60 |
DataTransformWizardModel featureTransformWizardModel) { |
61 |
super(featureTransformWizardModel);
|
62 |
initComponents(); |
63 |
initLabels(); |
64 |
} |
65 |
|
66 |
private void initLabels(){ |
67 |
key1Label.setText(PluginServices.getText(this,"join_first_key")); |
68 |
key2Label.setText(PluginServices.getText(this,"join_second_key")); |
69 |
prefix1Label.setText(PluginServices.getText(this,"join_first_prefix")); |
70 |
prefix2Label.setText(PluginServices.getText(this,"join_second_prefix")); |
71 |
attributesLabel.setText(PluginServices.getText(this,"join_select_attributes")); |
72 |
} |
73 |
|
74 |
private void initComponents() { |
75 |
java.awt.GridBagConstraints gridBagConstraints; |
76 |
|
77 |
prefix2Text = new javax.swing.JTextField();
|
78 |
key2Combo = new FeatureTypeAttributesCombo();
|
79 |
prefix1Text = new javax.swing.JTextField();
|
80 |
key1Label = new javax.swing.JLabel();
|
81 |
key1Combo = new FeatureTypeAttributesCombo();
|
82 |
key2Label = new javax.swing.JLabel();
|
83 |
prefix1Label = new javax.swing.JLabel();
|
84 |
prefix2Label = new javax.swing.JLabel();
|
85 |
attributesLabel = new javax.swing.JLabel();
|
86 |
attributesScroll = new javax.swing.JScrollPane();
|
87 |
attributesList = new FeatureTypeAttributesList();
|
88 |
|
89 |
setLayout(new java.awt.GridBagLayout());
|
90 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
91 |
gridBagConstraints.gridx = 0;
|
92 |
gridBagConstraints.gridy = 7;
|
93 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
94 |
gridBagConstraints.weightx = 1.0;
|
95 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 3, 2); |
96 |
add(prefix2Text, gridBagConstraints); |
97 |
|
98 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
99 |
gridBagConstraints.gridx = 0;
|
100 |
gridBagConstraints.gridy = 3;
|
101 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
102 |
gridBagConstraints.weightx = 1.0;
|
103 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 3, 2); |
104 |
add(key2Combo, gridBagConstraints); |
105 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
106 |
gridBagConstraints.gridx = 0;
|
107 |
gridBagConstraints.gridy = 5;
|
108 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
109 |
gridBagConstraints.weightx = 1.0;
|
110 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 3, 2); |
111 |
add(prefix1Text, gridBagConstraints); |
112 |
|
113 |
key1Label.setText("jLabel1");
|
114 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
115 |
gridBagConstraints.gridx = 0;
|
116 |
gridBagConstraints.gridy = 0;
|
117 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
118 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
119 |
add(key1Label, gridBagConstraints); |
120 |
|
121 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
122 |
gridBagConstraints.gridx = 0;
|
123 |
gridBagConstraints.gridy = 1;
|
124 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
125 |
gridBagConstraints.weightx = 1.0;
|
126 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 3, 2); |
127 |
add(key1Combo, gridBagConstraints); |
128 |
|
129 |
key2Label.setText("jLabel2");
|
130 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
131 |
gridBagConstraints.gridx = 0;
|
132 |
gridBagConstraints.gridy = 2;
|
133 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
134 |
gridBagConstraints.insets = new java.awt.Insets(3, 2, 2, 2); |
135 |
add(key2Label, gridBagConstraints); |
136 |
|
137 |
prefix1Label.setText("jLabel1");
|
138 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
139 |
gridBagConstraints.gridx = 0;
|
140 |
gridBagConstraints.gridy = 4;
|
141 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
142 |
gridBagConstraints.insets = new java.awt.Insets(3, 2, 2, 2); |
143 |
add(prefix1Label, gridBagConstraints); |
144 |
|
145 |
prefix2Label.setText("jLabel2");
|
146 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
147 |
gridBagConstraints.gridx = 0;
|
148 |
gridBagConstraints.gridy = 6;
|
149 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
150 |
gridBagConstraints.insets = new java.awt.Insets(3, 2, 2, 2); |
151 |
add(prefix2Label, gridBagConstraints); |
152 |
|
153 |
attributesLabel.setText("attributesLabel");
|
154 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
155 |
gridBagConstraints.gridx = 0;
|
156 |
gridBagConstraints.gridy = 8;
|
157 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
158 |
gridBagConstraints.insets = new java.awt.Insets(3, 2, 2, 2); |
159 |
add(attributesLabel, gridBagConstraints); |
160 |
|
161 |
attributesScroll.setViewportView(attributesList); |
162 |
|
163 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
164 |
gridBagConstraints.gridx = 0;
|
165 |
gridBagConstraints.gridy = 9;
|
166 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
167 |
gridBagConstraints.weightx = 1.0;
|
168 |
gridBagConstraints.weighty = 1.0;
|
169 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
170 |
add(attributesScroll, gridBagConstraints); |
171 |
} |
172 |
|
173 |
/**
|
174 |
* @return
|
175 |
*/
|
176 |
public String getKeyAttr1() { |
177 |
return key1Combo.getSelectedFeatureAttributeDescriptor().getName();
|
178 |
} |
179 |
|
180 |
/**
|
181 |
* @return
|
182 |
*/
|
183 |
public String getkeyAtrr2() { |
184 |
return key2Combo.getSelectedFeatureAttributeDescriptor().getName();
|
185 |
} |
186 |
|
187 |
/**
|
188 |
* @return
|
189 |
*/
|
190 |
public String getPrefix1() { |
191 |
return prefix1Text.getText();
|
192 |
} |
193 |
|
194 |
/**
|
195 |
* @return
|
196 |
*/
|
197 |
public String getPrefix2() { |
198 |
return prefix2Text.getText();
|
199 |
} |
200 |
|
201 |
/**
|
202 |
* @return
|
203 |
*/
|
204 |
public String[] getAttributes() { |
205 |
return attributesList.getAttributesName();
|
206 |
} |
207 |
|
208 |
/**
|
209 |
* @param selectedFeatureStore
|
210 |
* @throws DataException
|
211 |
*/
|
212 |
public void updateFeatureStores(FeatureStore selectedFeatureStore) throws DataException { |
213 |
key1Combo.addFeatureAttributes(getFeatureStore().getDefaultFeatureType()); |
214 |
key2Combo.addFeatureAttributes(selectedFeatureStore.getDefaultFeatureType()); |
215 |
attributesList.addFeatureAttributes(selectedFeatureStore.getDefaultFeatureType()); |
216 |
} |
217 |
} |
218 |
|