Revision 44910 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/legend/gui/VectorialUniqueValue.java

View differences:

VectorialUniqueValue.java
67 67
import org.gvsig.gui.beans.swing.JButton;
68 68
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractClassifiedVectorLegend;
69 69
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend;
70
import org.gvsig.tools.ToolsLocator;
70 71
import org.gvsig.tools.dispose.DisposableIterator;
71 72
import org.slf4j.Logger;
72 73
import org.slf4j.LoggerFactory;
......
185 186

  
186 187
        try {
187 188
            elRs = ((FLyrVect) layer).getFeatureStore();
188
//            logger.debug("elRs.start()");
189
//            elRs.start();
190

  
191
//            int idField = -1;
192 189
            String fieldName = (String) cmbFields.getSelectedItem();
193 190
            if (fieldName == null) {
194 191
                JOptionPane.showMessageDialog((Component) PluginServices.getMainFrame(), PluginServices.getText(this, "no_hay_campo_seleccionado"));
195 192
                return;
196 193
            }
197 194

  
198
//            idField = elRs.getFieldIndexByName(fieldName);
199
            auxLegend.setClassifyingFieldNames(new String[]{fieldName});
200

  
201
            //long numReg = elRs.getRowCount();
202
//            if (idField == -1) {
203
//                NotificationManager.addWarning(
204
//                		PluginServices.getText(this, "unrecognized_field_name")+" " + fieldName, null);
205
//
206
//                return;
207
//            }
208 195
            symbolTable.removeAllItems();
209 196

  
210 197
            int numSymbols = 0;
......
216 203
                    .getMapContextManager().createLegend(
217 204
                            IVectorialUniqueValueLegend.LEGEND_NAME);
218 205
            auxLegend.setShapeType(layer.getShapeType());
219

  
206
            auxLegend.setClassifyingFieldNames(new String[]{fieldName});
207
            FeatureAttributeDescriptor attr = elRs.getDefaultFeatureTypeQuietly().getAttributeDescriptor(fieldName);
208
            int fieldType = attr.getDataType().getType();
209
            auxLegend.setClassifyingFieldTypes(new int[]{fieldType});
220 210
            Object clave = null;
221 211

  
222 212
            //Object resul;
......
492 482
            Iterator iterator = rs.getDefaultFeatureType().iterator();
493 483
            while (iterator.hasNext()) {
494 484
                FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) iterator.next();
495
                names.add(descriptor.getName());
485
                Class fieldClass = ToolsLocator.getDataTypesManager().getDefaultClass(descriptor.getDataType().getType());
486
                if (Comparable.class.isAssignableFrom(fieldClass)) {
487
                    names.add(descriptor.getName());
488
                }
496 489
            }
497 490
//            String[] nomFields = new String[rs.getFieldCount()];
498 491
//
......
511 504
        }
512 505
    }
513 506

  
507
    @Override
514 508
    public void setData(FLayer layer, ILegend legend) {
515 509
        this.layer = (ClassifiableVectorial) layer;
516 510
        int shapeType = 0;
......
583 577
    /* (non-Javadoc)
584 578
     * @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#getLegend()
585 579
     */
580
    @Override
586 581
    public ILegend getLegend() {
587 582
        fillSymbolListFromTable();
588 583

  
......
647 642
        symbolTable.removeRow(null);
648 643
        symbolTable.repaint();
649 644
    }
650

  
645
   
646
    @Override
651 647
    public void actionPerformed(ActionEvent e) {
652 648

  
653 649
        //modificar el combobox de valor
......
728 724
        }
729 725
    }
730 726

  
727
    @Override
731 728
    public String getDescription() {
732 729
        return PluginServices.getText(this, "Dado_un_campo_de_atributos") + "," + PluginServices.getText(this, "muestra_los_elementos_de_la_capa_usando_un_simbolo_por_cada_valor_unico") + ".";
733 730
    }
734 731

  
732
    @Override
735 733
    public ImageIcon getIcon() {
736 734
        return IconThemeHelper.getImageIcon(
737 735
                "legend-overview-vectorial-unique-value");
738 736
    }
739 737

  
738
    @Override
740 739
    public Class getParentClass() {
741 740
        return Categories.class;
742 741
    }
743 742

  
743
    @Override
744 744
    public String getTitle() {
745 745
        return PluginServices.getText(this, "Valores_unicos");
746 746
    }
747 747

  
748
    @Override
748 749
    public JPanel getPanel() {
749 750
        return this;
750 751
    }
751 752

  
753
    @Override
752 754
    public Class getLegendClass() {
753 755
        return VectorialUniqueValueLegend.class;
754 756
    }
755 757

  
758
    @Override
756 759
    public boolean isSuitableFor(FLayer layer) {
757 760
        return (layer instanceof FLyrVect);
758 761
    }

Also available in: Unified diff