Revision 1766 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/DefaultHeatmapLegendEditorView.java
DefaultHeatmapLegendEditorView.java | ||
---|---|---|
4 | 4 |
import com.jgoodies.forms.layout.CellConstraints; |
5 | 5 |
import com.jgoodies.forms.layout.FormLayout; |
6 | 6 |
import java.awt.BorderLayout; |
7 |
import java.awt.Color; |
|
7 | 8 |
import java.awt.ComponentOrientation; |
8 | 9 |
import java.awt.Container; |
9 | 10 |
import java.awt.Dimension; |
10 | 11 |
import javax.swing.Box; |
12 |
import javax.swing.ButtonGroup; |
|
11 | 13 |
import javax.swing.ImageIcon; |
14 |
import javax.swing.JButton; |
|
15 |
import javax.swing.JCheckBox; |
|
16 |
import javax.swing.JComboBox; |
|
12 | 17 |
import javax.swing.JFrame; |
13 | 18 |
import javax.swing.JLabel; |
14 | 19 |
import javax.swing.JPanel; |
20 |
import javax.swing.JRadioButton; |
|
21 |
import javax.swing.JSlider; |
|
22 |
import javax.swing.JSpinner; |
|
15 | 23 |
import javax.swing.JTextField; |
16 | 24 |
|
17 | 25 |
|
18 | 26 |
public class DefaultHeatmapLegendEditorView extends JPanel |
19 | 27 |
{ |
28 |
JLabel lblPixels = new JLabel(); |
|
29 |
JSpinner spnDistance = new JSpinner(); |
|
30 |
JRadioButton rdbUseColorRamp = new JRadioButton(); |
|
31 |
ButtonGroup buttongroup1 = new ButtonGroup(); |
|
20 | 32 |
JLabel lblDistance = new JLabel(); |
21 |
JTextField txtDistance = new JTextField(); |
|
33 |
JLabel lblHotColor = new JLabel(); |
|
34 |
JLabel lblColdColor = new JLabel(); |
|
35 |
JTextField txtHotColorLabel = new JTextField(); |
|
36 |
JButton btnHotColor = new JButton(); |
|
37 |
JLabel lblHotColorAlpha = new JLabel(); |
|
38 |
JSlider sldHotColorAlpha = new JSlider(); |
|
39 |
JButton btnColdColor = new JButton(); |
|
40 |
JLabel lblColdColorAlpha = new JLabel(); |
|
41 |
JSlider sldColdColorAlpha = new JSlider(); |
|
42 |
JTextField txtColdColorLabel = new JTextField(); |
|
43 |
JLabel lblNumberOfColors = new JLabel(); |
|
44 |
JSpinner spnNumberOfColors = new JSpinner(); |
|
45 |
JRadioButton rdbUseColorTable = new JRadioButton(); |
|
46 |
JComboBox cboColorTable = new JComboBox(); |
|
47 |
JCheckBox chkColorTableUseAlpha = new JCheckBox(); |
|
48 |
JLabel lblHotColorTransparency = new JLabel(); |
|
49 |
JLabel lblColdColorTransparency = new JLabel(); |
|
50 |
JSlider sldColorTableHotAlpha = new JSlider(); |
|
51 |
JSlider sldColorTableColdAlpha = new JSlider(); |
|
52 |
JCheckBox chkUseField = new JCheckBox(); |
|
53 |
JComboBox cboFields = new JComboBox(); |
|
22 | 54 |
|
23 | 55 |
/** |
24 | 56 |
* Default constructor |
... | ... | |
110 | 142 |
public JPanel createPanel() |
111 | 143 |
{ |
112 | 144 |
JPanel jpanel1 = new JPanel(); |
113 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE");
|
|
145 |
FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE");
|
|
114 | 146 |
CellConstraints cc = new CellConstraints(); |
115 | 147 |
jpanel1.setLayout(formlayout1); |
116 | 148 |
|
149 |
jpanel1.add(createPanel1(),cc.xy(4,2)); |
|
150 |
rdbUseColorRamp.setActionCommand("Use color ramp"); |
|
151 |
rdbUseColorRamp.setName("rdbUseColorRamp"); |
|
152 |
rdbUseColorRamp.setText("Use color ramp"); |
|
153 |
buttongroup1.add(rdbUseColorRamp); |
|
154 |
jpanel1.add(rdbUseColorRamp,cc.xy(2,4)); |
|
155 |
|
|
117 | 156 |
lblDistance.setName("lblDistance"); |
118 | 157 |
lblDistance.setText("Distance"); |
119 | 158 |
jpanel1.add(lblDistance,cc.xy(2,2)); |
120 | 159 |
|
121 |
txtDistance.setName("txtDistance"); |
|
122 |
jpanel1.add(txtDistance,cc.xy(4,2)); |
|
160 |
jpanel1.add(createPanel2(),cc.xywh(2,6,3,1)); |
|
161 |
rdbUseColorTable.setActionCommand("Use color table"); |
|
162 |
rdbUseColorTable.setName("rdbUseColorTable"); |
|
163 |
rdbUseColorTable.setText("Use color table"); |
|
164 |
buttongroup1.add(rdbUseColorTable); |
|
165 |
jpanel1.add(rdbUseColorTable,cc.xywh(2,8,3,1)); |
|
123 | 166 |
|
124 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 }); |
|
167 |
jpanel1.add(createPanel5(),cc.xywh(2,10,3,1)); |
|
168 |
chkUseField.setActionCommand("Use a field to calculate the heat map."); |
|
169 |
chkUseField.setName("chkUseField"); |
|
170 |
chkUseField.setText("Use a field to weight the heat map"); |
|
171 |
jpanel1.add(chkUseField,cc.xywh(2,12,3,1)); |
|
172 |
|
|
173 |
jpanel1.add(createPanel7(),cc.xywh(2,14,3,1)); |
|
174 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }); |
|
125 | 175 |
return jpanel1; |
126 | 176 |
} |
127 | 177 |
|
178 |
public JPanel createPanel1() |
|
179 |
{ |
|
180 |
JPanel jpanel1 = new JPanel(); |
|
181 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE"); |
|
182 |
CellConstraints cc = new CellConstraints(); |
|
183 |
jpanel1.setLayout(formlayout1); |
|
184 |
|
|
185 |
lblPixels.setName("lblPixels"); |
|
186 |
lblPixels.setText("pixels"); |
|
187 |
jpanel1.add(lblPixels,cc.xy(3,1)); |
|
188 |
|
|
189 |
spnDistance.setName("spnDistance"); |
|
190 |
jpanel1.add(spnDistance,cc.xy(1,1)); |
|
191 |
|
|
192 |
addFillComponents(jpanel1,new int[]{ 2 },new int[0]); |
|
193 |
return jpanel1; |
|
194 |
} |
|
195 |
|
|
196 |
public JPanel createPanel2() |
|
197 |
{ |
|
198 |
JPanel jpanel1 = new JPanel(); |
|
199 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0)","CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE"); |
|
200 |
CellConstraints cc = new CellConstraints(); |
|
201 |
jpanel1.setLayout(formlayout1); |
|
202 |
|
|
203 |
lblHotColor.setName("lblHotColor"); |
|
204 |
lblHotColor.setText("Hot color"); |
|
205 |
jpanel1.add(lblHotColor,cc.xy(2,3)); |
|
206 |
|
|
207 |
lblColdColor.setName("lblColdColor"); |
|
208 |
lblColdColor.setText("Cold color"); |
|
209 |
jpanel1.add(lblColdColor,cc.xy(2,5)); |
|
210 |
|
|
211 |
jpanel1.add(createPanel3(),cc.xy(4,3)); |
|
212 |
jpanel1.add(createPanel4(),cc.xy(4,5)); |
|
213 |
lblNumberOfColors.setName("lblNumberOfColors"); |
|
214 |
lblNumberOfColors.setText("Number of colors"); |
|
215 |
jpanel1.add(lblNumberOfColors,cc.xy(2,1)); |
|
216 |
|
|
217 |
spnNumberOfColors.setName("spnNumberOfColors"); |
|
218 |
jpanel1.add(spnNumberOfColors,cc.xy(4,1)); |
|
219 |
|
|
220 |
addFillComponents(jpanel1,new int[]{ 1,3 },new int[]{ 1,2,3,4,5 }); |
|
221 |
return jpanel1; |
|
222 |
} |
|
223 |
|
|
224 |
public JPanel createPanel3() |
|
225 |
{ |
|
226 |
JPanel jpanel1 = new JPanel(); |
|
227 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,LEFT:DEFAULT:NONE","CENTER:DEFAULT:NONE"); |
|
228 |
CellConstraints cc = new CellConstraints(); |
|
229 |
jpanel1.setLayout(formlayout1); |
|
230 |
|
|
231 |
txtHotColorLabel.setBackground(new Color(236,233,216)); |
|
232 |
txtHotColorLabel.setEditable(false); |
|
233 |
txtHotColorLabel.setName("txtHotColorLabel"); |
|
234 |
txtHotColorLabel.setHorizontalAlignment(JTextField.RIGHT); |
|
235 |
jpanel1.add(txtHotColorLabel,cc.xy(1,1)); |
|
236 |
|
|
237 |
btnHotColor.setActionCommand("..."); |
|
238 |
btnHotColor.setName("btnHotColor"); |
|
239 |
btnHotColor.setText("..."); |
|
240 |
jpanel1.add(btnHotColor,cc.xy(3,1)); |
|
241 |
|
|
242 |
lblHotColorAlpha.setName("lblHotColorAlpha"); |
|
243 |
lblHotColorAlpha.setText("Alpha"); |
|
244 |
jpanel1.add(lblHotColorAlpha,cc.xy(5,1)); |
|
245 |
|
|
246 |
sldHotColorAlpha.setMajorTickSpacing(20); |
|
247 |
sldHotColorAlpha.setMaximum(255); |
|
248 |
sldHotColorAlpha.setName("sldHotColorAlpha"); |
|
249 |
sldHotColorAlpha.setValue(255); |
|
250 |
jpanel1.add(sldHotColorAlpha,cc.xy(7,1)); |
|
251 |
|
|
252 |
addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[0]); |
|
253 |
return jpanel1; |
|
254 |
} |
|
255 |
|
|
256 |
public JPanel createPanel4() |
|
257 |
{ |
|
258 |
JPanel jpanel1 = new JPanel(); |
|
259 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,LEFT:DEFAULT:NONE","CENTER:DEFAULT:NONE"); |
|
260 |
CellConstraints cc = new CellConstraints(); |
|
261 |
jpanel1.setLayout(formlayout1); |
|
262 |
|
|
263 |
btnColdColor.setActionCommand("..."); |
|
264 |
btnColdColor.setName("btnColdColor"); |
|
265 |
btnColdColor.setText("..."); |
|
266 |
jpanel1.add(btnColdColor,cc.xy(3,1)); |
|
267 |
|
|
268 |
lblColdColorAlpha.setName("lblColdColorAlpha"); |
|
269 |
lblColdColorAlpha.setText("Alpha"); |
|
270 |
jpanel1.add(lblColdColorAlpha,cc.xy(5,1)); |
|
271 |
|
|
272 |
sldColdColorAlpha.setMajorTickSpacing(20); |
|
273 |
sldColdColorAlpha.setMaximum(255); |
|
274 |
sldColdColorAlpha.setName("sldColdColorAlpha"); |
|
275 |
sldColdColorAlpha.setValue(0); |
|
276 |
jpanel1.add(sldColdColorAlpha,cc.xy(7,1)); |
|
277 |
|
|
278 |
txtColdColorLabel.setBackground(new Color(236,233,216)); |
|
279 |
txtColdColorLabel.setEditable(false); |
|
280 |
txtColdColorLabel.setName("txtColdColorLabel"); |
|
281 |
txtColdColorLabel.setHorizontalAlignment(JTextField.RIGHT); |
|
282 |
jpanel1.add(txtColdColorLabel,cc.xy(1,1)); |
|
283 |
|
|
284 |
addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[0]); |
|
285 |
return jpanel1; |
|
286 |
} |
|
287 |
|
|
288 |
public JPanel createPanel5() |
|
289 |
{ |
|
290 |
JPanel jpanel1 = new JPanel(); |
|
291 |
FormLayout formlayout1 = new FormLayout("FILL:8DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE"); |
|
292 |
CellConstraints cc = new CellConstraints(); |
|
293 |
jpanel1.setLayout(formlayout1); |
|
294 |
|
|
295 |
cboColorTable.setName("cboColorTable"); |
|
296 |
jpanel1.add(cboColorTable,cc.xy(4,1)); |
|
297 |
|
|
298 |
JLabel jlabel1 = new JLabel(); |
|
299 |
jlabel1.setText("Color table"); |
|
300 |
jpanel1.add(jlabel1,cc.xy(2,1)); |
|
301 |
|
|
302 |
chkColorTableUseAlpha.setActionCommand("Use transparency"); |
|
303 |
chkColorTableUseAlpha.setName("chkColorTableUseAlpha"); |
|
304 |
chkColorTableUseAlpha.setSelected(true); |
|
305 |
chkColorTableUseAlpha.setText("Use transparency"); |
|
306 |
jpanel1.add(chkColorTableUseAlpha,cc.xy(2,3)); |
|
307 |
|
|
308 |
jpanel1.add(createPanel6(),cc.xywh(2,5,3,1)); |
|
309 |
addFillComponents(jpanel1,new int[]{ 1,3,5 },new int[]{ 1,2,3,4,5,6 }); |
|
310 |
return jpanel1; |
|
311 |
} |
|
312 |
|
|
313 |
public JPanel createPanel6() |
|
314 |
{ |
|
315 |
JPanel jpanel1 = new JPanel(); |
|
316 |
FormLayout formlayout1 = new FormLayout("FILL:8DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0)","CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE"); |
|
317 |
CellConstraints cc = new CellConstraints(); |
|
318 |
jpanel1.setLayout(formlayout1); |
|
319 |
|
|
320 |
lblHotColorTransparency.setName("lblHotColorTransparency"); |
|
321 |
lblHotColorTransparency.setText("Hot color transparency"); |
|
322 |
jpanel1.add(lblHotColorTransparency,cc.xy(2,1)); |
|
323 |
|
|
324 |
lblColdColorTransparency.setName("lblColdColorTransparency"); |
|
325 |
lblColdColorTransparency.setText("Cold color transparency"); |
|
326 |
jpanel1.add(lblColdColorTransparency,cc.xy(2,3)); |
|
327 |
|
|
328 |
sldColorTableHotAlpha.setMajorTickSpacing(20); |
|
329 |
sldColorTableHotAlpha.setMaximum(255); |
|
330 |
sldColorTableHotAlpha.setName("sldColorTableHotAlpha"); |
|
331 |
sldColorTableHotAlpha.setValue(126); |
|
332 |
jpanel1.add(sldColorTableHotAlpha,cc.xy(4,1)); |
|
333 |
|
|
334 |
sldColorTableColdAlpha.setMajorTickSpacing(20); |
|
335 |
sldColorTableColdAlpha.setMaximum(255); |
|
336 |
sldColorTableColdAlpha.setName("sldColorTableColdAlpha"); |
|
337 |
sldColorTableColdAlpha.setValue(126); |
|
338 |
jpanel1.add(sldColorTableColdAlpha,cc.xy(4,3)); |
|
339 |
|
|
340 |
addFillComponents(jpanel1,new int[]{ 1,3 },new int[]{ 1,2,3 }); |
|
341 |
return jpanel1; |
|
342 |
} |
|
343 |
|
|
344 |
public JPanel createPanel7() |
|
345 |
{ |
|
346 |
JPanel jpanel1 = new JPanel(); |
|
347 |
FormLayout formlayout1 = new FormLayout("FILL:8DLU:NONE,FILL:DEFAULT:GROW(1.0)","CENTER:DEFAULT:NONE"); |
|
348 |
CellConstraints cc = new CellConstraints(); |
|
349 |
jpanel1.setLayout(formlayout1); |
|
350 |
|
|
351 |
cboFields.setName("cboFields"); |
|
352 |
jpanel1.add(cboFields,cc.xy(2,1)); |
|
353 |
|
|
354 |
addFillComponents(jpanel1,new int[]{ 1 },new int[]{ 1 }); |
|
355 |
return jpanel1; |
|
356 |
} |
|
357 |
|
|
128 | 358 |
/** |
129 | 359 |
* Initializer |
130 | 360 |
*/ |
Also available in: Unified diff