svn-gvsig-desktop / tags / v1_1_Build_1013 / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / core / gui / SumarizeFunctionsDialog.java @ 13521
History | View | Annotate | Download (9.09 KB)
1 |
/*
|
---|---|
2 |
* Created on 24-feb-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: SumarizeFunctionsDialog.java 13521 2007-09-04 14:02:46Z $
|
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.5 2006/04/11 18:02:42 azabala
|
52 |
* Intento de que el Panel salga bien en todas las resoluciones (y de dejarlos mas bonitos)
|
53 |
*
|
54 |
* Revision 1.4 2006/04/07 19:00:58 azabala
|
55 |
* *** empty log message ***
|
56 |
*
|
57 |
* Revision 1.3 2006/03/26 20:02:08 azabala
|
58 |
* *** empty log message ***
|
59 |
*
|
60 |
* Revision 1.2 2006/03/05 19:53:25 azabala
|
61 |
* *** empty log message ***
|
62 |
*
|
63 |
* Revision 1.1 2006/02/26 20:52:13 azabala
|
64 |
* *** empty log message ***
|
65 |
*
|
66 |
*
|
67 |
*/
|
68 |
package com.iver.cit.gvsig.geoprocess.core.gui; |
69 |
|
70 |
import java.awt.event.ActionEvent; |
71 |
import java.awt.event.ActionListener; |
72 |
import java.util.ArrayList; |
73 |
import java.util.List; |
74 |
|
75 |
import javax.swing.JButton; |
76 |
import javax.swing.JCheckBox; |
77 |
import javax.swing.JDialog; |
78 |
import javax.swing.JFrame; |
79 |
import javax.swing.JLabel; |
80 |
import javax.swing.JPanel; |
81 |
|
82 |
import com.iver.andami.PluginServices; |
83 |
import com.iver.cit.gvsig.geoprocess.core.fmap.AverageFunction; |
84 |
import com.iver.cit.gvsig.geoprocess.core.fmap.MaxFunction; |
85 |
import com.iver.cit.gvsig.geoprocess.core.fmap.MinFunction; |
86 |
import com.iver.cit.gvsig.geoprocess.core.fmap.SumFunction; |
87 |
import com.iver.cit.gvsig.geoprocess.core.fmap.SummarizationFunction; |
88 |
import java.awt.GridBagLayout; |
89 |
import java.awt.GridBagConstraints; |
90 |
/**
|
91 |
* Component to select sumarization functions
|
92 |
* to numeric fields.
|
93 |
* @author azabala
|
94 |
*
|
95 |
* FIXME Internationalize texts
|
96 |
*
|
97 |
*/
|
98 |
public class SumarizeFunctionsDialog extends JDialog implements SumarizeFuntDialogIF{ |
99 |
private static final long serialVersionUID = 6085468284091604644L; |
100 |
private JPanel jContentPane = null; |
101 |
private JPanel maxJPanel = null; |
102 |
private JLabel maxLabel = null; |
103 |
private JCheckBox maxCheckBox = null; |
104 |
private JPanel jPanel = null; |
105 |
private JLabel minLabel = null; |
106 |
private JCheckBox minCheckBox = null; |
107 |
private JPanel jPanel1 = null; |
108 |
private JLabel avgLabel = null; |
109 |
private JCheckBox avgCheckBox = null; |
110 |
private JPanel jPanel2 = null; |
111 |
private JLabel sumLabel = null; |
112 |
private JCheckBox sumCheckBox = null; |
113 |
private JButton okButton = null; |
114 |
|
115 |
private List selectedFunctions; |
116 |
/**
|
117 |
* This is the default constructor
|
118 |
*/
|
119 |
public SumarizeFunctionsDialog() {
|
120 |
super((JFrame)PluginServices.getMainFrame(), true); |
121 |
initialize(); |
122 |
} |
123 |
|
124 |
/**
|
125 |
* This method initializes this
|
126 |
*
|
127 |
* @return void
|
128 |
*/
|
129 |
private void initialize() { |
130 |
this.setSize(241, 161); |
131 |
String title = PluginServices.getText(this, "Funciones_Sumarizacion"); |
132 |
this.setTitle(title);
|
133 |
this.setContentPane(getJContentPane());
|
134 |
selectedFunctions = new ArrayList(); |
135 |
} |
136 |
|
137 |
/**
|
138 |
* This method initializes jContentPane
|
139 |
*
|
140 |
* @return javax.swing.JPanel
|
141 |
*/
|
142 |
private JPanel getJContentPane() { |
143 |
if (jContentPane == null) { |
144 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
145 |
gridBagConstraints5.insets = new java.awt.Insets(7,79,21,73); |
146 |
gridBagConstraints5.gridx = 0;
|
147 |
gridBagConstraints5.gridy = 2;
|
148 |
gridBagConstraints5.ipadx = 2;
|
149 |
gridBagConstraints5.gridwidth = 2;
|
150 |
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
151 |
gridBagConstraints4.insets = new java.awt.Insets(7,14,7,27); |
152 |
gridBagConstraints4.gridy = 1;
|
153 |
gridBagConstraints4.ipadx = 8;
|
154 |
gridBagConstraints4.gridx = 1;
|
155 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
156 |
gridBagConstraints3.insets = new java.awt.Insets(18,13,6,29); |
157 |
gridBagConstraints3.gridy = 0;
|
158 |
gridBagConstraints3.ipadx = -1;
|
159 |
gridBagConstraints3.gridx = 1;
|
160 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
161 |
gridBagConstraints2.insets = new java.awt.Insets(6,31,8,12); |
162 |
gridBagConstraints2.gridy = 1;
|
163 |
gridBagConstraints2.ipadx = 2;
|
164 |
gridBagConstraints2.gridx = 0;
|
165 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
166 |
gridBagConstraints1.insets = new java.awt.Insets(18,29,6,12); |
167 |
gridBagConstraints1.gridy = 0;
|
168 |
gridBagConstraints1.gridx = 0;
|
169 |
jContentPane = new JPanel(); |
170 |
jContentPane.setLayout(new GridBagLayout()); |
171 |
jContentPane.add(getMaxJPanel(), gridBagConstraints1); |
172 |
jContentPane.add(getJPanel(), gridBagConstraints2); |
173 |
jContentPane.add(getJPanel1(), gridBagConstraints3); |
174 |
jContentPane.add(getJPanel2(), gridBagConstraints4); |
175 |
jContentPane.add(getOkButton(), gridBagConstraints5); |
176 |
} |
177 |
return jContentPane;
|
178 |
} |
179 |
|
180 |
/**
|
181 |
* This method initializes maxJPanel
|
182 |
*
|
183 |
* @return javax.swing.JPanel
|
184 |
*/
|
185 |
private JPanel getMaxJPanel() { |
186 |
if (maxJPanel == null) { |
187 |
maxLabel = new JLabel(); |
188 |
String max = PluginServices.getText(this, "Maximo"); |
189 |
maxLabel.setText(max); |
190 |
maxJPanel = new JPanel(); |
191 |
maxJPanel.add(maxLabel, null);
|
192 |
maxJPanel.add(getMaxCheckBox(), null);
|
193 |
} |
194 |
return maxJPanel;
|
195 |
} |
196 |
|
197 |
/**
|
198 |
* This method initializes maxCheckBox
|
199 |
*
|
200 |
* @return javax.swing.JCheckBox
|
201 |
*/
|
202 |
private JCheckBox getMaxCheckBox() { |
203 |
if (maxCheckBox == null) { |
204 |
maxCheckBox = new JCheckBox(); |
205 |
} |
206 |
return maxCheckBox;
|
207 |
} |
208 |
|
209 |
/**
|
210 |
* This method initializes jPanel
|
211 |
*
|
212 |
* @return javax.swing.JPanel
|
213 |
*/
|
214 |
private JPanel getJPanel() { |
215 |
if (jPanel == null) { |
216 |
minLabel = new JLabel(); |
217 |
String min = PluginServices.getText(this, "Minimo"); |
218 |
minLabel.setText(min); |
219 |
jPanel = new JPanel(); |
220 |
jPanel.add(minLabel, null);
|
221 |
jPanel.add(getMinCheckBox(), null);
|
222 |
} |
223 |
return jPanel;
|
224 |
} |
225 |
|
226 |
/**
|
227 |
* This method initializes minCheckBox
|
228 |
*
|
229 |
* @return javax.swing.JCheckBox
|
230 |
*/
|
231 |
private JCheckBox getMinCheckBox() { |
232 |
if (minCheckBox == null) { |
233 |
minCheckBox = new JCheckBox(); |
234 |
} |
235 |
return minCheckBox;
|
236 |
} |
237 |
|
238 |
/**
|
239 |
* This method initializes jPanel1
|
240 |
*
|
241 |
* @return javax.swing.JPanel
|
242 |
*/
|
243 |
private JPanel getJPanel1() { |
244 |
if (jPanel1 == null) { |
245 |
avgLabel = new JLabel(); |
246 |
String media =
|
247 |
PluginServices.getText(this, "Media"); |
248 |
avgLabel.setText(media); |
249 |
jPanel1 = new JPanel(); |
250 |
jPanel1.add(avgLabel, null);
|
251 |
jPanel1.add(getJCheckBox(), null);
|
252 |
} |
253 |
return jPanel1;
|
254 |
} |
255 |
|
256 |
/**
|
257 |
* This method initializes jCheckBox
|
258 |
*
|
259 |
* @return javax.swing.JCheckBox
|
260 |
*/
|
261 |
private JCheckBox getJCheckBox() { |
262 |
if (avgCheckBox == null) { |
263 |
avgCheckBox = new JCheckBox(); |
264 |
} |
265 |
return avgCheckBox;
|
266 |
} |
267 |
|
268 |
/**
|
269 |
* This method initializes jPanel2
|
270 |
*
|
271 |
* @return javax.swing.JPanel
|
272 |
*/
|
273 |
private JPanel getJPanel2() { |
274 |
if (jPanel2 == null) { |
275 |
sumLabel = new JLabel(); |
276 |
String sum = PluginServices.getText(this, "Sum"); |
277 |
sumLabel.setText(sum); |
278 |
jPanel2 = new JPanel(); |
279 |
jPanel2.add(sumLabel, null);
|
280 |
jPanel2.add(getJCheckBox2(), null);
|
281 |
} |
282 |
return jPanel2;
|
283 |
} |
284 |
|
285 |
/**
|
286 |
* This method initializes jCheckBox
|
287 |
*
|
288 |
* @return javax.swing.JCheckBox
|
289 |
*/
|
290 |
private JCheckBox getJCheckBox2() { |
291 |
if (sumCheckBox == null) { |
292 |
sumCheckBox = new JCheckBox(); |
293 |
} |
294 |
return sumCheckBox;
|
295 |
} |
296 |
|
297 |
/**
|
298 |
* This method initializes okButton
|
299 |
*
|
300 |
* @return javax.swing.JButton
|
301 |
*/
|
302 |
private JButton getOkButton() { |
303 |
if (okButton == null) { |
304 |
okButton = new JButton(); |
305 |
String ok = PluginServices.getText(this, "Aceptar"); |
306 |
okButton.setText(ok); |
307 |
okButton.addActionListener(new ActionListener(){ |
308 |
public void actionPerformed(ActionEvent arg0) { |
309 |
ok(); |
310 |
}}); |
311 |
} |
312 |
return okButton;
|
313 |
} |
314 |
|
315 |
public void ok() { |
316 |
|
317 |
if(minCheckBox.isSelected()){
|
318 |
selectedFunctions.add(new MinFunction());
|
319 |
} |
320 |
if(maxCheckBox.isSelected()){
|
321 |
selectedFunctions.add(new MaxFunction());
|
322 |
} |
323 |
if(avgCheckBox.isSelected()){
|
324 |
selectedFunctions.add(new AverageFunction());
|
325 |
} |
326 |
if(sumCheckBox.isSelected()){
|
327 |
selectedFunctions.add(new SumFunction());
|
328 |
} |
329 |
this.dispose();
|
330 |
|
331 |
} |
332 |
|
333 |
public SummarizationFunction[] getFunctions() { |
334 |
SummarizationFunction[] solution =
|
335 |
new SummarizationFunction[selectedFunctions.size()];
|
336 |
selectedFunctions.toArray(solution); |
337 |
return solution;
|
338 |
|
339 |
} |
340 |
|
341 |
public void resetCheckbox() { |
342 |
minCheckBox.setSelected(false);
|
343 |
maxCheckBox.setSelected(false);
|
344 |
avgCheckBox.setSelected(false);
|
345 |
sumCheckBox.setSelected(false);
|
346 |
selectedFunctions.clear(); |
347 |
|
348 |
} |
349 |
|
350 |
} // @jve:decl-index=0:visual-constraint="76,15"
|