Revision 6745 trunk/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/core/gui/SpatialJoinNumericFieldSelection.java
SpatialJoinNumericFieldSelection.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.2 2006-06-20 18:19:43 azabala |
|
48 |
* Revision 1.3 2006-08-11 16:12:27 azabala |
|
49 |
* *** empty log message *** |
|
50 |
* |
|
51 |
* Revision 1.2 2006/06/20 18:19:43 azabala |
|
49 | 52 |
* refactorizaci?n para que todos los nuevos geoprocesos cuelguen del paquete impl |
50 | 53 |
* |
51 | 54 |
* Revision 1.1 2006/05/24 21:13:09 azabala |
... | ... | |
67 | 70 |
*/ |
68 | 71 |
package com.iver.cit.gvsig.geoprocess.core.gui; |
69 | 72 |
|
73 |
import java.awt.BorderLayout; |
|
70 | 74 |
import java.awt.event.ActionEvent; |
71 | 75 |
import java.awt.event.ActionListener; |
72 |
import java.util.HashMap; |
|
73 | 76 |
import java.util.Map; |
74 | 77 |
|
75 |
import javax.swing.JButton; |
|
78 |
|
|
76 | 79 |
import javax.swing.JDialog; |
77 | 80 |
import javax.swing.JFrame; |
78 |
import javax.swing.JLabel; |
|
79 |
import javax.swing.JList; |
|
80 | 81 |
import javax.swing.JPanel; |
81 |
import javax.swing.JScrollPane; |
|
82 | 82 |
|
83 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
84 |
import org.gvsig.gui.beans.swing.JButton; |
|
85 |
|
|
83 | 86 |
import com.iver.andami.PluginServices; |
84 |
import com.iver.cit.gvsig.geoprocess.core.fmap.SummarizationFunction;
|
|
87 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
|
|
85 | 88 |
|
86 |
import java.awt.GridBagLayout; |
|
87 |
import java.awt.GridBagConstraints; |
|
88 |
/** |
|
89 |
* FIXME: INTERNACIONALIZAR LOS TEXTOS |
|
90 |
* QUITAR LOS LISTMODEL REPETIDOS DEL DISSOLVE |
|
91 |
* @author azabala |
|
92 |
* |
|
93 |
*/ |
|
94 | 89 |
public class SpatialJoinNumericFieldSelection |
95 | 90 |
extends JDialog implements SpatialJoinNumFieldIF { |
96 | 91 |
|
97 | 92 |
private static final long serialVersionUID = -9031708821779458450L; |
98 |
private JPanel jContentPane = null; |
|
99 |
private JScrollPane numericFieldScrollPane = null; |
|
100 |
private JList numericFieldJList = null; |
|
101 |
private JScrollPane functionScrollPane = null; |
|
102 |
private JList functionJList = null; |
|
103 |
private JButton linkButton = null; |
|
104 |
private JLabel fieldsLabel = null; |
|
105 |
private JLabel functionsLabel = null; |
|
106 |
private JButton okButton = null; |
|
107 |
private SumarizeFunctionsDialog sumarizeFuncDialog; |
|
108 | 93 |
|
109 |
private Map nField_sumFuntionList; |
|
110 |
private String[] numericFields; |
|
94 |
private FLyrVect inputLayer; |
|
95 |
private JPanel jContentPane; |
|
96 |
private JPanel acceptCancelPanel; |
|
111 | 97 |
private boolean ok = false; |
112 | 98 |
/** |
113 | 99 |
* This is the default constructor |
114 | 100 |
*/ |
115 |
public SpatialJoinNumericFieldSelection() { |
|
101 |
public SpatialJoinNumericFieldSelection(FLyrVect inputLayer) {
|
|
116 | 102 |
super((JFrame)PluginServices.getMainFrame(), true); |
103 |
this.inputLayer = inputLayer; |
|
117 | 104 |
initialize(); |
118 | 105 |
} |
119 | 106 |
|
... | ... | |
123 | 110 |
* @return void |
124 | 111 |
*/ |
125 | 112 |
private void initialize() { |
126 |
this.setSize(351, 236); |
|
127 | 113 |
this.setTitle(PluginServices.getText(this,"Funciones_Sumarizacion")); |
128 |
this.setContentPane(getJContentPane()); |
|
129 |
this.nField_sumFuntionList = new HashMap(); |
|
114 |
getContentPane().setLayout(new BorderLayout()); |
|
115 |
getContentPane().add(getJContentPane(), BorderLayout.CENTER); |
|
116 |
getContentPane().add(getAcceptCancelPanel(), BorderLayout.SOUTH); |
|
117 |
|
|
130 | 118 |
} |
119 |
|
|
120 |
private JPanel getAcceptCancelPanel() { |
|
121 |
if (acceptCancelPanel == null) { |
|
122 |
acceptCancelPanel = new AcceptCancelPanel(); |
|
123 |
((AcceptCancelPanel) acceptCancelPanel).setOkButtonActionListener(new ActionListener(){ |
|
124 |
public void actionPerformed(ActionEvent arg0) { |
|
125 |
ok(); |
|
131 | 126 |
|
127 |
}}); |
|
128 |
((AcceptCancelPanel) acceptCancelPanel).setCancelButtonActionListener(new ActionListener(){ |
|
129 |
|
|
130 |
public void actionPerformed(ActionEvent arg0) { |
|
131 |
setVisible(false); |
|
132 |
}}); |
|
133 |
} |
|
134 |
return acceptCancelPanel; |
|
135 |
} |
|
136 |
|
|
132 | 137 |
/** |
133 | 138 |
* This method initializes jContentPane |
134 | 139 |
* |
... | ... | |
136 | 141 |
*/ |
137 | 142 |
private JPanel getJContentPane() { |
138 | 143 |
if (jContentPane == null) { |
139 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
|
140 |
gridBagConstraints5.insets = new java.awt.Insets(8,6,28,2); |
|
141 |
gridBagConstraints5.gridy = 2; |
|
142 |
gridBagConstraints5.ipadx = 10; |
|
143 |
gridBagConstraints5.ipady = -10; |
|
144 |
gridBagConstraints5.gridx = 1; |
|
145 |
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
|
146 |
gridBagConstraints4.insets = new java.awt.Insets(0,66,5,12); |
|
147 |
gridBagConstraints4.gridx = 1; |
|
148 |
gridBagConstraints4.gridy = 0; |
|
149 |
gridBagConstraints4.ipadx = 0; |
|
150 |
gridBagConstraints4.gridwidth = 2; |
|
151 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
|
152 |
gridBagConstraints3.insets = new java.awt.Insets(0,15,5,8); |
|
153 |
gridBagConstraints3.gridy = 0; |
|
154 |
gridBagConstraints3.gridwidth = 1; |
|
155 |
gridBagConstraints3.gridheight = 1; |
|
156 |
gridBagConstraints3.gridx = 0; |
|
157 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
|
158 |
gridBagConstraints2.insets = new java.awt.Insets(54,6,66,2); |
|
159 |
gridBagConstraints2.gridy = 1; |
|
160 |
gridBagConstraints2.ipadx = 16; |
|
161 |
gridBagConstraints2.ipady = -10; |
|
162 |
gridBagConstraints2.fill = java.awt.GridBagConstraints.NONE; |
|
163 |
gridBagConstraints2.gridx = 1; |
|
164 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
165 |
gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; |
|
166 |
gridBagConstraints1.gridx = 2; |
|
167 |
gridBagConstraints1.gridy = 1; |
|
168 |
gridBagConstraints1.ipadx = -152; |
|
169 |
gridBagConstraints1.ipady = -9; |
|
170 |
gridBagConstraints1.weightx = 1.0; |
|
171 |
gridBagConstraints1.weighty = 1.0; |
|
172 |
gridBagConstraints1.insets = new java.awt.Insets(6,2,8,21); |
|
173 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
174 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
|
175 |
gridBagConstraints.gridx = 0; |
|
176 |
gridBagConstraints.gridy = 1; |
|
177 |
gridBagConstraints.ipadx = -134; |
|
178 |
gridBagConstraints.ipady = -10; |
|
179 |
gridBagConstraints.weightx = 1.0; |
|
180 |
gridBagConstraints.weighty = 1.0; |
|
181 |
gridBagConstraints.insets = new java.awt.Insets(7,13,8,6); |
|
182 |
functionsLabel = new JLabel(); |
|
183 |
functionsLabel.setText(PluginServices.getText(this, "Funciones_Sumarizacion")); |
|
184 |
fieldsLabel = new JLabel(); |
|
185 |
fieldsLabel.setText(PluginServices.getText(this, "Atributos_Numericos")); |
|
186 |
jContentPane = new JPanel(); |
|
187 |
jContentPane.setLayout(new GridBagLayout()); |
|
188 |
jContentPane.add(getNumericFieldScrollPane(), gridBagConstraints); |
|
189 |
jContentPane.add(getFunctionScrollPane(), gridBagConstraints1); |
|
190 |
jContentPane.add(getLinkButton(), gridBagConstraints2); |
|
191 |
jContentPane.add(fieldsLabel, gridBagConstraints3); |
|
192 |
jContentPane.add(functionsLabel, gridBagConstraints4); |
|
193 |
jContentPane.add(getOkButton(), gridBagConstraints5); |
|
144 |
jContentPane = new NumericFieldFunctionsControl(inputLayer); |
|
194 | 145 |
} |
195 | 146 |
return jContentPane; |
196 | 147 |
} |
197 | 148 |
|
198 |
/** |
|
199 |
* This method initializes numericFieldScrollPane |
|
200 |
* |
|
201 |
* @return javax.swing.JScrollPane |
|
202 |
*/ |
|
203 |
private JScrollPane getNumericFieldScrollPane() { |
|
204 |
if (numericFieldScrollPane == null) { |
|
205 |
numericFieldScrollPane = new JScrollPane(); |
|
206 |
numericFieldScrollPane.setViewportView(getNumericFieldJList()); |
|
207 |
} |
|
208 |
return numericFieldScrollPane; |
|
209 |
} |
|
210 |
|
|
211 |
/** |
|
212 |
* This method initializes numericFieldJList |
|
213 |
* |
|
214 |
* @return javax.swing.JList |
|
215 |
*/ |
|
216 |
private JList getNumericFieldJList() { |
|
217 |
if (numericFieldJList == null) { |
|
218 |
numericFieldJList = new JList(); |
|
219 |
} |
|
220 |
return numericFieldJList; |
|
221 |
} |
|
222 |
|
|
223 |
/** |
|
224 |
* This method initializes functionScrollPane |
|
225 |
* |
|
226 |
* @return javax.swing.JScrollPane |
|
227 |
*/ |
|
228 |
private JScrollPane getFunctionScrollPane() { |
|
229 |
if (functionScrollPane == null) { |
|
230 |
functionScrollPane = new JScrollPane(); |
|
231 |
functionScrollPane.setViewportView(getFunctionJList()); |
|
232 |
} |
|
233 |
return functionScrollPane; |
|
234 |
} |
|
235 |
|
|
236 |
/** |
|
237 |
* This method initializes functionJList |
|
238 |
* |
|
239 |
* @return javax.swing.JList |
|
240 |
*/ |
|
241 |
private JList getFunctionJList() { |
|
242 |
if (functionJList == null) { |
|
243 |
functionJList = new JList(); |
|
244 |
} |
|
245 |
return functionJList; |
|
246 |
} |
|
247 |
|
|
248 |
/** |
|
249 |
* This method initializes linkButton |
|
250 |
* |
|
251 |
* @return javax.swing.JButton |
|
252 |
*/ |
|
253 |
private JButton getLinkButton() { |
|
254 |
if (linkButton == null) { |
|
255 |
linkButton = new JButton(); |
|
256 |
linkButton.setText("<-"); |
|
257 |
linkButton.addActionListener(new ActionListener(){ |
|
258 |
public void actionPerformed(ActionEvent arg0) { |
|
259 |
showFunctionsDialog(); |
|
260 |
}}); |
|
261 |
} |
|
262 |
return linkButton; |
|
263 |
} |
|
264 |
|
|
265 |
/** |
|
266 |
* This method initializes okButton |
|
267 |
* |
|
268 |
* @return javax.swing.JButton |
|
269 |
*/ |
|
270 |
private JButton getOkButton() { |
|
271 |
if (okButton == null) { |
|
272 |
okButton = new JButton(); |
|
273 |
String okText = PluginServices.getText(this, "Aceptar"); |
|
274 |
okButton.setText(okText); |
|
275 |
okButton.addActionListener(new ActionListener(){ |
|
276 |
public void actionPerformed(ActionEvent arg0) { |
|
277 |
ok(); |
|
278 |
|
|
279 |
}}); |
|
280 |
} |
|
281 |
return okButton; |
|
282 |
} |
|
283 |
|
|
284 | 149 |
public void ok() { |
285 | 150 |
ok = true; |
286 | 151 |
setVisible(false); |
287 | 152 |
} |
288 | 153 |
|
289 | 154 |
public Map getSumarizationFunctions() { |
290 |
return this.nField_sumFuntionList;
|
|
155 |
return ((NumericFieldFunctionsControl)jContentPane).getFieldFunctionMap();
|
|
291 | 156 |
} |
292 | 157 |
|
293 |
public void showFunctionsDialog() { |
|
294 |
if (sumarizeFuncDialog == null) { |
|
295 |
sumarizeFuncDialog = new SumarizeFunctionsDialog(); |
|
296 |
sumarizeFuncDialog.pack(); |
|
297 |
} |
|
298 |
//sumarizeFuncDialog.setSize(150, 175); |
|
299 |
sumarizeFuncDialog.resetCheckbox(); |
|
300 |
sumarizeFuncDialog.setVisible(true); |
|
301 |
SummarizationFunction[] functions = sumarizeFuncDialog.getFunctions(); |
|
302 |
if(functions.length == 0) |
|
303 |
return; |
|
304 |
String fieldName = (String) this.numericFieldJList.getSelectedValue(); |
|
305 |
this.nField_sumFuntionList.put(fieldName, functions); |
|
306 |
SumFuncListModel functionListModel = new SumFuncListModel( |
|
307 |
this.nField_sumFuntionList, numericFields); |
|
308 |
this.functionJList.setModel(functionListModel); |
|
309 |
//this.functionJList.setSelectedIndex(0); |
|
310 |
|
|
311 |
} |
|
312 |
|
|
313 |
public void setNumericFields(String[] numericFields) { |
|
314 |
this.numericFields = numericFields; |
|
315 |
NumericFieldListModel numericListModel = new NumericFieldListModel( |
|
316 |
numericFields); |
|
317 |
this.numericFieldJList.setModel(numericListModel); |
|
318 |
|
|
319 |
} |
|
320 |
|
|
321 | 158 |
public boolean isOk() { |
322 | 159 |
return ok; |
323 | 160 |
} |
324 | 161 |
|
162 |
|
|
325 | 163 |
} // @jve:decl-index=0:visual-constraint="10,10" |
Also available in: Unified diff