gvsig-raster / org.gvsig.raster.tools / trunk / org.gvsig.raster.tools / org.gvsig.raster.tools.algorithm / org.gvsig.raster.tools.algorithm.swing / org.gvsig.raster.tools.algorithm.swing.impl / src / main / java / org / gvsig / raster / tools / algorithm / swing / impl / saveraster / PixelSelectionPanel.java @ 2480
History | View | Annotate | Download (2.52 KB)
1 |
package org.gvsig.raster.tools.algorithm.swing.impl.saveraster; |
---|---|
2 |
|
3 |
import java.awt.GridBagConstraints; |
4 |
import java.awt.GridBagLayout; |
5 |
import java.awt.Insets; |
6 |
|
7 |
import javax.swing.BorderFactory; |
8 |
import javax.swing.JPanel; |
9 |
import javax.swing.JRadioButton; |
10 |
|
11 |
import org.gvsig.i18n.Messages; |
12 |
import org.gvsig.raster.tools.algorithm.swing.impl.util.InputFieldPanel; |
13 |
|
14 |
/**
|
15 |
* Panel to select width, height or pixel size of the output layer
|
16 |
*
|
17 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
18 |
*/
|
19 |
public class PixelSelectionPanel extends JPanel { |
20 |
private static final long serialVersionUID = 1L; |
21 |
private InputFieldPanel cellsize = null; |
22 |
private InputFieldPanel width = null; |
23 |
private InputFieldPanel height = null; |
24 |
private JRadioButton radioPxSelection = null; |
25 |
|
26 |
public PixelSelectionPanel() {
|
27 |
init(); |
28 |
} |
29 |
|
30 |
private void init() { |
31 |
setLayout(new GridBagLayout()); |
32 |
setBorder(BorderFactory.createTitledBorder("")); |
33 |
|
34 |
GridBagConstraints gbc = new GridBagConstraints(); |
35 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
36 |
gbc.insets = new Insets(2, 2, 4, 2); |
37 |
gbc.weightx = 1;
|
38 |
gbc.weighty = 0;
|
39 |
gbc.gridwidth = 2;
|
40 |
|
41 |
gbc.gridx = 0;
|
42 |
gbc.gridy = 0;
|
43 |
add(getRadioPxSelection(), gbc); |
44 |
|
45 |
gbc.gridwidth = 1;
|
46 |
|
47 |
gbc.gridx = 0;
|
48 |
gbc.gridy = 1;
|
49 |
add(getWidthInput(), gbc); |
50 |
|
51 |
gbc.gridx = 1;
|
52 |
gbc.gridy = 1;
|
53 |
add(new JPanel(), gbc); |
54 |
|
55 |
gbc.gridx = 0;
|
56 |
gbc.gridy = 2;
|
57 |
add(getHeightInput(), gbc); |
58 |
|
59 |
gbc.gridx = 1;
|
60 |
gbc.gridy = 2;
|
61 |
add(getCellsize(), gbc); |
62 |
|
63 |
/*gbc.fill = GridBagConstraints.BOTH;
|
64 |
gbc.gridwidth = 2;
|
65 |
gbc.weightx = 1;
|
66 |
gbc.weighty = 1;
|
67 |
gbc.gridx = 0;
|
68 |
gbc.gridy = 3;
|
69 |
add(new JPanel(), gbc);*/
|
70 |
} |
71 |
|
72 |
public InputFieldPanel getCellsize() {
|
73 |
if(cellsize == null) |
74 |
cellsize = new InputFieldPanel(Messages.getText("cellsize"), InputFieldPanel.DOUBLE); |
75 |
return cellsize;
|
76 |
} |
77 |
|
78 |
public InputFieldPanel getWidthInput() {
|
79 |
if(width == null) |
80 |
width = new InputFieldPanel(Messages.getText("width"), InputFieldPanel.INT); |
81 |
return width;
|
82 |
} |
83 |
|
84 |
public InputFieldPanel getHeightInput() {
|
85 |
if(height == null) |
86 |
height = new InputFieldPanel(Messages.getText("height"), InputFieldPanel.INT); |
87 |
return height;
|
88 |
} |
89 |
|
90 |
public JRadioButton getRadioPxSelection() { |
91 |
if(radioPxSelection == null) { |
92 |
radioPxSelection = new JRadioButton(Messages.getText("pixel_selection")); |
93 |
radioPxSelection.setSelected(true);
|
94 |
} |
95 |
return radioPxSelection;
|
96 |
} |
97 |
|
98 |
public void setEnable(boolean enabled) { |
99 |
getCellsize().setEnable(enabled); |
100 |
getWidthInput().setEnable(enabled); |
101 |
getHeightInput().setEnable(enabled); |
102 |
} |
103 |
|
104 |
} |