Revision 33740

View differences:

branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/legend/gui/VectorialInterval.java
50 50
import java.text.NumberFormat;
51 51
import java.util.ArrayList;
52 52
import java.util.Iterator;
53
import java.util.List;
53 54

  
54 55
import javax.swing.BorderFactory;
55 56
import javax.swing.DefaultComboBoxModel;
......
484 485

  
485 486
            System.out.println("Num. Simbolos = " +
486 487
                auxLegend.getValues().length);
487
            symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(),
488
                auxLegend.getValues(), auxLegend.getDescriptions());
488
          symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(),
489
          auxLegend.getValues(), auxLegend.getDescriptions());
489 490

  
490 491
        } catch (DataException e) {
491 492
        	NotificationManager.addError(PluginServices.getText(this, "could_not_get_shape_type"), e);
......
569 570
			auxLegend = (VectorialIntervalLegend) legend.cloneLegend();
570 571
			chkdefaultvalues.setSelected(auxLegend.isUseDefaultSymbol());
571 572
			cmbField.getModel().setSelectedItem(auxLegend.getClassifyingFieldNames()[0]);
572
			symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(),
573
					auxLegend.getValues(), auxLegend.getDescriptions());
573
			
574
			//Patch to fix an array overflow 
575
            Object[] auxValues = auxLegend.getValues();
576
            List<ISymbol> symbols = new ArrayList();
577
            List<Object> values = new ArrayList();
578
            List<String> descriptions = new ArrayList();
579
            
580
            for( int i=0; i<auxValues.length; i++){
581
                Object key = auxValues[i];
582
                if (key!=null){
583
                    IInterval auxInterval = null;
584
                    if (key instanceof IInterval){
585
                        auxInterval = (IInterval) key;
586
                        ISymbol symbol = auxLegend.getSymbolByInterval(auxInterval);
587
                        symbols.add(symbol);
588
                        values.add(auxValues[i]);
589
                        descriptions.add(symbol.getDescription());
590
                    }
591
                }
592
            }
593
            symbolTable.fillTableFromSymbolList(
594
                symbols.toArray(new ISymbol[0]),
595
                values.toArray(),
596
                descriptions.toArray(new String[0]));
597
            //End Patch
598

  
574 599
			colorChooserPanel.setColor(auxLegend.getStartColor());
575 600
			colorChooserPanel1.setColor(auxLegend.getEndColor());
576 601
			colorChooserPanel.repaint();

Also available in: Unified diff