gvsig-raster / org.gvsig.raster.tools / trunk / org.gvsig.raster.tools / org.gvsig.raster.tools.app.basic / src / main / java / org / gvsig / raster / tools / app / basic / tool / raw / ui / main / GeometryPropertiesRigthPanel.java @ 2480
History | View | Annotate | Download (11.4 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.raster.tools.app.basic.tool.raw.ui.main; |
23 |
|
24 |
import java.awt.Dimension; |
25 |
import java.awt.FlowLayout; |
26 |
import java.awt.GridBagConstraints; |
27 |
import java.awt.GridBagLayout; |
28 |
|
29 |
import javax.swing.JLabel; |
30 |
import javax.swing.JPanel; |
31 |
import javax.swing.JTextField; |
32 |
|
33 |
import org.gvsig.andami.PluginServices; |
34 |
import org.gvsig.raster.tools.app.basic.tool.raw.tool.VRTFormatOptions; |
35 |
import org.gvsig.utils.swing.JComboBox; |
36 |
|
37 |
/**
|
38 |
* This panel contains the rigth panel of the "Set Geometry"
|
39 |
* panel. It is the imput to write the file size in bytes,
|
40 |
* the data type, the byte order and the type of
|
41 |
* interleaving.
|
42 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
43 |
*/
|
44 |
public class GeometryPropertiesRigthPanel extends JPanel{ |
45 |
private static final long serialVersionUID = 1L; |
46 |
|
47 |
private JPanel byteOrderLabelPanel = null; |
48 |
private JPanel interleavingLabelPanel = null; |
49 |
private JPanel dataTypeLabelPanel = null; |
50 |
private JLabel dataTypeLabel = null; |
51 |
private JPanel labelsPanel = null; |
52 |
private JPanel fieldsPanel = null; |
53 |
private JPanel fileSizeTextPanel = null; |
54 |
private JPanel dataTypeTextPanel = null; |
55 |
private JPanel fileSizeLabelPanel = null; |
56 |
private JLabel fileSizeLabel = null; |
57 |
private JLabel byteOrderLabel = null; |
58 |
private JPanel byteOrderTextPanel = null; |
59 |
private JPanel interleavingTextPanel = null; |
60 |
private JTextField fileSizeText = null; |
61 |
private JLabel interleavingLabel = null; |
62 |
private JComboBox dataTypeText = null; |
63 |
private JComboBox byteOrderText = null; |
64 |
private JComboBox interleavingText = null; |
65 |
|
66 |
private final int WIDTH = 245; |
67 |
private final int HEIGHT = 110; |
68 |
private final int LABELS_PANEL_WIDTH = 120; |
69 |
private final int TEXTS_PANEL_WIDTH = 125; |
70 |
private final int LABELS_WIDTH = 120; |
71 |
private final int LABELS_HEIGHT = 19; |
72 |
private final int TEXTS_WIDTH = 120; |
73 |
private final int TEXTS_HEIGHT = 19; |
74 |
|
75 |
/**
|
76 |
* This is the default constructor
|
77 |
*/
|
78 |
public GeometryPropertiesRigthPanel() {
|
79 |
super();
|
80 |
initialize(); |
81 |
} |
82 |
|
83 |
/**
|
84 |
* This method initializes this
|
85 |
*
|
86 |
* @return void
|
87 |
*/
|
88 |
private void initialize() { |
89 |
|
90 |
this.setLayout(new GridBagLayout()); |
91 |
this.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); |
92 |
this.add(getLabelsPanel(), new GridBagConstraints()); |
93 |
this.add(getFieldsPanel(), new GridBagConstraints()); |
94 |
} |
95 |
|
96 |
/**
|
97 |
* This method initializes pX
|
98 |
*
|
99 |
* @return javax.swing.JPanel
|
100 |
*/
|
101 |
private JPanel getByteOrderLabelPanel() { |
102 |
if (byteOrderLabelPanel == null) { |
103 |
byteOrderLabel = new JLabel(); |
104 |
byteOrderLabel.setText(PluginServices.getText(this, "byte_order")); |
105 |
FlowLayout flowLayout2 = new FlowLayout(); |
106 |
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT); |
107 |
byteOrderLabelPanel = new JPanel(); |
108 |
byteOrderLabelPanel.setLayout(flowLayout2); |
109 |
byteOrderLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH, LABELS_HEIGHT));
|
110 |
byteOrderLabelPanel.add(byteOrderLabel, null);
|
111 |
flowLayout2.setVgap(1);
|
112 |
flowLayout2.setHgap(0);
|
113 |
} |
114 |
return byteOrderLabelPanel;
|
115 |
} |
116 |
|
117 |
/**
|
118 |
* This method initializes pY
|
119 |
*
|
120 |
* @return javax.swing.JPanel
|
121 |
*/
|
122 |
private JPanel getInterleavingLabelPanel() { |
123 |
if (interleavingLabelPanel == null) { |
124 |
interleavingLabel = new JLabel(); |
125 |
interleavingLabel.setText(PluginServices.getText(this, "type_of_interleaving")); |
126 |
FlowLayout flowLayout1 = new FlowLayout(); |
127 |
flowLayout1.setAlignment(java.awt.FlowLayout.LEFT); |
128 |
interleavingLabelPanel = new JPanel(); |
129 |
interleavingLabelPanel.setLayout(flowLayout1); |
130 |
interleavingLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH, LABELS_HEIGHT));
|
131 |
interleavingLabelPanel.add(interleavingLabel, null);
|
132 |
flowLayout1.setHgap(0);
|
133 |
flowLayout1.setVgap(1);
|
134 |
} |
135 |
return interleavingLabelPanel;
|
136 |
} |
137 |
|
138 |
/**
|
139 |
* This method initializes pLatitud
|
140 |
*
|
141 |
* @return javax.swing.JPanel
|
142 |
*/
|
143 |
private JPanel getDataTypeLabelPanel() { |
144 |
if (dataTypeLabelPanel == null) { |
145 |
dataTypeLabel = new JLabel(); |
146 |
dataTypeLabel.setText(PluginServices.getText(this, "data_type")); |
147 |
FlowLayout flowLayout3 = new FlowLayout(); |
148 |
flowLayout3.setAlignment(java.awt.FlowLayout.LEFT); |
149 |
dataTypeLabelPanel = new JPanel(); |
150 |
dataTypeLabelPanel.setLayout(flowLayout3); |
151 |
dataTypeLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH, LABELS_HEIGHT));
|
152 |
flowLayout3.setHgap(0);
|
153 |
flowLayout3.setVgap(1);
|
154 |
dataTypeLabelPanel.add(dataTypeLabel, null);
|
155 |
} |
156 |
return dataTypeLabelPanel;
|
157 |
} |
158 |
|
159 |
/**
|
160 |
* This method initializes jPanel3
|
161 |
*
|
162 |
* @return javax.swing.JPanel
|
163 |
*/
|
164 |
private JPanel getFileSizeLabelPanel() { |
165 |
if (fileSizeLabelPanel == null) { |
166 |
fileSizeLabel = new JLabel(); |
167 |
fileSizeLabel.setText(PluginServices.getText(this, "file_size_in_bytes")); |
168 |
FlowLayout flowLayout4 = new FlowLayout(); |
169 |
flowLayout4.setHgap(0);
|
170 |
flowLayout4.setAlignment(java.awt.FlowLayout.LEFT); |
171 |
flowLayout4.setVgap(1);
|
172 |
fileSizeLabelPanel = new JPanel(); |
173 |
fileSizeLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH, LABELS_HEIGHT));
|
174 |
fileSizeLabelPanel.setLayout(flowLayout4); |
175 |
fileSizeLabelPanel.add(fileSizeLabel, null);
|
176 |
} |
177 |
return fileSizeLabelPanel;
|
178 |
} |
179 |
|
180 |
/**
|
181 |
* This method initializes jPanel
|
182 |
*
|
183 |
* @return javax.swing.JPanel
|
184 |
*/
|
185 |
private JPanel getLabelsPanel() { |
186 |
if (labelsPanel == null) { |
187 |
labelsPanel = new JPanel(); |
188 |
labelsPanel.setPreferredSize(new java.awt.Dimension(LABELS_PANEL_WIDTH, HEIGHT));
|
189 |
labelsPanel.add(getFileSizeLabelPanel(), null);
|
190 |
labelsPanel.add(getDataTypeLabelPanel(), null);
|
191 |
labelsPanel.add(getByteOrderLabelPanel(), null);
|
192 |
labelsPanel.add(getInterleavingLabelPanel(), null);
|
193 |
} |
194 |
return labelsPanel;
|
195 |
} |
196 |
|
197 |
/**
|
198 |
* This method initializes jPanel
|
199 |
*
|
200 |
* @return javax.swing.JPanel
|
201 |
*/
|
202 |
private JPanel getFieldsPanel() { |
203 |
if (fieldsPanel == null) { |
204 |
fieldsPanel = new JPanel(); |
205 |
fieldsPanel.setPreferredSize(new java.awt.Dimension(TEXTS_PANEL_WIDTH, HEIGHT));
|
206 |
fieldsPanel.add(getFileSizeTextPanel(), null);
|
207 |
fieldsPanel.add(getDataTypeTextPanel(), null);
|
208 |
fieldsPanel.add(getByteOrderTextPanel(), null);
|
209 |
fieldsPanel.add(getInterleavingTextPanel(), null);
|
210 |
} |
211 |
return fieldsPanel;
|
212 |
} |
213 |
|
214 |
/**
|
215 |
* This method initializes jPanel
|
216 |
*
|
217 |
* @return javax.swing.JPanel
|
218 |
*/
|
219 |
private JPanel getFileSizeTextPanel() { |
220 |
if (fileSizeTextPanel == null) { |
221 |
FlowLayout flowLayout = new FlowLayout(); |
222 |
flowLayout.setHgap(0);
|
223 |
flowLayout.setAlignment(java.awt.FlowLayout.LEFT); |
224 |
flowLayout.setVgap(1);
|
225 |
fileSizeTextPanel = new JPanel(); |
226 |
fileSizeTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH, TEXTS_HEIGHT));
|
227 |
fileSizeTextPanel.setLayout(flowLayout); |
228 |
fileSizeTextPanel.add(getFileSizeText(), null);
|
229 |
} |
230 |
return fileSizeTextPanel;
|
231 |
} |
232 |
|
233 |
/**
|
234 |
* This method initializes jPanel1
|
235 |
*
|
236 |
* @return javax.swing.JPanel
|
237 |
*/
|
238 |
private JPanel getDataTypeTextPanel() { |
239 |
if (dataTypeTextPanel == null) { |
240 |
FlowLayout flowLayout5 = new FlowLayout(); |
241 |
flowLayout5.setHgap(0);
|
242 |
flowLayout5.setAlignment(java.awt.FlowLayout.LEFT); |
243 |
flowLayout5.setVgap(1);
|
244 |
dataTypeTextPanel = new JPanel(); |
245 |
dataTypeTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH, TEXTS_HEIGHT));
|
246 |
dataTypeTextPanel.setLayout(flowLayout5); |
247 |
dataTypeTextPanel.add(getDataTypeText(), null);
|
248 |
} |
249 |
return dataTypeTextPanel;
|
250 |
} |
251 |
|
252 |
/**
|
253 |
* This method initializes jPanel2
|
254 |
*
|
255 |
* @return javax.swing.JPanel
|
256 |
*/
|
257 |
private JPanel getInterleavingTextPanel() { |
258 |
if (interleavingTextPanel == null) { |
259 |
FlowLayout flowLayout8 = new FlowLayout(); |
260 |
flowLayout8.setHgap(0);
|
261 |
flowLayout8.setAlignment(FlowLayout.LEFT);
|
262 |
flowLayout8.setVgap(1);
|
263 |
interleavingTextPanel = new JPanel(); |
264 |
interleavingTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH, TEXTS_HEIGHT));
|
265 |
interleavingTextPanel.setLayout(flowLayout8); |
266 |
interleavingTextPanel.add(getInterleavingText(), null);
|
267 |
} |
268 |
return interleavingTextPanel;
|
269 |
} |
270 |
|
271 |
/**
|
272 |
* This method initializes oficialTextPanel
|
273 |
*
|
274 |
* @return javax.swing.JPanel
|
275 |
*/
|
276 |
private JPanel getByteOrderTextPanel() { |
277 |
if (byteOrderTextPanel == null) { |
278 |
FlowLayout flowLayout9 = new FlowLayout(); |
279 |
flowLayout9.setHgap(0);
|
280 |
flowLayout9.setAlignment(FlowLayout.LEFT);
|
281 |
flowLayout9.setVgap(1);
|
282 |
byteOrderTextPanel = new JPanel(); |
283 |
byteOrderTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH, TEXTS_HEIGHT));
|
284 |
byteOrderTextPanel.setLayout(flowLayout9); |
285 |
byteOrderTextPanel.add(getByteOrderText(), null);
|
286 |
} |
287 |
return byteOrderTextPanel;
|
288 |
} |
289 |
|
290 |
/**
|
291 |
* This method initializes pronunciacionText
|
292 |
*
|
293 |
* @return javax.swing.JTextField
|
294 |
*/
|
295 |
private JTextField getFileSizeText() { |
296 |
if (fileSizeText == null) { |
297 |
fileSizeText = new JTextField(); |
298 |
fileSizeText.setPreferredSize(new Dimension(TEXTS_WIDTH, TEXTS_HEIGHT)); |
299 |
fileSizeText.setText("0");
|
300 |
fileSizeText.setEnabled(false);
|
301 |
} |
302 |
return fileSizeText;
|
303 |
} |
304 |
|
305 |
/**
|
306 |
* This method initializes etimologyText
|
307 |
*
|
308 |
* @return javax.swing.JTextField
|
309 |
*/
|
310 |
private JComboBox getDataTypeText() { |
311 |
if (dataTypeText == null) { |
312 |
dataTypeText = new JComboBox(VRTFormatOptions.getDataTypes()); |
313 |
dataTypeText.setPreferredSize(new Dimension(TEXTS_WIDTH, TEXTS_HEIGHT)); |
314 |
} |
315 |
return dataTypeText;
|
316 |
} |
317 |
|
318 |
/**
|
319 |
* This method initializes bandsText
|
320 |
*
|
321 |
* @return javax.swing.JTextField
|
322 |
*/
|
323 |
private JComboBox getByteOrderText() { |
324 |
if (byteOrderText == null) { |
325 |
byteOrderText = new JComboBox(VRTFormatOptions.getByteOrder()); |
326 |
byteOrderText.setPreferredSize(new Dimension(TEXTS_WIDTH, TEXTS_HEIGHT)); |
327 |
} |
328 |
return byteOrderText;
|
329 |
} |
330 |
|
331 |
/**
|
332 |
* This method initializes headerSizeText
|
333 |
*
|
334 |
* @return javax.swing.JTextField
|
335 |
*/
|
336 |
private JComboBox getInterleavingText() { |
337 |
if (interleavingText == null) { |
338 |
interleavingText = new JComboBox(VRTFormatOptions.getInterleaving()); |
339 |
interleavingText.setPreferredSize(new Dimension(TEXTS_WIDTH, TEXTS_HEIGHT)); |
340 |
} |
341 |
return interleavingText;
|
342 |
} |
343 |
|
344 |
/**
|
345 |
* Sets the file size into the text field
|
346 |
* @param fileSize
|
347 |
*/
|
348 |
public void setFileSize(long fileSize) { |
349 |
getFileSizeText().setText(String.valueOf(fileSize));
|
350 |
} |
351 |
|
352 |
/**
|
353 |
* Gets the data type
|
354 |
* @return
|
355 |
*/
|
356 |
public VRTFormatOptions.UIOption getDataType() {
|
357 |
return (VRTFormatOptions.UIOption) getDataTypeText().getSelectedItem();
|
358 |
} |
359 |
|
360 |
/**
|
361 |
* Gets the byte order
|
362 |
* @return
|
363 |
*/
|
364 |
public String getByteOrder() { |
365 |
return ((VRTFormatOptions.UIOption) getByteOrderText().getSelectedItem()).getVrtOptionName();
|
366 |
} |
367 |
|
368 |
/**
|
369 |
* Gets the type of interleaving
|
370 |
* @return
|
371 |
*/
|
372 |
public String getInterleaving() { |
373 |
return ((VRTFormatOptions.UIOption) getInterleavingText().getSelectedItem()).getVrtOptionName();
|
374 |
} |
375 |
} |