root / trunk / extensions / extCAD / src / com / iver / cit / gvsig / fmap / rendering / EditionManagerLegend.java @ 8931
History | View | Annotate | Download (3.02 KB)
1 | 8931 | caballero | package com.iver.cit.gvsig.fmap.rendering; |
---|---|---|---|
2 | |||
3 | import java.util.ArrayList; |
||
4 | |||
5 | import com.hardcode.gdbms.engine.values.Value; |
||
6 | import com.hardcode.gdbms.engine.values.ValueFactory; |
||
7 | import com.iver.andami.PluginServices; |
||
8 | import com.iver.cit.gvsig.fmap.DriverException; |
||
9 | import com.iver.cit.gvsig.fmap.core.ISymbol; |
||
10 | import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
||
11 | import com.iver.cit.gvsig.fmap.layers.XMLException; |
||
12 | |||
13 | public class EditionManagerLegend implements EditionLegend{ |
||
14 | private ArrayList rules=new ArrayList(); |
||
15 | private VectorialLegend vectorialLegend;
|
||
16 | private VectorialLegend originalVectorialLegend;
|
||
17 | public EditionManagerLegend(VectorialLegend vl) {
|
||
18 | originalVectorialLegend=vl; |
||
19 | vectorialLegend=vl;//(VectorialLegend)vl.cloneLegend();
|
||
20 | } |
||
21 | public Value getValue(int i) { |
||
22 | Value value=null;
|
||
23 | if (vectorialLegend instanceof VectorialUniqueValueLegend) { |
||
24 | value=(Value)((VectorialUniqueValueLegend)vectorialLegend).getValues()[i]; |
||
25 | }else if (vectorialLegend instanceof VectorialIntervalLegend) { |
||
26 | value=(Value)((VectorialIntervalLegend)vectorialLegend).getValues()[i]; |
||
27 | }else {
|
||
28 | value=ValueFactory.createValue(PluginServices.getText(this,"todos_los_valores")); |
||
29 | } |
||
30 | return value;
|
||
31 | } |
||
32 | public ISymbol getSymbol(int i) { |
||
33 | ISymbol symbol=null;
|
||
34 | symbol=((UniqueValueLegend)vectorialLegend).getSymbolByValue(getValue(i)); |
||
35 | return symbol;
|
||
36 | } |
||
37 | public boolean isActived(int i) { |
||
38 | return true; |
||
39 | } |
||
40 | public boolean isBlocked(int i) { |
||
41 | return false; |
||
42 | } |
||
43 | public boolean isDisable(int i) { |
||
44 | return false; |
||
45 | } |
||
46 | public boolean isFilled(int i) { |
||
47 | return true; |
||
48 | } |
||
49 | public boolean isPresent(int i) { |
||
50 | return true; |
||
51 | } |
||
52 | public void setActived(int i,boolean b) { |
||
53 | } |
||
54 | public void setBlocked(int i,boolean b) { |
||
55 | } |
||
56 | public void setDisable(int i, boolean b) { |
||
57 | } |
||
58 | public void setFilled(int i,boolean b) { |
||
59 | } |
||
60 | public void setPresent(int i, boolean b) { |
||
61 | } |
||
62 | public int getRowCount() { |
||
63 | if (vectorialLegend instanceof VectorialUniqueValueLegend || vectorialLegend instanceof VectorialIntervalLegend) { |
||
64 | VectorialUniqueValueLegend vuvl=(VectorialUniqueValueLegend)vectorialLegend; |
||
65 | return vuvl.getValues().length;
|
||
66 | } |
||
67 | return 1; |
||
68 | } |
||
69 | public void setValue(int i, Object value) { |
||
70 | Value previousValue=getValue(i); |
||
71 | ISymbol previousSymbol=getSymbol(i); |
||
72 | Value clave; |
||
73 | ISymbol theSymbol=null;
|
||
74 | int numRow=getRowCount();
|
||
75 | // Borramos las anteriores listas:
|
||
76 | //((UniqueValueLegend)vectorialLegend).clear();
|
||
77 | |||
78 | boolean bRestoValores = false; // PONERLO EN UN CHECKBOX |
||
79 | int hasta;
|
||
80 | hasta = getRowCount(); |
||
81 | // for (int row = 0; row < numRow; row++) {
|
||
82 | // clave = getValue(row);
|
||
83 | // if (row==i)
|
||
84 | if (!value.equals(previousValue)) {
|
||
85 | ((UniqueValueLegend)vectorialLegend).delSymbol(previousValue); |
||
86 | clave=(Value)value; |
||
87 | ((UniqueValueLegend)vectorialLegend).addSymbol(value, previousSymbol); |
||
88 | System.out.println(value);
|
||
89 | // }
|
||
90 | } |
||
91 | if (bRestoValores) {
|
||
92 | theSymbol = getSymbol(hasta); |
||
93 | vectorialLegend.setDefaultSymbol(theSymbol); |
||
94 | } |
||
95 | } |
||
96 | public void setSymbol(int row, Object value) { |
||
97 | } |
||
98 | } |