Revision 12944 trunk/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/core/gui/NumericFieldFunctionsControl.java

View differences:

NumericFieldFunctionsControl.java
45 45
*
46 46
* $Id$
47 47
* $Log$
48
* Revision 1.2  2007-03-06 16:47:58  caballero
48
* Revision 1.3  2007-08-07 15:06:59  azabala
49
* bug solved when a layer vect hasnt numeric fields
50
*
51
* Revision 1.2  2007/03/06 16:47:58  caballero
49 52
* Exceptions
50 53
*
51 54
* Revision 1.1  2006/08/11 16:11:38  azabala
......
98 101
	private JList sumarizeFunctionsList;
99 102
	private SumarizeFunctionsDialog sumarizeFuncDialog;
100 103
	private Map nField_sumFuntionList;
104
	private JButton sumFunctionSelectionJButton;
101 105

  
102 106

  
103 107

  
......
192 196

  
193 197
		add(attrsLabel, attrsLabelConstraints);
194 198

  
195
		JButton sumFunctionSelectionJButton = new JButton();
199
		sumFunctionSelectionJButton = new JButton();
196 200
		sumFunctionSelectionJButton.setText(PluginServices.getText(this,
197 201
				"Escoger_Fun_Resumen"));
198 202
		sumFunctionSelectionJButton.addActionListener(new ActionListener() {
......
260 264
				this.nField_sumFuntionList, numericFields);
261 265
		sumarizeFunctionsList.setModel(functionListModel);
262 266
		sumarizeFunctionsList.setSelectedIndex(0);
267
		if(numericFields.length == 0){
268
			sumFunctionSelectionJButton.setEnabled(false);
269
		}
263 270
	}
264 271

  
265 272
	/**
......
267 274
	 * user where he could apply sumarization functions.
268 275
	 */
269 276
	public String[] getInputLayerNumericFields() {
270
		String[] solution = null;
271
		if(inputLayer == null)
272
			return null;
273
		ArrayList list = new ArrayList();
274
		try {
275
			SelectableDataSource recordset = inputLayer.getRecordset();
276
			int numFields = recordset.getFieldCount();
277
			for (int i = 0; i < numFields; i++) {
278
				if (XTypes.isNumeric(recordset.getFieldType(i))) {
279
					list.add(recordset.getFieldName(i));
280
				}
281
			}// for
282
		} catch (ReadDriverException e) {
283
			return null;
284
		}
285
		solution = new String[list.size()];
286
		list.toArray(solution);
287
		return solution;
277
		return XTypes.getNumericFieldsNames(inputLayer);
288 278
	}
289 279

  
290 280
}

Also available in: Unified diff