root / trunk / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / core / gui / SpatialJoinNumericFieldSelection.java @ 5425
History | View | Annotate | Download (9.28 KB)
1 | 5412 | azabala | /*
|
---|---|---|---|
2 | * Created on 01-mar-2006
|
||
3 | *
|
||
4 | * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
5 | *
|
||
6 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
7 | *
|
||
8 | * This program is free software; you can redistribute it and/or
|
||
9 | * modify it under the terms of the GNU General Public License
|
||
10 | * as published by the Free Software Foundation; either version 2
|
||
11 | * of the License, or (at your option) any later version.
|
||
12 | *
|
||
13 | * This program is distributed in the hope that it will be useful,
|
||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
16 | * GNU General Public License for more details.
|
||
17 | *
|
||
18 | * You should have received a copy of the GNU General Public License
|
||
19 | * along with this program; if not, write to the Free Software
|
||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
21 | *
|
||
22 | * For more information, contact:
|
||
23 | *
|
||
24 | * Generalitat Valenciana
|
||
25 | * Conselleria d'Infraestructures i Transport
|
||
26 | * Av. Blasco Ib??ez, 50
|
||
27 | * 46010 VALENCIA
|
||
28 | * SPAIN
|
||
29 | *
|
||
30 | * +34 963862235
|
||
31 | * gvsig@gva.es
|
||
32 | * www.gvsig.gva.es
|
||
33 | *
|
||
34 | * or
|
||
35 | *
|
||
36 | * IVER T.I. S.A
|
||
37 | * Salamanca 50
|
||
38 | * 46005 Valencia
|
||
39 | * Spain
|
||
40 | *
|
||
41 | * +34 963163400
|
||
42 | * dac@iver.es
|
||
43 | */
|
||
44 | /* CVS MESSAGES:
|
||
45 | *
|
||
46 | * $Id$
|
||
47 | * $Log$
|
||
48 | * Revision 1.1 2006-05-24 21:13:09 azabala
|
||
49 | * primera version en cvs despues de refactoring orientado a crear un framework extensible de geoprocessing
|
||
50 | *
|
||
51 | * Revision 1.4 2006/04/07 19:00:58 azabala
|
||
52 | * *** empty log message ***
|
||
53 | *
|
||
54 | * Revision 1.3 2006/03/26 20:02:08 azabala
|
||
55 | * *** empty log message ***
|
||
56 | *
|
||
57 | * Revision 1.2 2006/03/23 21:02:37 azabala
|
||
58 | * *** empty log message ***
|
||
59 | *
|
||
60 | * Revision 1.1 2006/03/05 19:56:06 azabala
|
||
61 | * *** empty log message ***
|
||
62 | *
|
||
63 | *
|
||
64 | */
|
||
65 | package com.iver.cit.gvsig.geoprocess.core.gui; |
||
66 | |||
67 | import java.awt.event.ActionEvent; |
||
68 | import java.awt.event.ActionListener; |
||
69 | import java.util.HashMap; |
||
70 | import java.util.Map; |
||
71 | |||
72 | import javax.swing.JButton; |
||
73 | import javax.swing.JDialog; |
||
74 | import javax.swing.JFrame; |
||
75 | import javax.swing.JLabel; |
||
76 | import javax.swing.JList; |
||
77 | import javax.swing.JPanel; |
||
78 | import javax.swing.JScrollPane; |
||
79 | |||
80 | import com.iver.andami.PluginServices; |
||
81 | import com.iver.cit.gvsig.geoprocess.core.fmap.SummarizationFunction; |
||
82 | |||
83 | import java.awt.GridBagLayout; |
||
84 | import java.awt.GridBagConstraints; |
||
85 | /**
|
||
86 | * FIXME: INTERNACIONALIZAR LOS TEXTOS
|
||
87 | * QUITAR LOS LISTMODEL REPETIDOS DEL DISSOLVE
|
||
88 | * @author azabala
|
||
89 | *
|
||
90 | */
|
||
91 | public class SpatialJoinNumericFieldSelection |
||
92 | extends JDialog implements SpatialJoinNumFieldIF { |
||
93 | |||
94 | private static final long serialVersionUID = -9031708821779458450L; |
||
95 | private JPanel jContentPane = null; |
||
96 | private JScrollPane numericFieldScrollPane = null; |
||
97 | private JList numericFieldJList = null; |
||
98 | private JScrollPane functionScrollPane = null; |
||
99 | private JList functionJList = null; |
||
100 | private JButton linkButton = null; |
||
101 | private JLabel fieldsLabel = null; |
||
102 | private JLabel functionsLabel = null; |
||
103 | private JButton okButton = null; |
||
104 | private SumarizeFunctionsDialog sumarizeFuncDialog;
|
||
105 | |||
106 | private Map nField_sumFuntionList; |
||
107 | private String[] numericFields; |
||
108 | private boolean ok = false; |
||
109 | /**
|
||
110 | * This is the default constructor
|
||
111 | */
|
||
112 | public SpatialJoinNumericFieldSelection() {
|
||
113 | super((JFrame)PluginServices.getMainFrame(), true); |
||
114 | initialize(); |
||
115 | } |
||
116 | |||
117 | /**
|
||
118 | * This method initializes this
|
||
119 | *
|
||
120 | * @return void
|
||
121 | */
|
||
122 | private void initialize() { |
||
123 | this.setSize(351, 236); |
||
124 | this.setTitle(PluginServices.getText(this,"Funciones_Sumarizacion")); |
||
125 | this.setContentPane(getJContentPane());
|
||
126 | this.nField_sumFuntionList = new HashMap(); |
||
127 | } |
||
128 | |||
129 | /**
|
||
130 | * This method initializes jContentPane
|
||
131 | *
|
||
132 | * @return javax.swing.JPanel
|
||
133 | */
|
||
134 | private JPanel getJContentPane() { |
||
135 | if (jContentPane == null) { |
||
136 | GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
||
137 | gridBagConstraints5.insets = new java.awt.Insets(8,6,28,2); |
||
138 | gridBagConstraints5.gridy = 2;
|
||
139 | gridBagConstraints5.ipadx = 10;
|
||
140 | gridBagConstraints5.ipady = -10;
|
||
141 | gridBagConstraints5.gridx = 1;
|
||
142 | GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
||
143 | gridBagConstraints4.insets = new java.awt.Insets(0,66,5,12); |
||
144 | gridBagConstraints4.gridx = 1;
|
||
145 | gridBagConstraints4.gridy = 0;
|
||
146 | gridBagConstraints4.ipadx = 0;
|
||
147 | gridBagConstraints4.gridwidth = 2;
|
||
148 | GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
||
149 | gridBagConstraints3.insets = new java.awt.Insets(0,15,5,8); |
||
150 | gridBagConstraints3.gridy = 0;
|
||
151 | gridBagConstraints3.gridwidth = 1;
|
||
152 | gridBagConstraints3.gridheight = 1;
|
||
153 | gridBagConstraints3.gridx = 0;
|
||
154 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
||
155 | gridBagConstraints2.insets = new java.awt.Insets(54,6,66,2); |
||
156 | gridBagConstraints2.gridy = 1;
|
||
157 | gridBagConstraints2.ipadx = 16;
|
||
158 | gridBagConstraints2.ipady = -10;
|
||
159 | gridBagConstraints2.fill = java.awt.GridBagConstraints.NONE; |
||
160 | gridBagConstraints2.gridx = 1;
|
||
161 | GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
||
162 | gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; |
||
163 | gridBagConstraints1.gridx = 2;
|
||
164 | gridBagConstraints1.gridy = 1;
|
||
165 | gridBagConstraints1.ipadx = -152;
|
||
166 | gridBagConstraints1.ipady = -9;
|
||
167 | gridBagConstraints1.weightx = 1.0;
|
||
168 | gridBagConstraints1.weighty = 1.0;
|
||
169 | gridBagConstraints1.insets = new java.awt.Insets(6,2,8,21); |
||
170 | GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
||
171 | gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
||
172 | gridBagConstraints.gridx = 0;
|
||
173 | gridBagConstraints.gridy = 1;
|
||
174 | gridBagConstraints.ipadx = -134;
|
||
175 | gridBagConstraints.ipady = -10;
|
||
176 | gridBagConstraints.weightx = 1.0;
|
||
177 | gridBagConstraints.weighty = 1.0;
|
||
178 | gridBagConstraints.insets = new java.awt.Insets(7,13,8,6); |
||
179 | functionsLabel = new JLabel(); |
||
180 | functionsLabel.setText(PluginServices.getText(this, "Funciones_Sumarizacion")); |
||
181 | fieldsLabel = new JLabel(); |
||
182 | fieldsLabel.setText(PluginServices.getText(this, "Atributos_Numericos")); |
||
183 | jContentPane = new JPanel(); |
||
184 | jContentPane.setLayout(new GridBagLayout()); |
||
185 | jContentPane.add(getNumericFieldScrollPane(), gridBagConstraints); |
||
186 | jContentPane.add(getFunctionScrollPane(), gridBagConstraints1); |
||
187 | jContentPane.add(getLinkButton(), gridBagConstraints2); |
||
188 | jContentPane.add(fieldsLabel, gridBagConstraints3); |
||
189 | jContentPane.add(functionsLabel, gridBagConstraints4); |
||
190 | jContentPane.add(getOkButton(), gridBagConstraints5); |
||
191 | } |
||
192 | return jContentPane;
|
||
193 | } |
||
194 | |||
195 | /**
|
||
196 | * This method initializes numericFieldScrollPane
|
||
197 | *
|
||
198 | * @return javax.swing.JScrollPane
|
||
199 | */
|
||
200 | private JScrollPane getNumericFieldScrollPane() { |
||
201 | if (numericFieldScrollPane == null) { |
||
202 | numericFieldScrollPane = new JScrollPane(); |
||
203 | numericFieldScrollPane.setViewportView(getNumericFieldJList()); |
||
204 | } |
||
205 | return numericFieldScrollPane;
|
||
206 | } |
||
207 | |||
208 | /**
|
||
209 | * This method initializes numericFieldJList
|
||
210 | *
|
||
211 | * @return javax.swing.JList
|
||
212 | */
|
||
213 | private JList getNumericFieldJList() { |
||
214 | if (numericFieldJList == null) { |
||
215 | numericFieldJList = new JList(); |
||
216 | } |
||
217 | return numericFieldJList;
|
||
218 | } |
||
219 | |||
220 | /**
|
||
221 | * This method initializes functionScrollPane
|
||
222 | *
|
||
223 | * @return javax.swing.JScrollPane
|
||
224 | */
|
||
225 | private JScrollPane getFunctionScrollPane() { |
||
226 | if (functionScrollPane == null) { |
||
227 | functionScrollPane = new JScrollPane(); |
||
228 | functionScrollPane.setViewportView(getFunctionJList()); |
||
229 | } |
||
230 | return functionScrollPane;
|
||
231 | } |
||
232 | |||
233 | /**
|
||
234 | * This method initializes functionJList
|
||
235 | *
|
||
236 | * @return javax.swing.JList
|
||
237 | */
|
||
238 | private JList getFunctionJList() { |
||
239 | if (functionJList == null) { |
||
240 | functionJList = new JList(); |
||
241 | } |
||
242 | return functionJList;
|
||
243 | } |
||
244 | |||
245 | /**
|
||
246 | * This method initializes linkButton
|
||
247 | *
|
||
248 | * @return javax.swing.JButton
|
||
249 | */
|
||
250 | private JButton getLinkButton() { |
||
251 | if (linkButton == null) { |
||
252 | linkButton = new JButton(); |
||
253 | linkButton.setText("<-");
|
||
254 | linkButton.addActionListener(new ActionListener(){ |
||
255 | public void actionPerformed(ActionEvent arg0) { |
||
256 | showFunctionsDialog(); |
||
257 | }}); |
||
258 | } |
||
259 | return linkButton;
|
||
260 | } |
||
261 | |||
262 | /**
|
||
263 | * This method initializes okButton
|
||
264 | *
|
||
265 | * @return javax.swing.JButton
|
||
266 | */
|
||
267 | private JButton getOkButton() { |
||
268 | if (okButton == null) { |
||
269 | okButton = new JButton(); |
||
270 | String okText = PluginServices.getText(this, "Aceptar"); |
||
271 | okButton.setText(okText); |
||
272 | okButton.addActionListener(new ActionListener(){ |
||
273 | public void actionPerformed(ActionEvent arg0) { |
||
274 | ok(); |
||
275 | |||
276 | }}); |
||
277 | } |
||
278 | return okButton;
|
||
279 | } |
||
280 | |||
281 | public void ok() { |
||
282 | ok = true;
|
||
283 | setVisible(false);
|
||
284 | } |
||
285 | |||
286 | public Map getSumarizationFunctions() { |
||
287 | return this.nField_sumFuntionList; |
||
288 | } |
||
289 | |||
290 | public void showFunctionsDialog() { |
||
291 | if (sumarizeFuncDialog == null) { |
||
292 | sumarizeFuncDialog = new SumarizeFunctionsDialog();
|
||
293 | sumarizeFuncDialog.pack(); |
||
294 | } |
||
295 | //sumarizeFuncDialog.setSize(150, 175);
|
||
296 | sumarizeFuncDialog.resetCheckbox(); |
||
297 | sumarizeFuncDialog.setVisible(true);
|
||
298 | SummarizationFunction[] functions = sumarizeFuncDialog.getFunctions();
|
||
299 | String fieldName = (String) this.numericFieldJList.getSelectedValue(); |
||
300 | this.nField_sumFuntionList.put(fieldName, functions);
|
||
301 | SumFuncListModel functionListModel = new SumFuncListModel(
|
||
302 | this.nField_sumFuntionList, numericFields);
|
||
303 | this.functionJList.setModel(functionListModel);
|
||
304 | //this.functionJList.setSelectedIndex(0);
|
||
305 | |||
306 | } |
||
307 | |||
308 | public void setNumericFields(String[] numericFields) { |
||
309 | this.numericFields = numericFields;
|
||
310 | NumericFieldListModel numericListModel = new NumericFieldListModel(
|
||
311 | numericFields); |
||
312 | this.numericFieldJList.setModel(numericListModel);
|
||
313 | |||
314 | } |
||
315 | |||
316 | public boolean isOk() { |
||
317 | return ok;
|
||
318 | } |
||
319 | |||
320 | } // @jve:decl-index=0:visual-constraint="10,10" |