Revision 385 org.gvsig.geoprocess/trunk/org.gvsig.geoprocess/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.groupby/src/main/java/org/gvsig/geoprocess/algorithm/groupby/GroupByParametersPanel.java
GroupByParametersPanel.java | ||
---|---|---|
88 | 88 |
private JComboBox layersCombo = null; |
89 | 89 |
private JList fieldList = null; |
90 | 90 |
private JList operationJList = null; |
91 |
private JScrollPane jlistScroll = null; |
|
91 |
private JScrollPane jlistScroll1 = null; |
|
92 |
private JScrollPane jlistScroll2 = null; |
|
92 | 93 |
private AlgorithmOutputPanel output = null; |
93 | 94 |
private String[] opList = null; |
94 | 95 |
private String[] opListLast = null; |
... | ... | |
331 | 332 |
if (fieldList == null) { |
332 | 333 |
fieldList = new JList(); |
333 | 334 |
fieldList.setModel(new DefaultListModel()); |
334 |
jlistScroll = new JScrollPane(fieldList); |
|
335 |
jlistScroll1 = new JScrollPane(fieldList);
|
|
335 | 336 |
fieldList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
336 | 337 |
fieldList.addMouseListener(this); |
337 | 338 |
List<String> list = getFieldList(); |
... | ... | |
339 | 340 |
((DefaultListModel)this.fieldList.getModel()).addElement(list.get(i)); |
340 | 341 |
} |
341 | 342 |
} |
342 |
return jlistScroll; |
|
343 |
return jlistScroll1;
|
|
343 | 344 |
} |
344 | 345 |
|
345 |
public JScrollPane getOperationJList() { |
|
346 |
private JPanel panelOpList = null; |
|
347 |
public JPanel getOperationJList() { |
|
346 | 348 |
if (operationJList == null) { |
347 | 349 |
operationJList = new JList(); |
348 | 350 |
operationJList.setModel(new DefaultListModel()); |
349 |
jlistScroll = new JScrollPane(operationJList); |
|
351 |
operationJList.setPreferredSize(new Dimension(70, 0)); |
|
352 |
jlistScroll2 = new JScrollPane(operationJList); |
|
350 | 353 |
operationJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
351 | 354 |
operationJList.addMouseListener(this); |
352 |
List<String> list = getFieldList(); |
|
353 |
for (int i = 0; i < list.size(); i++) { |
|
354 |
((DefaultListModel)this.fieldList.getModel()).addElement(list.get(i)); |
|
355 |
} |
|
355 |
panelOpList = new JPanel(new GridBagLayout()); |
|
356 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
357 |
gbc.fill = GridBagConstraints.VERTICAL; |
|
358 |
gbc.weighty = 1; |
|
359 |
panelOpList.add(operationJList, gbc); |
|
360 |
panelOpList.setBorder(BorderFactory.createLineBorder(Color.black)); |
|
356 | 361 |
} |
357 |
return jlistScroll;
|
|
362 |
return panelOpList;
|
|
358 | 363 |
} |
359 | 364 |
|
360 | 365 |
/** |
... | ... | |
482 | 487 |
ParametersSet params = m_Algorithm.getParameters(); |
483 | 488 |
params.getParameter(GroupByAlgorithm.LAYER_NAME).setParameterValue("GroupBy_Layer"); |
484 | 489 |
params.getParameter(GroupByAlgorithm.LAYER).setParameterValue(getSelectedVectorLayer()); |
485 |
params.getParameter(GroupByAlgorithm.FIELD).setParameterValue(getFields1Combo().getSelectedIndex());
|
|
486 |
List<String> fList = getFieldList(); |
|
490 |
params.getParameter(GroupByAlgorithm.FIELD).setParameterValue((String)getFields1Combo().getSelectedItem());
|
|
491 |
//List<String> fList = getFieldList();
|
|
487 | 492 |
String dateField = (String)getFields2Combo().getSelectedItem(); |
488 |
int dateFieldPosition = -1; |
|
493 |
/*int dateFieldPosition = -1;
|
|
489 | 494 |
if(getFields2Combo().getItemCount() > 0) { |
490 | 495 |
for (int i = 0; i < fList.size(); i++) { |
491 | 496 |
if(fList.get(i).equals(dateField)) |
492 | 497 |
dateFieldPosition = i; |
493 | 498 |
} |
494 |
} |
|
495 |
params.getParameter(GroupByAlgorithm.FIELD_DATE).setParameterValue(dateFieldPosition);
|
|
499 |
}*/
|
|
500 |
params.getParameter(GroupByAlgorithm.FIELD_DATE).setParameterValue(dateField); |
|
496 | 501 |
params.getParameter(GroupByAlgorithm.FIELD_LIST).setParameterValue(getFieldStringList()); |
497 | 502 |
params.getParameter(GroupByAlgorithm.FUNCTION_LIST).setParameterValue(getFunctionStringList()); |
498 | 503 |
int geom = getButtonFirstGeom().isSelected() ? 0 : getButtonMultiGeom().isSelected() ? 1 : getButtonSpatialFusion().isSelected() ? 2 : -1; |
... | ... | |
535 | 540 |
for (int j = 0; j < fList.size(); j++) { |
536 | 541 |
if(fList.get(j).compareTo((String)obj) == 0) { |
537 | 542 |
if(value.compareTo("") == 0) |
538 |
value = j + ""; |
|
543 |
value = obj + "";
|
|
539 | 544 |
else |
540 |
value += ";" + j; |
|
545 |
value += ";" + obj;
|
|
541 | 546 |
} |
542 | 547 |
} |
543 | 548 |
} |
... | ... | |
611 | 616 |
private void addRowToTable() { |
612 | 617 |
Object[] values = fieldList.getSelectedValues(); |
613 | 618 |
for (int i = 0; i < values.length; i++) { |
614 |
((DefaultTableModel)table.getModel()).addRow(new Object[]{values[i], opList[0]}); |
|
619 |
Object[] obj = new Object[]{values[i], opList[0]}; |
|
620 |
((DefaultTableModel)table.getModel()).addRow(obj); |
|
615 | 621 |
} |
616 |
|
|
617 | 622 |
//Carga la lista de operaciones |
618 | 623 |
loadOperationInJList(getFieldSelectedInTable()); |
619 | 624 |
} |
... | ... | |
701 | 706 |
try { |
702 | 707 |
ftype = fs.getDefaultFeatureType(); |
703 | 708 |
FeatureAttributeDescriptor desc = ftype.getAttributeDescriptor(field); |
704 |
if(desc.getDataType().isNumeric()) |
|
709 |
if(desc != null && desc.getDataType().isNumeric())
|
|
705 | 710 |
return true; |
706 | 711 |
} catch (DataException e) { |
707 | 712 |
return false; |
Also available in: Unified diff