Revision 46 org.gvsig.legend.quantitybycategory.app.mainplugin/trunk/org.gvsig.legend.quantitybycategory.app.mainplugin/src/main/java/org/gvsig/symbology/gui/layerproperties/QuantityByCategoryPanel.java
QuantityByCategoryPanel.java | ||
---|---|---|
5 | 5 |
import java.awt.event.ActionEvent; |
6 | 6 |
import java.awt.event.ActionListener; |
7 | 7 |
import java.util.ArrayList; |
8 |
import java.util.List; |
|
8 | 9 |
|
9 | 10 |
import javax.swing.BorderFactory; |
10 | 11 |
import javax.swing.DefaultComboBoxModel; |
... | ... | |
34 | 35 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
35 | 36 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
36 | 37 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
38 |
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend; |
|
37 | 39 |
import org.gvsig.fmap.mapcontext.rendering.legend.IInterval; |
38 | 40 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
41 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialIntervalLegend; |
|
39 | 42 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
40 | 43 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
41 | 44 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
... | ... | |
269 | 272 |
this.oldLegend.getGraduatedSymbolsLegend() |
270 | 273 |
.getClassifyingFieldNames()[0]); |
271 | 274 |
symbolTable.removeAllItems(); |
272 |
symbolTable.fillTableFromSymbolList(this.oldLegend.getSymbols(), |
|
273 |
this.oldLegend.getValues(),this.oldLegend.getDescriptions());
|
|
275 |
|
|
276 |
this.fillTableSkipDefault(this.oldLegend);
|
|
274 | 277 |
|
275 |
|
|
276 | 278 |
} else { |
277 | 279 |
this.oldLegend = new QuantityByCategoryLegend(); |
278 | 280 |
String[] fnn = { |
... | ... | |
427 | 429 |
} |
428 | 430 |
} |
429 | 431 |
symbolTable.removeAllItems(); |
430 |
symbolTable.fillTableFromSymbolList(this.oldLegend.getSymbols(),
|
|
431 |
this.oldLegend.getValues(),this.oldLegend.getDescriptions()); |
|
432 |
this.fillTableSkipDefault(this.oldLegend);
|
|
433 |
|
|
432 | 434 |
} else if (c.equals(getBtnSymbol())) { |
433 | 435 |
|
434 | 436 |
GraduatedSymbolsLegend graduatedSymbol = |
... | ... | |
469 | 471 |
} |
470 | 472 |
} |
471 | 473 |
symbolTable.removeAllItems(); |
472 |
symbolTable.fillTableFromSymbolList(this.oldLegend.getSymbols(), |
|
473 |
this.oldLegend.getValues(),this.oldLegend.getDescriptions()); |
|
474 |
this.fillTableSkipDefault(this.oldLegend); |
|
474 | 475 |
} |
475 | 476 |
|
476 | 477 |
else if (c.equals(getCmbColorField())) { |
477 | 478 |
symbolTable.removeAllItems(); |
478 |
symbolTable.fillTableFromSymbolList( |
|
479 |
|
|
480 |
this.fillTableSkipDefault( |
|
479 | 481 |
this.oldLegend.getGraduatedSymbolsLegend().getSymbols(), |
480 | 482 |
this.oldLegend.getGraduatedSymbolsLegend().getValues(), |
481 | 483 |
this.oldLegend.getDescriptions()); |
... | ... | |
483 | 485 |
|
484 | 486 |
else if (c.equals(getCmbGraduatedField())) { |
485 | 487 |
symbolTable.removeAllItems(); |
486 |
symbolTable.fillTableFromSymbolList( |
|
488 |
|
|
489 |
this.fillTableSkipDefault( |
|
487 | 490 |
this.oldLegend.getColorRampLegend().getSymbols(), |
488 | 491 |
this.oldLegend.getColorRampLegend().getValues(), |
489 | 492 |
this.oldLegend.getDescriptions()); |
... | ... | |
625 | 628 |
} |
626 | 629 |
return false; |
627 | 630 |
} |
631 |
|
|
632 |
|
|
633 |
// reemplazar esto por arriba |
|
634 |
private void fillTableSkipDefault( |
|
635 |
IClassifiedLegend leg) { |
|
636 |
|
|
637 |
Object[] src_expr = leg.getValues(); |
|
638 |
ISymbol[] src_syms = leg.getSymbols(); |
|
639 |
String[] src_descs = leg.getDescriptions(); |
|
640 |
|
|
641 |
List syms = new ArrayList(); |
|
642 |
List vals = new ArrayList(); |
|
643 |
List descs = new ArrayList(); |
|
644 |
for (int i=0; i<src_expr.length; i++) { |
|
645 |
if (src_expr[i] instanceof IInterval) { |
|
646 |
syms.add(src_syms[i]); |
|
647 |
vals.add(src_expr[i]); |
|
648 |
descs.add(src_descs[i]); |
|
649 |
} |
|
650 |
} |
|
651 |
symbolTable.fillTableFromSymbolList( |
|
652 |
(ISymbol[]) syms.toArray(new ISymbol[0]), |
|
653 |
(Object[]) vals.toArray(new Object[0]), |
|
654 |
(String[]) descs.toArray(new String[0])); |
|
655 |
} |
|
656 |
|
|
657 |
private void fillTableSkipDefault( |
|
658 |
ISymbol[] src_syms, |
|
659 |
Object[] src_expr, |
|
660 |
String[] src_descs) { |
|
661 |
|
|
662 |
List syms = new ArrayList(); |
|
663 |
List vals = new ArrayList(); |
|
664 |
List descs = new ArrayList(); |
|
665 |
for (int i=0; i<src_expr.length; i++) { |
|
666 |
if (src_expr[i] instanceof IInterval) { |
|
667 |
syms.add(src_syms[i]); |
|
668 |
vals.add(src_expr[i]); |
|
669 |
descs.add(src_descs[i]); |
|
670 |
} |
|
671 |
} |
|
672 |
symbolTable.fillTableFromSymbolList( |
|
673 |
(ISymbol[]) syms.toArray(new ISymbol[0]), |
|
674 |
(Object[]) vals.toArray(new Object[0]), |
|
675 |
(String[]) descs.toArray(new String[0])); |
|
676 |
} |
|
677 |
|
|
678 |
|
|
628 | 679 |
} |
Also available in: Unified diff