svn-document-layout / trunk / org.gvsig.app.document.layout.app / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / gui / dialogs / FConfigLayoutDialog.java @ 60
History | View | Annotate | Download (30.6 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.app.project.documents.layout.gui.dialogs; |
23 |
|
24 |
import java.awt.Dimension; |
25 |
import java.text.NumberFormat; |
26 |
|
27 |
import javax.swing.JPanel; |
28 |
|
29 |
import org.gvsig.andami.PluginServices; |
30 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
31 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
32 |
import org.gvsig.app.project.documents.layout.Attributes; |
33 |
import org.gvsig.app.project.documents.layout.Size; |
34 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
35 |
import org.gvsig.fmap.mapcontext.MapContext; |
36 |
|
37 |
/**
|
38 |
* Clase para configurar el Layout.
|
39 |
*
|
40 |
* @author Vicente Caballero Navarro
|
41 |
*/
|
42 |
public class FConfigLayoutDialog extends JPanel implements IWindow { |
43 |
|
44 |
private static final long serialVersionUID = -425263925680280142L; |
45 |
private javax.swing.JLabel lTamPag = null; |
46 |
private javax.swing.JComboBox cbTipoFolio = null; |
47 |
private javax.swing.JLabel lDistancia = null; |
48 |
private javax.swing.JComboBox cbUnidades = null; |
49 |
private javax.swing.JLabel lAnchura = null; |
50 |
private javax.swing.JLabel lAltura = null; |
51 |
private javax.swing.JTextField tAncho = null; |
52 |
private javax.swing.JTextField tAlto = null; |
53 |
private javax.swing.JLabel lOrientacion = null; |
54 |
private javax.swing.JLabel lMargenes = null; |
55 |
private javax.swing.JCheckBox chbMargenes = null; |
56 |
private javax.swing.JLabel lSuperior = null; |
57 |
private javax.swing.JTextField tSuperior = null; |
58 |
private javax.swing.JLabel lIzquierdo = null; |
59 |
private javax.swing.JTextField tIzquierdo = null; |
60 |
private javax.swing.JLabel lInferior = null; |
61 |
private javax.swing.JTextField tInferior = null; |
62 |
private javax.swing.JLabel lDerecho = null; |
63 |
private javax.swing.JTextField tDerecho = null; |
64 |
private javax.swing.JLabel lResolucion = null; |
65 |
private javax.swing.JComboBox cbResolucion = null; |
66 |
private javax.swing.JButton bAceptar = null; |
67 |
private javax.swing.JButton bCancelar = null; |
68 |
private LayoutPanel m_layout = null; |
69 |
private javax.swing.JCheckBox chbHorizontal = null; |
70 |
private javax.swing.JCheckBox chbVertical = null; |
71 |
private int unit = 2; |
72 |
private int type = 0; |
73 |
private boolean isLand = true; |
74 |
private boolean margin = false; |
75 |
private int resolution = 1; |
76 |
private double der = 2.54; |
77 |
private double izq = 2.54; |
78 |
private double sup = 2.54; |
79 |
private double inf = 2.54; |
80 |
private NumberFormat nf = NumberFormat.getInstance(); |
81 |
|
82 |
/**
|
83 |
* This is the default constructor
|
84 |
*
|
85 |
* @param layout
|
86 |
* Referencia al Layout.
|
87 |
*/
|
88 |
public FConfigLayoutDialog(LayoutPanel layout) {
|
89 |
super();
|
90 |
m_layout = layout; |
91 |
initialize(); |
92 |
} |
93 |
|
94 |
/**
|
95 |
* This method initializes this
|
96 |
*/
|
97 |
private void initialize() { |
98 |
nf.setMaximumFractionDigits(2);
|
99 |
this.setLayout(null); |
100 |
type = m_layout.getLayoutContext().getAttributes().getType(); |
101 |
unit = m_layout.getLayoutContext().getAttributes().getSelTypeUnit(); |
102 |
isLand = m_layout.getLayoutContext().getAttributes().isLandscape(); |
103 |
sup = m_layout.getLayoutContext().getAttributes().getAreaInsets()[0];
|
104 |
inf = m_layout.getLayoutContext().getAttributes().getAreaInsets()[1];
|
105 |
izq = m_layout.getLayoutContext().getAttributes().getAreaInsets()[2];
|
106 |
der = m_layout.getLayoutContext().getAttributes().getAreaInsets()[3];
|
107 |
this.add(getLTamPag(), null); |
108 |
this.add(getCbTipoFolio(), null); |
109 |
this.add(getLDistancia(), null); |
110 |
this.add(getCbUnidades(), null); |
111 |
this.add(getLAnchura(), null); |
112 |
this.add(getLAltura(), null); |
113 |
this.add(getTAncho(), null); |
114 |
this.add(getTAlto(), null); |
115 |
this.add(getLOrientacion(), null); |
116 |
this.add(getLMargenes(), null); |
117 |
this.add(getChbMargenes(), null); |
118 |
this.add(getLSuperior(), null); |
119 |
this.add(getTSuperior(), null); |
120 |
this.add(getLIzquierdo(), null); |
121 |
this.add(getTIzquierdo(), null); |
122 |
this.add(getLInferior(), null); |
123 |
this.add(getTInferior(), null); |
124 |
this.add(getLDerecho(), null); |
125 |
this.add(getTDerecho(), null); |
126 |
this.add(getLResolucion(), null); |
127 |
this.add(getCbResolucion(), null); |
128 |
this.add(getBAceptar(), null); |
129 |
this.add(getBCancelar(), null); |
130 |
this.add(getChbHorizontal(), null); |
131 |
this.add(getChbVertical(), null); |
132 |
this.setPreferredSize(new Dimension(371, 300)); |
133 |
} |
134 |
|
135 |
/**
|
136 |
* This method initializes lTamPag
|
137 |
*
|
138 |
* @return javax.swing.JLabel
|
139 |
*/
|
140 |
private javax.swing.JLabel getLTamPag() {
|
141 |
if (lTamPag == null) { |
142 |
lTamPag = new javax.swing.JLabel();
|
143 |
lTamPag.setSize(134, 20); |
144 |
lTamPag |
145 |
.setText(PluginServices.getText(this, "tamano_pagina") + ":"); |
146 |
lTamPag.setLocation(25, 15); |
147 |
} |
148 |
|
149 |
return lTamPag;
|
150 |
} |
151 |
|
152 |
/**
|
153 |
* This method initializes cbTipoFolio
|
154 |
*
|
155 |
* @return javax.swing.JComboBox
|
156 |
*/
|
157 |
private javax.swing.JComboBox getCbTipoFolio() {
|
158 |
if (cbTipoFolio == null) { |
159 |
cbTipoFolio = new javax.swing.JComboBox();
|
160 |
cbTipoFolio.setSize(175, 20); |
161 |
cbTipoFolio.setPreferredSize(new java.awt.Dimension(130, 20)); |
162 |
cbTipoFolio.setLocation(175, 15); |
163 |
cbTipoFolio.addItem(PluginServices.getText(this,
|
164 |
"Igual_que_la_impresora"));
|
165 |
cbTipoFolio.addItem(PluginServices.getText(this, "A4")); |
166 |
cbTipoFolio.addItem(PluginServices.getText(this, "A3")); |
167 |
cbTipoFolio.addItem(PluginServices.getText(this, "A2")); |
168 |
cbTipoFolio.addItem(PluginServices.getText(this, "A1")); |
169 |
cbTipoFolio.addItem(PluginServices.getText(this, "A0")); |
170 |
cbTipoFolio.addItem(PluginServices.getText(this, "Personalizado")); |
171 |
|
172 |
cbTipoFolio.setSelectedIndex(m_layout.getLayoutContext() |
173 |
.getAttributes().getType()); |
174 |
cbTipoFolio.addActionListener(new java.awt.event.ActionListener() {
|
175 |
|
176 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
177 |
type = cbTipoFolio.getSelectedIndex(); |
178 |
|
179 |
Size size = |
180 |
m_layout.getLayoutContext().getAttributes() |
181 |
.getSizeinUnits(isLand, type); |
182 |
getTAlto().setText( |
183 |
String.valueOf(nf.format(size.getAlto())));
|
184 |
getTAncho().setText( |
185 |
String.valueOf(nf.format(size.getAncho())));
|
186 |
setMargin(margin); |
187 |
if (cbTipoFolio.getSelectedItem().equals(
|
188 |
PluginServices.getText(this, "Personalizado"))) { |
189 |
getTAlto().setEnabled(true);
|
190 |
getTAncho().setEnabled(true);
|
191 |
getChbVertical().setSelected(true);
|
192 |
isLand = false;
|
193 |
getChbHorizontal().setSelected(false);
|
194 |
getChbVertical().setEnabled(false);
|
195 |
getChbHorizontal().setEnabled(false);
|
196 |
} else {
|
197 |
getTAlto().setEnabled(false);
|
198 |
getTAncho().setEnabled(false);
|
199 |
getChbVertical().setEnabled(true);
|
200 |
getChbHorizontal().setEnabled(true);
|
201 |
} |
202 |
} |
203 |
}); |
204 |
} |
205 |
|
206 |
return cbTipoFolio;
|
207 |
} |
208 |
|
209 |
/**
|
210 |
* This method initializes lDistancia
|
211 |
*
|
212 |
* @return javax.swing.JLabel
|
213 |
*/
|
214 |
private javax.swing.JLabel getLDistancia() {
|
215 |
if (lDistancia == null) { |
216 |
lDistancia = new javax.swing.JLabel();
|
217 |
lDistancia.setSize(137, 19); |
218 |
lDistancia.setText(PluginServices.getText(this, "distance_units")); |
219 |
lDistancia.setLocation(25, 40); |
220 |
} |
221 |
|
222 |
return lDistancia;
|
223 |
} |
224 |
|
225 |
/**
|
226 |
* This method initializes cbUnidades
|
227 |
*
|
228 |
* @return javax.swing.JComboBox
|
229 |
*/
|
230 |
private javax.swing.JComboBox getCbUnidades() {
|
231 |
if (cbUnidades == null) { |
232 |
cbUnidades = new javax.swing.JComboBox();
|
233 |
String[] names = MapContext.getDistanceNames(); |
234 |
for (int i = 0; i < names.length; i++) { |
235 |
cbUnidades.addItem(PluginServices.getText(this, names[i]));
|
236 |
} |
237 |
cbUnidades.setSize(175, 20); |
238 |
cbUnidades.setLocation(175, 40); |
239 |
cbUnidades.setSelectedIndex(m_layout.getLayoutContext() |
240 |
.getAttributes().getSelTypeUnit()); |
241 |
cbUnidades.addActionListener(new java.awt.event.ActionListener() {
|
242 |
|
243 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
244 |
unit = cbUnidades.getSelectedIndex(); |
245 |
m_layout.getLayoutContext().getAttributes().setUnit(unit); |
246 |
|
247 |
Size size = |
248 |
m_layout.getLayoutContext().getAttributes() |
249 |
.getSizeinUnits(isLand, type); |
250 |
getTAlto().setText( |
251 |
String.valueOf(nf.format(size.getAncho())));
|
252 |
getTAncho().setText( |
253 |
String.valueOf(nf.format(size.getAlto())));
|
254 |
setMargin(margin); |
255 |
} |
256 |
}); |
257 |
} |
258 |
|
259 |
return cbUnidades;
|
260 |
} |
261 |
|
262 |
/**
|
263 |
* This method initializes lAnchura
|
264 |
*
|
265 |
* @return javax.swing.JLabel
|
266 |
*/
|
267 |
private javax.swing.JLabel getLAnchura() {
|
268 |
if (lAnchura == null) { |
269 |
lAnchura = new javax.swing.JLabel();
|
270 |
lAnchura.setSize(81, 21); |
271 |
lAnchura.setText(PluginServices.getText(this, "anchura")); |
272 |
lAnchura.setLocation(25, 65); |
273 |
} |
274 |
|
275 |
return lAnchura;
|
276 |
} |
277 |
|
278 |
/**
|
279 |
* This method initializes lAltura
|
280 |
*
|
281 |
* @return javax.swing.JLabel
|
282 |
*/
|
283 |
private javax.swing.JLabel getLAltura() {
|
284 |
if (lAltura == null) { |
285 |
lAltura = new javax.swing.JLabel();
|
286 |
lAltura.setSize(90, 21); |
287 |
lAltura.setText(PluginServices.getText(this, "altura")); |
288 |
lAltura.setLocation(180, 65); |
289 |
} |
290 |
|
291 |
return lAltura;
|
292 |
} |
293 |
|
294 |
/**
|
295 |
* This method initializes tAncho
|
296 |
*
|
297 |
* @return javax.swing.JTextField
|
298 |
*/
|
299 |
private javax.swing.JTextField getTAncho() {
|
300 |
if (tAncho == null) { |
301 |
tAncho = new javax.swing.JTextField();
|
302 |
tAncho.setSize(60, 20); |
303 |
tAncho.setLocation(110, 65); |
304 |
|
305 |
Size size = |
306 |
m_layout.getLayoutContext().getAttributes() |
307 |
.getSizeinUnits(isLand, type); |
308 |
String s = String.valueOf(nf.format(size.getAncho())); |
309 |
tAncho.setText(s); |
310 |
if (getCbTipoFolio().getSelectedItem().equals(
|
311 |
PluginServices.getText(this, "Personalizado"))) { |
312 |
getTAncho().setEnabled(true);
|
313 |
} else {
|
314 |
getTAncho().setEnabled(false);
|
315 |
} |
316 |
} |
317 |
|
318 |
return tAncho;
|
319 |
} |
320 |
|
321 |
/**
|
322 |
* This method initializes tAlto
|
323 |
*
|
324 |
* @return javax.swing.JTextField
|
325 |
*/
|
326 |
private javax.swing.JTextField getTAlto() {
|
327 |
if (tAlto == null) { |
328 |
tAlto = new javax.swing.JTextField();
|
329 |
tAlto.setSize(60, 20); |
330 |
tAlto.setLocation(280, 65); |
331 |
|
332 |
Size size = |
333 |
m_layout.getLayoutContext().getAttributes() |
334 |
.getSizeinUnits(isLand, type); |
335 |
String s = String.valueOf(nf.format(size.getAlto())); |
336 |
tAlto.setText(s); |
337 |
if (getCbTipoFolio().getSelectedItem().equals(
|
338 |
PluginServices.getText(this, "Personalizado"))) { |
339 |
getTAlto().setEnabled(true);
|
340 |
} else {
|
341 |
getTAlto().setEnabled(false);
|
342 |
} |
343 |
} |
344 |
|
345 |
return tAlto;
|
346 |
} |
347 |
|
348 |
/**
|
349 |
* This method initializes lOrientacion
|
350 |
*
|
351 |
* @return javax.swing.JLabel
|
352 |
*/
|
353 |
private javax.swing.JLabel getLOrientacion() {
|
354 |
if (lOrientacion == null) { |
355 |
lOrientacion = new javax.swing.JLabel();
|
356 |
lOrientacion.setSize(102, 38); |
357 |
lOrientacion.setText(PluginServices.getText(this, "orientacion")); |
358 |
lOrientacion.setLocation(25, 100); |
359 |
} |
360 |
|
361 |
return lOrientacion;
|
362 |
} |
363 |
|
364 |
/**
|
365 |
* This method initializes lMargenes
|
366 |
*
|
367 |
* @return javax.swing.JLabel
|
368 |
*/
|
369 |
private javax.swing.JLabel getLMargenes() {
|
370 |
if (lMargenes == null) { |
371 |
lMargenes = new javax.swing.JLabel();
|
372 |
lMargenes.setSize(95, 20); |
373 |
lMargenes.setText(PluginServices.getText(this, "margenes")); |
374 |
lMargenes.setLocation(25, 145); |
375 |
} |
376 |
|
377 |
return lMargenes;
|
378 |
} |
379 |
|
380 |
/**
|
381 |
* Inserta si se dibuja los margenes sobre el Layout o no.
|
382 |
*
|
383 |
* @param b
|
384 |
* True si se tiene que dibujar los margenes.
|
385 |
*/
|
386 |
private void setMargin(boolean b) { |
387 |
margin = b; |
388 |
|
389 |
if (b) {
|
390 |
getTSuperior().setText( |
391 |
String.valueOf(nf.format(m_layout.getLayoutContext()
|
392 |
.getAttributes().toUnits(sup)))); |
393 |
getTIzquierdo().setText( |
394 |
String.valueOf(nf.format(m_layout.getLayoutContext()
|
395 |
.getAttributes().toUnits(izq)))); |
396 |
getTInferior().setText( |
397 |
String.valueOf(nf.format(m_layout.getLayoutContext()
|
398 |
.getAttributes().toUnits(inf)))); |
399 |
getTDerecho().setText( |
400 |
String.valueOf(nf.format(m_layout.getLayoutContext()
|
401 |
.getAttributes().toUnits(der)))); |
402 |
getTSuperior().setEnabled(true);
|
403 |
getTIzquierdo().setEnabled(true);
|
404 |
getTInferior().setEnabled(true);
|
405 |
getTDerecho().setEnabled(true);
|
406 |
} else {
|
407 |
getTSuperior().setText("");
|
408 |
getTIzquierdo().setText("");
|
409 |
getTInferior().setText("");
|
410 |
getTDerecho().setText("");
|
411 |
getTSuperior().setEnabled(false);
|
412 |
getTIzquierdo().setEnabled(false);
|
413 |
getTInferior().setEnabled(false);
|
414 |
getTDerecho().setEnabled(false);
|
415 |
} |
416 |
} |
417 |
|
418 |
/**
|
419 |
* This method initializes chbMargenes
|
420 |
*
|
421 |
* @return javax.swing.JCheckBox
|
422 |
*/
|
423 |
private javax.swing.JCheckBox getChbMargenes() {
|
424 |
if (chbMargenes == null) { |
425 |
chbMargenes = new javax.swing.JCheckBox();
|
426 |
chbMargenes.setSize(230, 21); |
427 |
chbMargenes.setText(PluginServices.getText(this,
|
428 |
"personalizar_margenes"));
|
429 |
chbMargenes.setLocation(125, 145); |
430 |
chbMargenes.setSelected(m_layout.getLayoutContext().getAttributes() |
431 |
.isMargin()); |
432 |
setMargin(m_layout.getLayoutContext().getAttributes().isMargin()); |
433 |
chbMargenes.addActionListener(new java.awt.event.ActionListener() {
|
434 |
|
435 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
436 |
if (chbMargenes.isSelected()) {
|
437 |
margin = true;
|
438 |
} else {
|
439 |
margin = false;
|
440 |
} |
441 |
|
442 |
setMargin(margin); |
443 |
} |
444 |
}); |
445 |
} |
446 |
|
447 |
return chbMargenes;
|
448 |
} |
449 |
|
450 |
/**
|
451 |
* This method initializes lSuperior
|
452 |
*
|
453 |
* @return javax.swing.JLabel
|
454 |
*/
|
455 |
private javax.swing.JLabel getLSuperior() {
|
456 |
if (lSuperior == null) { |
457 |
lSuperior = new javax.swing.JLabel();
|
458 |
lSuperior.setSize(81, 20); |
459 |
lSuperior.setText(PluginServices.getText(this, "Superior")); |
460 |
lSuperior.setLocation(25, 167); |
461 |
} |
462 |
|
463 |
return lSuperior;
|
464 |
} |
465 |
|
466 |
/**
|
467 |
* This method initializes tSuperior
|
468 |
*
|
469 |
* @return javax.swing.JTextField
|
470 |
*/
|
471 |
private javax.swing.JTextField getTSuperior() {
|
472 |
if (tSuperior == null) { |
473 |
tSuperior = new javax.swing.JTextField();
|
474 |
tSuperior.setSize(60, 20); |
475 |
tSuperior.setLocation(110, 167); |
476 |
|
477 |
if (m_layout.getLayoutContext().getAttributes().isMargin()) {
|
478 |
tSuperior.setText(String.valueOf(nf.format(m_layout
|
479 |
.getLayoutContext().getAttributes().toUnits(sup)))); |
480 |
} |
481 |
} |
482 |
|
483 |
return tSuperior;
|
484 |
} |
485 |
|
486 |
/**
|
487 |
* This method initializes lIzquierdo
|
488 |
*
|
489 |
* @return javax.swing.JLabel
|
490 |
*/
|
491 |
private javax.swing.JLabel getLIzquierdo() {
|
492 |
if (lIzquierdo == null) { |
493 |
lIzquierdo = new javax.swing.JLabel();
|
494 |
lIzquierdo.setSize(88, 20); |
495 |
lIzquierdo.setText(PluginServices.getText(this, "Izquierdo")); |
496 |
lIzquierdo.setLocation(180, 167); |
497 |
} |
498 |
|
499 |
return lIzquierdo;
|
500 |
} |
501 |
|
502 |
/**
|
503 |
* This method initializes tIzquierdo
|
504 |
*
|
505 |
* @return javax.swing.JTextField
|
506 |
*/
|
507 |
private javax.swing.JTextField getTIzquierdo() {
|
508 |
if (tIzquierdo == null) { |
509 |
tIzquierdo = new javax.swing.JTextField();
|
510 |
tIzquierdo.setSize(60, 20); |
511 |
tIzquierdo.setLocation(280, 167); |
512 |
|
513 |
if (m_layout.getLayoutContext().getAttributes().isMargin()) {
|
514 |
tIzquierdo.setText(String.valueOf(nf.format(m_layout
|
515 |
.getLayoutContext().getAttributes().toUnits(izq)))); |
516 |
} |
517 |
} |
518 |
|
519 |
return tIzquierdo;
|
520 |
} |
521 |
|
522 |
/**
|
523 |
* This method initializes lInferior
|
524 |
*
|
525 |
* @return javax.swing.JLabel
|
526 |
*/
|
527 |
private javax.swing.JLabel getLInferior() {
|
528 |
if (lInferior == null) { |
529 |
lInferior = new javax.swing.JLabel();
|
530 |
lInferior.setSize(81, 21); |
531 |
lInferior.setText(PluginServices.getText(this, "Inferior")); |
532 |
lInferior.setLocation(25, 190); |
533 |
} |
534 |
|
535 |
return lInferior;
|
536 |
} |
537 |
|
538 |
/**
|
539 |
* This method initializes tInferior
|
540 |
*
|
541 |
* @return javax.swing.JTextField
|
542 |
*/
|
543 |
private javax.swing.JTextField getTInferior() {
|
544 |
if (tInferior == null) { |
545 |
tInferior = new javax.swing.JTextField();
|
546 |
tInferior.setSize(60, 20); |
547 |
tInferior.setLocation(110, 190); |
548 |
|
549 |
if (m_layout.getLayoutContext().getAttributes().isMargin()) {
|
550 |
tInferior.setText(String.valueOf(nf.format(m_layout
|
551 |
.getLayoutContext().getAttributes().toUnits(inf)))); |
552 |
} |
553 |
} |
554 |
|
555 |
return tInferior;
|
556 |
} |
557 |
|
558 |
/**
|
559 |
* This method initializes lDerecho
|
560 |
*
|
561 |
* @return javax.swing.JLabel
|
562 |
*/
|
563 |
private javax.swing.JLabel getLDerecho() {
|
564 |
if (lDerecho == null) { |
565 |
lDerecho = new javax.swing.JLabel();
|
566 |
lDerecho.setSize(87, 21); |
567 |
lDerecho.setText(PluginServices.getText(this, "Derecho")); |
568 |
lDerecho.setLocation(180, 190); |
569 |
} |
570 |
|
571 |
return lDerecho;
|
572 |
} |
573 |
|
574 |
/**
|
575 |
* This method initializes tDerecho
|
576 |
*
|
577 |
* @return javax.swing.JTextField
|
578 |
*/
|
579 |
private javax.swing.JTextField getTDerecho() {
|
580 |
if (tDerecho == null) { |
581 |
tDerecho = new javax.swing.JTextField();
|
582 |
tDerecho.setSize(60, 20); |
583 |
tDerecho.setLocation(280, 190); |
584 |
|
585 |
if (m_layout.getLayoutContext().getAttributes().isMargin()) {
|
586 |
tDerecho.setText(String.valueOf(nf.format(m_layout
|
587 |
.getLayoutContext().getAttributes().toUnits(der)))); |
588 |
} |
589 |
} |
590 |
|
591 |
return tDerecho;
|
592 |
} |
593 |
|
594 |
/**
|
595 |
* This method initializes lResolucion
|
596 |
*
|
597 |
* @return javax.swing.JLabel
|
598 |
*/
|
599 |
private javax.swing.JLabel getLResolucion() {
|
600 |
if (lResolucion == null) { |
601 |
lResolucion = new javax.swing.JLabel();
|
602 |
lResolucion.setSize(164, 21); |
603 |
lResolucion.setText(PluginServices.getText(this,
|
604 |
"resolucion_resultado"));
|
605 |
lResolucion.setLocation(25, 215); |
606 |
} |
607 |
|
608 |
return lResolucion;
|
609 |
} |
610 |
|
611 |
/**
|
612 |
* This method initializes cbResolucion
|
613 |
*
|
614 |
* @return javax.swing.JComboBox
|
615 |
*/
|
616 |
private javax.swing.JComboBox getCbResolucion() {
|
617 |
if (cbResolucion == null) { |
618 |
cbResolucion = new javax.swing.JComboBox();
|
619 |
cbResolucion.setSize(150, 20); |
620 |
cbResolucion.setLocation(195, 215); |
621 |
cbResolucion.addItem(PluginServices.getText(this, "alta")); |
622 |
cbResolucion.addItem(PluginServices.getText(this, "normal")); |
623 |
cbResolucion.addItem(PluginServices.getText(this, "baja")); |
624 |
cbResolucion.setSelectedIndex(m_layout.getLayoutContext() |
625 |
.getAttributes().getResolution()); |
626 |
cbResolucion.addActionListener(new java.awt.event.ActionListener() {
|
627 |
|
628 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
629 |
resolution = cbResolucion.getSelectedIndex(); |
630 |
} |
631 |
}); |
632 |
} |
633 |
|
634 |
return cbResolucion;
|
635 |
} |
636 |
|
637 |
/**
|
638 |
* This method initializes bAceptar
|
639 |
*
|
640 |
* @return javax.swing.JButton
|
641 |
*/
|
642 |
private javax.swing.JButton getBAceptar() {
|
643 |
if (bAceptar == null) { |
644 |
bAceptar = new javax.swing.JButton();
|
645 |
bAceptar.setSize(84, 23); |
646 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); |
647 |
bAceptar.setLocation(130, 245); |
648 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
649 |
|
650 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
651 |
m_layout.getLayoutContext().getAttributes().setUnit(unit); |
652 |
|
653 |
if (isLand) {
|
654 |
m_layout.getLayoutContext().getAttributes() |
655 |
.setIsLandScape(true);
|
656 |
} else {
|
657 |
m_layout.getLayoutContext().getAttributes() |
658 |
.setIsLandScape(false);
|
659 |
} |
660 |
|
661 |
m_layout.getLayoutContext().getAttributes().setType(type); |
662 |
m_layout.getLayoutContext().getAttributes() |
663 |
.resetSizeinUnits(isLand); |
664 |
obtainArea(); |
665 |
|
666 |
double[] area = { sup, inf, izq, der }; |
667 |
|
668 |
if (type == Attributes.CUSTOM) { |
669 |
String width = getTAncho().getText().replace(',', '.'); |
670 |
String height = getTAlto().getText().replace(',', '.'); |
671 |
Attributes.CUSTOM_PAPER_SIZE =
|
672 |
new Size(
|
673 |
Double.valueOf(height).doubleValue(),
|
674 |
Double.valueOf(width).doubleValue());
|
675 |
m_layout.getLayoutContext().getAttributes().m_sizePaper = |
676 |
Attributes.CUSTOM_PAPER_SIZE;
|
677 |
} |
678 |
m_layout.getLayoutContext().getAttributes().setType(type); |
679 |
m_layout.obtainRect(false);
|
680 |
m_layout |
681 |
.getLayoutContext() |
682 |
.getAttributes() |
683 |
.setSelectedOptions(type, unit, isLand, margin, |
684 |
resolution, area); |
685 |
PluginServices.getMDIManager().closeWindow( |
686 |
FConfigLayoutDialog.this); |
687 |
m_layout.getLayoutControl().fullRect(); |
688 |
// m_layout.refresh();
|
689 |
} |
690 |
}); |
691 |
} |
692 |
|
693 |
return bAceptar;
|
694 |
} |
695 |
|
696 |
/**
|
697 |
* This method initializes bCancelar
|
698 |
*
|
699 |
* @return javax.swing.JButton
|
700 |
*/
|
701 |
private javax.swing.JButton getBCancelar() {
|
702 |
if (bCancelar == null) { |
703 |
bCancelar = new javax.swing.JButton();
|
704 |
bCancelar.setSize(85, 23); |
705 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); |
706 |
bCancelar.setLocation(245, 245); |
707 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
708 |
|
709 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
710 |
// setVisible(false);
|
711 |
PluginServices.getMDIManager().closeWindow( |
712 |
FConfigLayoutDialog.this); |
713 |
} |
714 |
}); |
715 |
} |
716 |
|
717 |
return bCancelar;
|
718 |
} |
719 |
|
720 |
/**
|
721 |
* This method initializes chbHorizontal
|
722 |
*
|
723 |
* @return javax.swing.JCheckBox
|
724 |
*/
|
725 |
private javax.swing.JCheckBox getChbHorizontal() {
|
726 |
if (chbHorizontal == null) { |
727 |
chbHorizontal = new javax.swing.JCheckBox();
|
728 |
chbHorizontal.setSize(99, 21); |
729 |
chbHorizontal.setText(PluginServices.getText(this, "horizontal")); |
730 |
chbHorizontal.setLocation(130, 110); |
731 |
chbHorizontal.setSelected(isLand); |
732 |
if (getCbTipoFolio().getSelectedItem().equals(
|
733 |
PluginServices.getText(this, "Personalizado"))) { |
734 |
chbHorizontal.setEnabled(false);
|
735 |
chbHorizontal.setSelected(false);
|
736 |
isLand = false;
|
737 |
} |
738 |
chbHorizontal |
739 |
.addActionListener(new java.awt.event.ActionListener() {
|
740 |
|
741 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
742 |
isLand = true;
|
743 |
getChbVertical().setSelected(false);
|
744 |
|
745 |
if (chbHorizontal.isSelected()) {
|
746 |
double iz = izq;
|
747 |
izq = inf; |
748 |
inf = der; |
749 |
der = sup; |
750 |
sup = iz; |
751 |
|
752 |
setMargin(margin); |
753 |
|
754 |
// }else{
|
755 |
if (type == Attributes.CUSTOM) { |
756 |
Attributes.CUSTOM_PAPER_SIZE =
|
757 |
new Size(Double.valueOf( |
758 |
getTAlto().getText()).doubleValue(), |
759 |
Double.valueOf(getTAncho().getText())
|
760 |
.doubleValue()); |
761 |
} |
762 |
|
763 |
Size size = |
764 |
m_layout.getLayoutContext().getAttributes() |
765 |
.getSizeinUnits(isLand, type); |
766 |
getTAncho().setText( |
767 |
String.valueOf(nf.format(size.getAncho())));
|
768 |
getTAlto().setText( |
769 |
String.valueOf(nf.format(size.getAlto())));
|
770 |
} |
771 |
|
772 |
chbHorizontal.setSelected(true);
|
773 |
} |
774 |
}); |
775 |
} |
776 |
|
777 |
return chbHorizontal;
|
778 |
} |
779 |
|
780 |
/**
|
781 |
* This method initializes chbVertical
|
782 |
*
|
783 |
* @return javax.swing.JCheckBox
|
784 |
*/
|
785 |
private javax.swing.JCheckBox getChbVertical() {
|
786 |
if (chbVertical == null) { |
787 |
chbVertical = new javax.swing.JCheckBox();
|
788 |
chbVertical.setSize(94, 23); |
789 |
chbVertical.setText(PluginServices.getText(this, "vertical")); |
790 |
chbVertical.setLocation(245, 110); |
791 |
chbVertical.setSelected(!isLand); |
792 |
if (getCbTipoFolio().getSelectedItem().equals(
|
793 |
PluginServices.getText(this, "Personalizado"))) { |
794 |
chbVertical.setEnabled(false);
|
795 |
chbVertical.setSelected(true);
|
796 |
isLand = false;
|
797 |
} |
798 |
chbVertical.addActionListener(new java.awt.event.ActionListener() {
|
799 |
|
800 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
801 |
isLand = false;
|
802 |
getChbHorizontal().setSelected(false);
|
803 |
|
804 |
if (chbVertical.isSelected()) {
|
805 |
double in = inf;
|
806 |
inf = izq; |
807 |
izq = sup; |
808 |
sup = der; |
809 |
der = in; |
810 |
|
811 |
setMargin(margin); |
812 |
|
813 |
// }else{
|
814 |
if (type == Attributes.CUSTOM) { |
815 |
Attributes.CUSTOM_PAPER_SIZE =
|
816 |
new Size(Double.valueOf(getTAlto().getText()) |
817 |
.doubleValue(), Double.valueOf(
|
818 |
getTAncho().getText()).doubleValue()); |
819 |
} |
820 |
|
821 |
Size size = |
822 |
m_layout.getLayoutContext().getAttributes() |
823 |
.getSizeinUnits(isLand, type); |
824 |
getTAncho().setText( |
825 |
String.valueOf(nf.format(size.getAncho())));
|
826 |
getTAlto().setText( |
827 |
String.valueOf(nf.format(size.getAlto())));
|
828 |
} |
829 |
|
830 |
chbVertical.setSelected(true);
|
831 |
} |
832 |
}); |
833 |
} |
834 |
|
835 |
return chbVertical;
|
836 |
} |
837 |
|
838 |
/*
|
839 |
* (non-Javadoc)
|
840 |
*
|
841 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
842 |
*/
|
843 |
public WindowInfo getWindowInfo() {
|
844 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
845 |
m_viewinfo.setWidth(371);
|
846 |
m_viewinfo.setHeight(300);
|
847 |
m_viewinfo.setTitle(PluginServices.getText(this, "Preparar_pagina")); |
848 |
|
849 |
return m_viewinfo;
|
850 |
} |
851 |
|
852 |
/**
|
853 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
854 |
*/
|
855 |
public void viewActivated() { |
856 |
} |
857 |
|
858 |
/**
|
859 |
* Obtiene el ?rea de los JtextField.
|
860 |
*/
|
861 |
private void obtainArea() { |
862 |
String s = (getTSuperior().getText());
|
863 |
s = s.replace(',', '.'); |
864 |
|
865 |
if (s.length() == 0) { |
866 |
s = "0";
|
867 |
} |
868 |
|
869 |
sup = |
870 |
m_layout.getLayoutContext().getAttributes() |
871 |
.fromUnits(Double.valueOf(s).doubleValue());
|
872 |
s = (getTIzquierdo().getText()); |
873 |
s = s.replace(',', '.'); |
874 |
|
875 |
if (s.length() == 0) { |
876 |
s = "0";
|
877 |
} |
878 |
|
879 |
izq = |
880 |
m_layout.getLayoutContext().getAttributes() |
881 |
.fromUnits(Double.valueOf(s).doubleValue());
|
882 |
s = (getTInferior().getText()); |
883 |
s = s.replace(',', '.'); |
884 |
|
885 |
if (s.length() == 0) { |
886 |
s = "0";
|
887 |
} |
888 |
|
889 |
inf = |
890 |
m_layout.getLayoutContext().getAttributes() |
891 |
.fromUnits(Double.valueOf(s).doubleValue());
|
892 |
s = (getTDerecho().getText()); |
893 |
s = s.replace(',', '.'); |
894 |
|
895 |
if (s.length() == 0) { |
896 |
s = "0";
|
897 |
} |
898 |
|
899 |
der = |
900 |
m_layout.getLayoutContext().getAttributes() |
901 |
.fromUnits(Double.valueOf(s).doubleValue());
|
902 |
} |
903 |
|
904 |
public Object getWindowProfile() { |
905 |
return WindowInfo.DIALOG_PROFILE;
|
906 |
} |
907 |
|
908 |
} |