18 |
18 |
*/
|
19 |
19 |
package org.gvsig.rastertools.cutting.ui;
|
20 |
20 |
|
21 |
|
import java.awt.BorderLayout;
|
22 |
|
import java.awt.FlowLayout;
|
23 |
21 |
import java.awt.GridBagConstraints;
|
24 |
|
import java.awt.GridBagLayout;
|
25 |
22 |
import java.awt.event.ActionEvent;
|
26 |
23 |
import java.awt.event.ActionListener;
|
27 |
24 |
|
... | ... | |
42 |
39 |
*/
|
43 |
40 |
public class ResolutionPanel extends JPanel implements ActionListener{
|
44 |
41 |
private static final long serialVersionUID = 2570616093263451091L;
|
|
42 |
private int MARGIN = 10;
|
|
43 |
private int wHalf = (int) Math.floor((420 - MARGIN) >> 1) - 4, hHalf = 92;
|
|
44 |
private int hData = (int) Math.floor(hHalf / 3);
|
|
45 |
private JPanel pButtons = null;
|
|
46 |
private DataInputContainer cCellSize = null;
|
|
47 |
private DataInputContainer cHeight = null;
|
|
48 |
private DataInputContainer cWidth = null;
|
|
49 |
private JRadioButton rSize = null;
|
|
50 |
private JRadioButton rWidthH = null;
|
|
51 |
private JComboBox cInterpolation = null;
|
45 |
52 |
|
46 |
|
private int MARGIN = 10;
|
47 |
|
private int wHalf = (int)Math.floor((420 - MARGIN) >> 1) - 4, hHalf = 92;
|
48 |
|
private int hData = (int)Math.floor(hHalf/3);
|
49 |
|
|
50 |
|
private JPanel pResolution = null;
|
51 |
|
private JPanel pOption = null;
|
52 |
|
private JPanel pDataInput = null;
|
53 |
|
private JPanel pRatio = null;
|
54 |
|
private JPanel pInterpolation = null;
|
55 |
|
private JPanel pCellSize = null;
|
56 |
|
private JPanel pWidth = null;
|
57 |
|
private JPanel pHeight = null;
|
58 |
|
private DataInputContainer cCellSize = null;
|
59 |
|
private DataInputContainer cHeight = null;
|
60 |
|
private DataInputContainer cWidth = null;
|
61 |
|
private JPanel pButtons = null;
|
62 |
|
private JRadioButton rSize = null;
|
63 |
|
private JRadioButton rWidthH = null;
|
64 |
|
private JComboBox cInterpolation = null;
|
65 |
|
|
66 |
53 |
/**
|
67 |
54 |
* This is the default constructor
|
68 |
55 |
*/
|
... | ... | |
77 |
64 |
* @return void
|
78 |
65 |
*/
|
79 |
66 |
private void initialize() {
|
80 |
|
this.setLayout(new BorderLayout());
|
81 |
|
this.add(getPResolution(), BorderLayout.CENTER);
|
82 |
|
this.getRSize().addActionListener(this);
|
83 |
|
this.getRWidthH().addActionListener(this);
|
84 |
|
this.getRSize().setSelected(true);
|
85 |
|
this.getCWidth().setControlEnabled(false);
|
86 |
|
this.getCHeight().setControlEnabled(false);
|
87 |
|
}
|
|
67 |
GridBagConstraints gridBagConstraints;
|
88 |
68 |
|
89 |
|
/**
|
90 |
|
* This method initializes jPanel
|
91 |
|
*
|
92 |
|
* @return javax.swing.JPanel
|
93 |
|
*/
|
94 |
|
private JPanel getPResolution() {
|
95 |
|
if (pResolution == null) {
|
96 |
|
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
|
97 |
|
gridBagConstraints1.gridx = 1;
|
98 |
|
gridBagConstraints1.gridy = 0;
|
99 |
|
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
100 |
|
gridBagConstraints.gridx = 0;
|
101 |
|
gridBagConstraints.gridy = 0;
|
102 |
|
pResolution = new JPanel();
|
103 |
|
pResolution.setLayout(new GridBagLayout());
|
104 |
|
pResolution.add(getPOption(), gridBagConstraints);
|
105 |
|
pResolution.add(getPDataInput(), gridBagConstraints1);
|
106 |
|
}
|
107 |
|
return pResolution;
|
108 |
|
}
|
|
69 |
setLayout(new java.awt.GridBagLayout());
|
109 |
70 |
|
110 |
|
/**
|
111 |
|
* This method initializes jPanel
|
112 |
|
*
|
113 |
|
* @return javax.swing.JPanel
|
114 |
|
*/
|
115 |
|
private JPanel getPOption() {
|
116 |
|
if (pOption == null) {
|
117 |
|
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
|
118 |
|
gridBagConstraints6.gridx = 0;
|
119 |
|
gridBagConstraints6.gridy = 1;
|
120 |
|
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
|
121 |
|
gridBagConstraints2.gridx = 0;
|
122 |
|
gridBagConstraints2.gridy = 0;
|
123 |
|
pOption = new JPanel();
|
124 |
|
pOption.setLayout(new GridBagLayout());
|
125 |
|
pOption.setPreferredSize(new java.awt.Dimension(wHalf,hHalf));
|
126 |
|
pOption.add(getPRatio(), gridBagConstraints2);
|
127 |
|
pOption.add(getPWidth(), gridBagConstraints6);
|
128 |
|
}
|
129 |
|
return pOption;
|
130 |
|
}
|
|
71 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
72 |
gridBagConstraints.gridheight = 2;
|
|
73 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
74 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
|
|
75 |
gridBagConstraints.weightx = 1.0;
|
|
76 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 2);
|
|
77 |
add(getPButtons(), gridBagConstraints);
|
131 |
78 |
|
132 |
|
/**
|
133 |
|
* This method initializes jPanel1
|
134 |
|
*
|
135 |
|
* @return javax.swing.JPanel
|
136 |
|
*/
|
137 |
|
private JPanel getPDataInput() {
|
138 |
|
if (pDataInput == null) {
|
139 |
|
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
|
140 |
|
gridBagConstraints5.gridx = 0;
|
141 |
|
gridBagConstraints5.gridy = 2;
|
142 |
|
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
|
143 |
|
gridBagConstraints4.gridx = 0;
|
144 |
|
gridBagConstraints4.gridy = 1;
|
145 |
|
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
|
146 |
|
gridBagConstraints3.gridx = 0;
|
147 |
|
gridBagConstraints3.gridy = 0;
|
148 |
|
pDataInput = new JPanel();
|
149 |
|
pDataInput.setLayout(new GridBagLayout());
|
150 |
|
pDataInput.setPreferredSize(new java.awt.Dimension(wHalf,hHalf));
|
151 |
|
pDataInput.add(getPInterpolation(), gridBagConstraints3);
|
152 |
|
pDataInput.add(getPCellSize(), gridBagConstraints4);
|
153 |
|
pDataInput.add(getPHeight(), gridBagConstraints5);
|
154 |
|
}
|
155 |
|
return pDataInput;
|
156 |
|
}
|
|
79 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
80 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
81 |
gridBagConstraints.weightx = 1.0;
|
|
82 |
gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 5);
|
|
83 |
add(getJComboBox(), gridBagConstraints);
|
157 |
84 |
|
158 |
|
/**
|
159 |
|
* This method initializes jPanel
|
160 |
|
*
|
161 |
|
* @return javax.swing.JPanel
|
162 |
|
*/
|
163 |
|
private JPanel getPRatio() {
|
164 |
|
if (pRatio == null) {
|
165 |
|
pRatio = new JPanel();
|
166 |
|
FlowLayout flowLayout3 = new FlowLayout();
|
167 |
|
flowLayout3.setAlignment(java.awt.FlowLayout.RIGHT);
|
168 |
|
flowLayout3.setVgap(0);
|
169 |
|
flowLayout3.setHgap(0);
|
170 |
|
pRatio.setLayout(flowLayout3);
|
171 |
|
pRatio.setPreferredSize(new java.awt.Dimension(wHalf - MARGIN, (2 * hData)));
|
172 |
|
pRatio.add(getPButtons(), null);
|
173 |
|
}
|
174 |
|
return pRatio;
|
175 |
|
}
|
176 |
85 |
|
177 |
|
/**
|
178 |
|
* This method initializes jPanel
|
179 |
|
*
|
180 |
|
* @return javax.swing.JPanel
|
181 |
|
*/
|
182 |
|
private JPanel getPInterpolation() {
|
183 |
|
if (pInterpolation == null) {
|
184 |
|
FlowLayout flowLayout3 = new FlowLayout();
|
185 |
|
flowLayout3.setAlignment(java.awt.FlowLayout.RIGHT);
|
186 |
|
flowLayout3.setVgap(0);
|
187 |
|
flowLayout3.setHgap(0);
|
188 |
|
pInterpolation = new JPanel();
|
189 |
|
pInterpolation.setLayout(flowLayout3);
|
190 |
|
pInterpolation.setPreferredSize(new java.awt.Dimension(wHalf - MARGIN, hData));
|
191 |
|
pInterpolation.add(getJComboBox(), null);
|
192 |
|
}
|
193 |
|
return pInterpolation;
|
194 |
|
}
|
|
86 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
87 |
gridBagConstraints.gridx = 1;
|
|
88 |
gridBagConstraints.gridy = 1;
|
|
89 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
90 |
gridBagConstraints.weightx = 1.0;
|
|
91 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 5);
|
|
92 |
add(getCCellSize(), gridBagConstraints);
|
195 |
93 |
|
196 |
|
/**
|
197 |
|
* This method initializes getPCellSize
|
198 |
|
*
|
199 |
|
* @return javax.swing.JPanel
|
200 |
|
*/
|
201 |
|
public JPanel getPCellSize() {
|
202 |
|
if (pCellSize == null) {
|
203 |
|
FlowLayout flowLayout3 = new FlowLayout();
|
204 |
|
flowLayout3.setAlignment(java.awt.FlowLayout.RIGHT);
|
205 |
|
flowLayout3.setVgap(0);
|
206 |
|
flowLayout3.setHgap(0);
|
207 |
|
pCellSize = new JPanel();
|
208 |
|
pCellSize.setLayout(flowLayout3);
|
209 |
|
pCellSize.setPreferredSize(new java.awt.Dimension(wHalf - MARGIN, hData));
|
210 |
|
pCellSize.add(getCCellSize(), null);
|
211 |
|
}
|
212 |
|
return pCellSize;
|
213 |
|
}
|
|
94 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
95 |
gridBagConstraints.gridx = 0;
|
|
96 |
gridBagConstraints.gridy = 2;
|
|
97 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
98 |
gridBagConstraints.weightx = 1.0;
|
|
99 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 5, 2);
|
|
100 |
add(getCWidth(), gridBagConstraints);
|
214 |
101 |
|
215 |
|
/**
|
216 |
|
* This method initializes getPHeight
|
217 |
|
*
|
218 |
|
* @return javax.swing.JPanel
|
219 |
|
*/
|
220 |
|
public JPanel getPHeight() {
|
221 |
|
if (pHeight == null) {
|
222 |
|
FlowLayout flowLayout1 = new FlowLayout();
|
223 |
|
flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
|
224 |
|
flowLayout1.setHgap(0);
|
225 |
|
flowLayout1.setVgap(0);
|
226 |
|
pHeight = new JPanel();
|
227 |
|
pHeight.setLayout(flowLayout1);
|
228 |
|
pHeight.setPreferredSize(new java.awt.Dimension(wHalf - MARGIN, hData));
|
229 |
|
pHeight.add(getCHeight(), null);
|
230 |
|
}
|
231 |
|
return pHeight;
|
232 |
|
}
|
|
102 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
103 |
gridBagConstraints.gridx = 1;
|
|
104 |
gridBagConstraints.gridy = 2;
|
|
105 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
106 |
gridBagConstraints.weightx = 1.0;
|
|
107 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 5, 5);
|
|
108 |
add(getCHeight(), gridBagConstraints);
|
233 |
109 |
|
234 |
|
/**
|
235 |
|
* This method initializes getPWidth
|
236 |
|
*
|
237 |
|
* @return javax.swing.JPanel
|
238 |
|
*/
|
239 |
|
public JPanel getPWidth() {
|
240 |
|
if (pWidth == null) {
|
241 |
|
FlowLayout flowLayout2 = new FlowLayout();
|
242 |
|
flowLayout2.setAlignment(java.awt.FlowLayout.RIGHT);
|
243 |
|
flowLayout2.setVgap(0);
|
244 |
|
flowLayout2.setHgap(0);
|
245 |
|
pWidth = new JPanel();
|
246 |
|
pWidth.setLayout(flowLayout2);
|
247 |
|
pWidth.setPreferredSize(new java.awt.Dimension(wHalf - MARGIN, hData));
|
248 |
|
pWidth.add(getCWidth(), null);
|
249 |
|
}
|
250 |
|
return pWidth;
|
|
110 |
getRSize().addActionListener(this);
|
|
111 |
getRWidthH().addActionListener(this);
|
|
112 |
getRSize().setSelected(true);
|
|
113 |
getCWidth().setControlEnabled(false);
|
|
114 |
getCHeight().setControlEnabled(false);
|
251 |
115 |
}
|
252 |
116 |
|
253 |
117 |
/**
|
... | ... | |
300 |
164 |
private JPanel getPButtons() {
|
301 |
165 |
if (pButtons == null) {
|
302 |
166 |
pButtons = new JPanel();
|
303 |
|
FlowLayout flowLayout2 = new FlowLayout();
|
304 |
|
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
|
305 |
|
flowLayout2.setVgap(2);
|
306 |
|
flowLayout2.setHgap(5);
|
307 |
|
pButtons.setLayout(flowLayout2);
|
|
167 |
pButtons.setLayout(new java.awt.GridBagLayout());
|
308 |
168 |
pButtons.setPreferredSize(new java.awt.Dimension(wHalf - 10, (2 * hData) - 6));
|
309 |
169 |
pButtons.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
|
310 |
|
pButtons.add(getRSize(), null);
|
311 |
|
pButtons.add(getRWidthH(), null);;
|
|
170 |
|
|
171 |
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
|
172 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
|
173 |
gridBagConstraints.weightx = 1.0;
|
|
174 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 0);
|
|
175 |
pButtons.add(getRSize(), gridBagConstraints);
|
|
176 |
|
|
177 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
178 |
gridBagConstraints.gridx = 0;
|
|
179 |
gridBagConstraints.gridy = 1;
|
|
180 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
181 |
gridBagConstraints.weightx = 1.0;
|
|
182 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 5, 0);
|
|
183 |
pButtons.add(getRWidthH(), gridBagConstraints);;
|
312 |
184 |
}
|
313 |
185 |
return pButtons;
|
314 |
186 |
}
|