Revision 10626 trunk/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/core/gui/NumericFieldFunctionsControl.java
NumericFieldFunctionsControl.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.1 2006-08-11 16:11:38 azabala |
|
48 |
* Revision 1.2 2007-03-06 16:47:58 caballero |
|
49 |
* Exceptions |
|
50 |
* |
|
51 |
* Revision 1.1 2006/08/11 16:11:38 azabala |
|
49 | 52 |
* first version in cvs |
50 | 53 |
* |
51 | 54 |
* |
... | ... | |
69 | 72 |
import javax.swing.JScrollPane; |
70 | 73 |
import javax.swing.ListSelectionModel; |
71 | 74 |
import javax.swing.border.EtchedBorder; |
72 |
import javax.swing.event.ListSelectionEvent; |
|
73 |
import javax.swing.event.ListSelectionListener; |
|
74 | 75 |
|
75 | 76 |
import org.gvsig.gui.beans.swing.JButton; |
76 | 77 |
|
78 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
77 | 79 |
import com.iver.andami.PluginServices; |
78 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
79 | 80 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
80 | 81 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
81 | 82 |
import com.iver.cit.gvsig.geoprocess.core.fmap.SummarizationFunction; |
... | ... | |
91 | 92 |
public class NumericFieldFunctionsControl extends JPanel { |
92 | 93 |
|
93 | 94 |
private FLyrVect inputLayer; |
94 |
|
|
95 |
|
|
95 |
|
|
96 |
|
|
96 | 97 |
private JList numericFieldList; |
97 | 98 |
private JList sumarizeFunctionsList; |
98 | 99 |
private SumarizeFunctionsDialog sumarizeFuncDialog; |
... | ... | |
105 | 106 |
initialize(); |
106 | 107 |
setLayer(inputLayer); |
107 | 108 |
} |
108 |
|
|
109 |
|
|
110 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
111 | 112 |
public void initialize(){ |
112 | 113 |
setLayout(new GridBagLayout()); |
113 | 114 |
setBorder(BorderFactory. |
114 | 115 |
createEtchedBorder(EtchedBorder.RAISED)); |
115 | 116 |
|
116 |
GridBagConstraints buttonConstraints =
|
|
117 |
GridBagConstraints buttonConstraints = |
|
117 | 118 |
new GridBagConstraints(); |
118 | 119 |
buttonConstraints.gridy = 1; |
119 | 120 |
buttonConstraints.gridx = 1; |
... | ... | |
171 | 172 |
JScrollPane sumarizationFunctionScrollPane = new JScrollPane(); |
172 | 173 |
sumarizeFunctionsList = new JList(); |
173 | 174 |
sumarizeFunctionsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
174 |
|
|
175 |
|
|
175 | 176 |
sumarizationFunctionScrollPane |
176 | 177 |
.setViewportView(sumarizeFunctionsList); |
177 | 178 |
sumarizationFunctionScrollPane.setPreferredSize(new Dimension(150, |
... | ... | |
227 | 228 |
sumarizeFunctionsList.setModel(functionListModel); |
228 | 229 |
this.sumarizeFunctionsList.setSelectedIndex(0); |
229 | 230 |
} |
230 |
|
|
231 |
|
|
231 | 232 |
public Map getFieldFunctionMap() { |
232 | 233 |
return this.nField_sumFuntionList; |
233 | 234 |
} |
234 |
|
|
235 |
|
|
235 | 236 |
public String[] getFieldsToSummarize() { |
236 | 237 |
String[] solution = null; |
237 | 238 |
Set keySet = nField_sumFuntionList.keySet(); |
... | ... | |
245 | 246 |
return (SummarizationFunction[]) nField_sumFuntionList |
246 | 247 |
.get(numericFieldName); |
247 | 248 |
} |
248 |
|
|
249 |
|
|
249 | 250 |
public void setLayer(FLyrVect inputLayer){ |
250 | 251 |
this.inputLayer = inputLayer; |
251 | 252 |
String[] numericFields = getInputLayerNumericFields(); |
... | ... | |
260 | 261 |
sumarizeFunctionsList.setModel(functionListModel); |
261 | 262 |
sumarizeFunctionsList.setSelectedIndex(0); |
262 | 263 |
} |
263 |
|
|
264 |
|
|
264 | 265 |
/** |
265 | 266 |
* Returns numeric fields' names of the selected input layer. Needed to say |
266 | 267 |
* user where he could apply sumarization functions. |
... | ... | |
278 | 279 |
list.add(recordset.getFieldName(i)); |
279 | 280 |
} |
280 | 281 |
}// for |
281 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
|
|
282 |
} catch (ReadDriverException e) {
|
|
282 | 283 |
return null; |
283 |
} catch (DriverException e) { |
|
284 |
return null; |
|
285 | 284 |
} |
286 | 285 |
solution = new String[list.size()]; |
287 | 286 |
list.toArray(solution); |
288 | 287 |
return solution; |
289 | 288 |
} |
290 |
|
|
289 |
|
|
291 | 290 |
} |
292 | 291 |
|
Also available in: Unified diff