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