gvsig-3d / 2.1 / trunk / org.gvsig.view3d / org.gvsig.view3d.swing / org.gvsig.view3d.swing.impl / src / main / java / org / gvsig / view3d / swing / impl / properties / AbstractGeneralProperties3DPanel.java @ 496
History | View | Annotate | Download (13.1 KB)
1 |
package org.gvsig.view3d.swing.impl.properties; |
---|---|
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
import java.awt.Color; |
5 |
import java.awt.GridBagConstraints; |
6 |
import java.awt.GridBagLayout; |
7 |
import java.awt.Insets; |
8 |
|
9 |
import javax.swing.BorderFactory; |
10 |
import javax.swing.JButton; |
11 |
import javax.swing.JCheckBox; |
12 |
import javax.swing.JLabel; |
13 |
import javax.swing.JPanel; |
14 |
import javax.swing.JTextField; |
15 |
|
16 |
import org.gvsig.tools.ToolsLocator; |
17 |
import org.gvsig.tools.i18n.I18nManager; |
18 |
import org.gvsig.view3d.swing.api.properties.GeneralProperties3DPanel; |
19 |
|
20 |
public abstract class AbstractGeneralProperties3DPanel extends JPanel implements |
21 |
GeneralProperties3DPanel { |
22 |
|
23 |
private static final long serialVersionUID = -7528509541668616886L; |
24 |
|
25 |
private Insets insets = new Insets(5, 5, 5, 5); |
26 |
|
27 |
private JPanel sizePanel; |
28 |
private JLabel heightText; |
29 |
private JTextField heightField; |
30 |
private JLabel widthText; |
31 |
private JTextField widthField; |
32 |
|
33 |
private JPanel componentsPanel; |
34 |
private JLabel atmosphereText; |
35 |
private JCheckBox atmosphereCheckBox; |
36 |
private JLabel northIndicatorText; |
37 |
private JCheckBox northIndicatorCheckBox; |
38 |
private JLabel minimapText; |
39 |
private JCheckBox minimapCheckBox; |
40 |
private JLabel starsBackgroundText; |
41 |
private JCheckBox startsBackgroundCheckBox; |
42 |
private JLabel scaleText; |
43 |
private JCheckBox scaleCheckBox; |
44 |
private JLabel viewPortAnimationText; |
45 |
private JCheckBox viewPortAnimationCheckBox; |
46 |
|
47 |
private JPanel cachePanel; |
48 |
private JLabel cacheText; |
49 |
private JTextField cacheField; |
50 |
private JButton cacheButton; |
51 |
|
52 |
public AbstractGeneralProperties3DPanel() {
|
53 |
this.setLayout(new BorderLayout()); |
54 |
|
55 |
initialize(); |
56 |
} |
57 |
|
58 |
private void initialize() { |
59 |
this.add(getSizePanel(), BorderLayout.NORTH); |
60 |
this.add(getComponentsPanel(), BorderLayout.CENTER); |
61 |
this.add(getCachePanel(), BorderLayout.SOUTH); |
62 |
} |
63 |
|
64 |
private JPanel getCachePanel() { |
65 |
if (cachePanel == null) { |
66 |
cachePanel = new JPanel(new GridBagLayout()); |
67 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
68 |
cachePanel.setBorder(BorderFactory.createTitledBorder(
|
69 |
BorderFactory.createLineBorder(Color.GRAY), |
70 |
i18nManager.getTranslation("cache")));
|
71 |
|
72 |
GridBagConstraints cons = new GridBagConstraints(); |
73 |
cons.gridx = 0;
|
74 |
cons.gridy = 0;
|
75 |
cons.weightx = 0;
|
76 |
cons.anchor = GridBagConstraints.EAST;
|
77 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
78 |
cons.insets = insets; |
79 |
|
80 |
cachePanel.add(getCacheText(), cons); |
81 |
|
82 |
cons = new GridBagConstraints(); |
83 |
cons.gridx = 1;
|
84 |
cons.gridy = 0;
|
85 |
cons.weightx = 1;
|
86 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
87 |
cons.insets = insets; |
88 |
|
89 |
cachePanel.add(getCacheField(), cons); |
90 |
|
91 |
cons = new GridBagConstraints(); |
92 |
cons.gridx = 0;
|
93 |
cons.gridy = 1;
|
94 |
cons.weightx = 0;
|
95 |
cons.anchor = GridBagConstraints.WEST;
|
96 |
cons.insets = insets; |
97 |
|
98 |
cachePanel.add(getCacheButton(), cons); |
99 |
} |
100 |
return cachePanel;
|
101 |
|
102 |
} |
103 |
|
104 |
private JLabel getCacheText() { |
105 |
if(cacheText == null){ |
106 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
107 |
cacheText = new JLabel(i18nManager.getTranslation("path_tilecache")); |
108 |
} |
109 |
return cacheText;
|
110 |
} |
111 |
|
112 |
protected JTextField getCacheField() { |
113 |
if(cacheField == null){ |
114 |
cacheField = new JTextField(); |
115 |
} |
116 |
return cacheField;
|
117 |
} |
118 |
|
119 |
protected JButton getCacheButton() { |
120 |
if(cacheButton == null){ |
121 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
122 |
cacheButton = new JButton(i18nManager.getTranslation("remove_cache")); |
123 |
} |
124 |
return cacheButton;
|
125 |
} |
126 |
|
127 |
private JPanel getComponentsPanel() { |
128 |
if (componentsPanel == null) { |
129 |
componentsPanel = new JPanel(new GridBagLayout()); |
130 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
131 |
componentsPanel.setBorder(BorderFactory.createTitledBorder(
|
132 |
BorderFactory.createLineBorder(Color.GRAY), |
133 |
i18nManager.getTranslation("components")));
|
134 |
|
135 |
GridBagConstraints cons = new GridBagConstraints(); |
136 |
cons.gridx = 0;
|
137 |
cons.gridy = 0;
|
138 |
cons.weightx = 0;
|
139 |
cons.anchor = GridBagConstraints.EAST;
|
140 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
141 |
cons.insets = insets; |
142 |
|
143 |
componentsPanel.add(getAtmosphereText(), cons); |
144 |
|
145 |
cons = new GridBagConstraints(); |
146 |
cons.gridx = 1;
|
147 |
cons.gridy = 0;
|
148 |
cons.weightx = 1;
|
149 |
cons.insets = insets; |
150 |
|
151 |
componentsPanel.add(getAtmosphereCheckBox(), cons); |
152 |
|
153 |
cons = new GridBagConstraints(); |
154 |
cons.gridx = 0;
|
155 |
cons.gridy = 1;
|
156 |
cons.weightx = 0;
|
157 |
cons.anchor = GridBagConstraints.EAST;
|
158 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
159 |
cons.insets = insets; |
160 |
|
161 |
componentsPanel.add(getNorthIndicatorText(), cons); |
162 |
|
163 |
cons = new GridBagConstraints(); |
164 |
cons.gridx = 1;
|
165 |
cons.gridy = 1;
|
166 |
cons.weightx = 1;
|
167 |
cons.insets = insets; |
168 |
|
169 |
componentsPanel.add(getNorthIndicatorCheckBox(), cons); |
170 |
|
171 |
cons = new GridBagConstraints(); |
172 |
cons.gridx = 0;
|
173 |
cons.gridy = 2;
|
174 |
cons.weightx = 0;
|
175 |
cons.anchor = GridBagConstraints.EAST;
|
176 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
177 |
cons.insets = insets; |
178 |
|
179 |
componentsPanel.add(getMinimapText(), cons); |
180 |
|
181 |
cons = new GridBagConstraints(); |
182 |
cons.gridx = 1;
|
183 |
cons.gridy = 2;
|
184 |
cons.weightx = 1;
|
185 |
cons.insets = insets; |
186 |
|
187 |
componentsPanel.add(getMinimapCheckBox(), cons); |
188 |
|
189 |
cons = new GridBagConstraints(); |
190 |
cons.gridx = 0;
|
191 |
cons.gridy = 3;
|
192 |
cons.weightx = 0;
|
193 |
cons.anchor = GridBagConstraints.EAST;
|
194 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
195 |
cons.insets = insets; |
196 |
|
197 |
componentsPanel.add(getStarsBackgroundText(), cons); |
198 |
|
199 |
cons = new GridBagConstraints(); |
200 |
cons.gridx = 1;
|
201 |
cons.gridy = 3;
|
202 |
cons.weightx = 1;
|
203 |
cons.insets = insets; |
204 |
|
205 |
componentsPanel.add(getStarsBackGroundCheckBox(), cons); |
206 |
|
207 |
cons = new GridBagConstraints(); |
208 |
cons.gridx = 0;
|
209 |
cons.gridy = 4;
|
210 |
cons.weightx = 0;
|
211 |
cons.anchor = GridBagConstraints.EAST;
|
212 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
213 |
cons.insets = insets; |
214 |
|
215 |
componentsPanel.add(getScaleText(), cons); |
216 |
|
217 |
cons = new GridBagConstraints(); |
218 |
cons.gridx = 1;
|
219 |
cons.gridy = 4;
|
220 |
cons.weightx = 1;
|
221 |
cons.insets = insets; |
222 |
|
223 |
componentsPanel.add(getScaleCheckBox(), cons); |
224 |
|
225 |
cons = new GridBagConstraints(); |
226 |
cons.gridx = 0;
|
227 |
cons.gridy = 5;
|
228 |
cons.weightx = 0;
|
229 |
cons.anchor = GridBagConstraints.EAST;
|
230 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
231 |
cons.insets = insets; |
232 |
|
233 |
componentsPanel.add(getViewPortAnimationText(), cons); |
234 |
|
235 |
cons = new GridBagConstraints(); |
236 |
cons.gridx = 1;
|
237 |
cons.gridy = 5;
|
238 |
cons.weightx = 1;
|
239 |
cons.insets = insets; |
240 |
|
241 |
componentsPanel.add(getViewPortAnimationCheckBox(), cons); |
242 |
} |
243 |
return componentsPanel;
|
244 |
} |
245 |
|
246 |
private JLabel getViewPortAnimationText() { |
247 |
if(viewPortAnimationText == null){ |
248 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
249 |
viewPortAnimationText = new JLabel(i18nManager.getTranslation("view_port_animation")); |
250 |
} |
251 |
return viewPortAnimationText;
|
252 |
} |
253 |
|
254 |
protected JCheckBox getViewPortAnimationCheckBox() { |
255 |
if(viewPortAnimationCheckBox == null){ |
256 |
viewPortAnimationCheckBox = new JCheckBox(); |
257 |
} |
258 |
return viewPortAnimationCheckBox;
|
259 |
} |
260 |
|
261 |
private JLabel getAtmosphereText() { |
262 |
if (atmosphereText == null) { |
263 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
264 |
atmosphereText = |
265 |
new JLabel(i18nManager.getTranslation("show_atmosphere")); |
266 |
} |
267 |
return atmosphereText;
|
268 |
} |
269 |
|
270 |
protected JCheckBox getAtmosphereCheckBox() { |
271 |
if (atmosphereCheckBox == null) { |
272 |
atmosphereCheckBox = new JCheckBox(); |
273 |
} |
274 |
return atmosphereCheckBox;
|
275 |
} |
276 |
|
277 |
private JLabel getNorthIndicatorText() { |
278 |
if (northIndicatorText == null) { |
279 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
280 |
northIndicatorText = |
281 |
new JLabel(i18nManager.getTranslation("show_north_indicator")); |
282 |
} |
283 |
return northIndicatorText;
|
284 |
} |
285 |
|
286 |
protected JCheckBox getNorthIndicatorCheckBox() { |
287 |
if (northIndicatorCheckBox == null) { |
288 |
northIndicatorCheckBox = new JCheckBox(); |
289 |
} |
290 |
return northIndicatorCheckBox;
|
291 |
} |
292 |
|
293 |
private JLabel getMinimapText() { |
294 |
if (minimapText == null) { |
295 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
296 |
minimapText = |
297 |
new JLabel(i18nManager.getTranslation("show_minimap")); |
298 |
} |
299 |
return minimapText;
|
300 |
} |
301 |
|
302 |
protected JCheckBox getMinimapCheckBox() { |
303 |
if (minimapCheckBox == null) { |
304 |
minimapCheckBox = new JCheckBox(); |
305 |
} |
306 |
return minimapCheckBox;
|
307 |
} |
308 |
|
309 |
private JLabel getStarsBackgroundText() { |
310 |
if (starsBackgroundText == null) { |
311 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
312 |
starsBackgroundText = |
313 |
new JLabel(i18nManager.getTranslation("show_stars_background")); |
314 |
} |
315 |
return starsBackgroundText;
|
316 |
} |
317 |
|
318 |
protected JCheckBox getStarsBackGroundCheckBox() { |
319 |
if (startsBackgroundCheckBox == null) { |
320 |
startsBackgroundCheckBox = new JCheckBox(); |
321 |
} |
322 |
return startsBackgroundCheckBox;
|
323 |
} |
324 |
|
325 |
private JLabel getScaleText() { |
326 |
if (scaleText == null) { |
327 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
328 |
scaleText = new JLabel(i18nManager.getTranslation("show_scale")); |
329 |
} |
330 |
return scaleText;
|
331 |
} |
332 |
|
333 |
protected JCheckBox getScaleCheckBox() { |
334 |
if (scaleCheckBox == null) { |
335 |
scaleCheckBox = new JCheckBox(); |
336 |
} |
337 |
return scaleCheckBox;
|
338 |
} |
339 |
|
340 |
private JPanel getSizePanel() { |
341 |
if (sizePanel == null) { |
342 |
sizePanel = new JPanel(new GridBagLayout()); |
343 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
344 |
sizePanel.setBorder(BorderFactory.createTitledBorder(
|
345 |
BorderFactory.createLineBorder(Color.GRAY), |
346 |
i18nManager.getTranslation("size")));
|
347 |
|
348 |
GridBagConstraints cons = new GridBagConstraints(); |
349 |
cons.gridx = 0;
|
350 |
cons.gridy = 0;
|
351 |
cons.weightx = 0;
|
352 |
cons.anchor = GridBagConstraints.EAST;
|
353 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
354 |
cons.insets = insets; |
355 |
|
356 |
sizePanel.add(getHeightText(), cons); |
357 |
|
358 |
cons = new GridBagConstraints(); |
359 |
cons.gridx = 1;
|
360 |
cons.gridy = 0;
|
361 |
cons.weightx = 1;
|
362 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
363 |
cons.insets = insets; |
364 |
|
365 |
sizePanel.add(getHeightField(), cons); |
366 |
|
367 |
cons = new GridBagConstraints(); |
368 |
cons.gridx = 2;
|
369 |
cons.gridy = 0;
|
370 |
cons.weightx = 0;
|
371 |
cons.anchor = GridBagConstraints.EAST;
|
372 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
373 |
cons.insets = insets; |
374 |
|
375 |
sizePanel.add(getWidthtText(), cons); |
376 |
|
377 |
cons = new GridBagConstraints(); |
378 |
cons.gridx = 3;
|
379 |
cons.gridy = 0;
|
380 |
cons.weightx = 1;
|
381 |
cons.fill = GridBagConstraints.HORIZONTAL;
|
382 |
cons.insets = insets; |
383 |
|
384 |
sizePanel.add(getWidthField(), cons); |
385 |
} |
386 |
return sizePanel;
|
387 |
} |
388 |
|
389 |
private JLabel getHeightText() { |
390 |
if (heightText == null) { |
391 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
392 |
heightText = new JLabel(i18nManager.getTranslation("height")); |
393 |
} |
394 |
return heightText;
|
395 |
} |
396 |
|
397 |
protected JTextField getHeightField() { |
398 |
if (heightField == null) { |
399 |
heightField = new JTextField(); |
400 |
} |
401 |
return heightField;
|
402 |
} |
403 |
|
404 |
private JLabel getWidthtText() { |
405 |
if (widthText == null) { |
406 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
407 |
widthText = new JLabel(i18nManager.getTranslation("width")); |
408 |
} |
409 |
return widthText;
|
410 |
} |
411 |
|
412 |
protected JTextField getWidthField() { |
413 |
if (widthField == null) { |
414 |
widthField = new JTextField(); |
415 |
} |
416 |
return widthField;
|
417 |
} |
418 |
} |