Revision 1847 org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendEditor.java

View differences:

DefaultHeatmapLegendEditor.java
38 38
    private ColorChooserController hotColorChooser;
39 39
    private ColorChooserController coldColorChooser;
40 40
    private ColorSchemeSelector colorSchemaSelector;
41
    
41

  
42 42
    public DefaultHeatmapLegendEditor() {
43 43
        this.legendClass = HeatmapLegendLocator.getHeatmapLegendManager().getLegendClass();
44 44
    }
45
    
45

  
46 46
    @Override
47 47
    public void setData(FLayer layer, ILegend legend) {
48 48
        if( layer == this.layer && legend == this.legend ) {
......
76 76
                useAlphaInColorTableChanged();
77 77
            }
78 78
        });
79
        
79

  
80 80
        this.spnDistance.setValue(this.legend.getDistance());
81 81
        if( this.legend.useRamp() ) {
82 82
            this.rdbUseColorRamp.setSelected(true);
......
112 112
                        }
113 113
                    }
114 114
                } catch (Exception ex) {
115
                    
115

  
116 116
                }
117 117
            }
118 118
        }
119 119
    }
120
    
120

  
121 121
    private void useColorModeChanged() {
122 122
        if( this.rdbUseColorRamp.isSelected() ) {
123 123
            this.hotColorChooser.setEnabled(true);
......
127 127
            this.chkColorTableUseAlpha.setEnabled(false);
128 128
            this.sldColorTableColdAlpha.setEnabled(false);
129 129
            this.sldColorTableHotAlpha.setEnabled(false);
130
            Color[] table = this.legend.getColorTable();
130
            Color[] table = this.legend.getSourceColorTable();
131 131
            this.spnNumberOfColors.setValue(table.length);
132 132
            this.coldColorChooser.set(table[0]);
133 133
            this.hotColorChooser.set(table[table.length-1]);
......
139 139
            this.chkColorTableUseAlpha.setEnabled(true);
140 140
            this.sldColorTableColdAlpha.setEnabled(true);
141 141
            this.sldColorTableHotAlpha.setEnabled(true);
142
            this.colorSchemaSelector.setSelectedColors(this.legend.getColorTable());
142
            this.colorSchemaSelector.setSelectedColors(this.legend.getSourceColorTable());
143 143
        }
144 144
    }
145
    
145

  
146 146
    private void useFieldChanged() {
147 147
        this.cboFields.setEnabled(this.chkUseField.isSelected());
148 148
    }
149
    
149

  
150 150
    private void useAlphaInColorTableChanged() {
151 151
        boolean x = this.chkColorTableUseAlpha.isSelected();
152 152
        this.sldColorTableColdAlpha.setEnabled(x);
153 153
        this.sldColorTableHotAlpha.setEnabled(x);
154 154
    }
155
    
155

  
156 156
    @Override
157 157
    public ILegend getLegend() {
158 158
        legend.setDistance((int) spnDistance.getValue());
159 159
        if( this.rdbUseColorRamp.isSelected() ) {
160 160
            legend.setColorTable(
161
                (int) spnNumberOfColors.getValue(), 
162
                coldColorChooser.get(), 
161
                (int) spnNumberOfColors.getValue(),
162
                coldColorChooser.get(),
163 163
                hotColorChooser.get()
164 164
            );
165 165
        } else {
......
174 174
        this.legend.setColorTableColdColorAlpha(this.sldColorTableColdAlpha.getValue());
175 175
        this.legend.setColorTableHotColorAlpha(this.sldColorTableHotAlpha.getValue());
176 176
        this.legend.setUseAlphaInColorTable(this.chkColorTableUseAlpha.isSelected());
177
        
177

  
178 178
        return legend;
179 179
    }
180 180

  
......
225 225
        try {
226 226
            value = Integer.parseInt(s);
227 227
        } catch(Throwable th) {
228
            
228

  
229 229
        }
230 230
        return value;
231 231
    }
232
        
232

  
233 233
}

Also available in: Unified diff