Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / gui / dialogs / FConfigLayoutDialog.java @ 9392

History | View | Annotate | Download (22.6 KB)

1
/*
2
 * Created on 23-jun-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package com.iver.cit.gvsig.project.documents.layout.gui.dialogs;
46

    
47
import java.awt.Dimension;
48
import java.text.NumberFormat;
49

    
50
import javax.swing.JPanel;
51

    
52
import com.iver.andami.PluginServices;
53
import com.iver.andami.ui.mdiManager.IWindow;
54
import com.iver.andami.ui.mdiManager.WindowInfo;
55
import com.iver.cit.gvsig.project.documents.layout.Attributes;
56
import com.iver.cit.gvsig.project.documents.layout.Size;
57
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
58

    
59

    
60
/**
61
 * Clase para configurar el Layout.
62
 *
63
 * @author Vicente Caballero Navarro
64
 */
65
public class FConfigLayoutDialog extends JPanel implements IWindow {
66
        private javax.swing.JLabel lTamPag = null;
67
        private javax.swing.JComboBox cbTipoFolio = null;
68
        private javax.swing.JLabel lDistancia = null;
69
        private javax.swing.JComboBox cbUnidades = null;
70
        private javax.swing.JLabel lAnchura = null;
71
        private javax.swing.JLabel lAltura = null;
72
        private javax.swing.JTextField tAncho = null;
73
        private javax.swing.JTextField tAlto = null;
74
        private javax.swing.JLabel lOrientacion = null;
75
        private javax.swing.JLabel lMargenes = null;
76
        private javax.swing.JCheckBox chbMargenes = null;
77
        private javax.swing.JLabel lSuperior = null;
78
        private javax.swing.JTextField tSuperior = null;
79
        private javax.swing.JLabel lIzquierdo = null;
80
        private javax.swing.JTextField tIzquierdo = null;
81
        private javax.swing.JLabel lInferior = null;
82
        private javax.swing.JTextField tInferior = null;
83
        private javax.swing.JLabel lDerecho = null;
84
        private javax.swing.JTextField tDerecho = null;
85
        private javax.swing.JLabel lResolucion = null;
86
        private javax.swing.JComboBox cbResolucion = null;
87
        private javax.swing.JButton bAceptar = null;
88
        private javax.swing.JButton bCancelar = null;
89
        private Layout m_layout = null;
90
        private javax.swing.JCheckBox chbHorizontal = null;
91
        private javax.swing.JCheckBox chbVertical = null;
92
        private int unit = 2;
93
        private int type = 0;
94
        private boolean isLand = true;
95
        private boolean margin = false;
96
        private int resolution = 1;
97
        private double der = 2.54;
98
        private double izq = 2.54;
99
        private double sup = 2.54;
100
        private double inf = 2.54;
101
        private NumberFormat nf = NumberFormat.getInstance();
102

    
103
        /**
104
         * This is the default constructor
105
         *
106
         * @param layout Referencia al Layout.
107
         */
108
        public FConfigLayoutDialog(Layout layout) {
109
                super();
110
                m_layout = layout;
111
                initialize();
112
        }
113

    
114
        /**
115
         * This method initializes this
116
         */
117
        private void initialize() {
118
                nf.setMaximumFractionDigits(2);
119
                this.setLayout(null);
120
                type = m_layout.getLayoutContext().getAtributes().getType();
121
                unit = m_layout.getLayoutContext().getAtributes().getSelTypeUnit();
122
                isLand = m_layout.getLayoutContext().getAtributes().isLandSpace();
123
                sup = m_layout.getLayoutContext().getAtributes().m_area[0];
124
                inf = m_layout.getLayoutContext().getAtributes().m_area[1];
125
                izq = m_layout.getLayoutContext().getAtributes().m_area[2];
126
                der = m_layout.getLayoutContext().getAtributes().m_area[3];
127
                this.add(getLTamPag(), null);
128
                this.add(getCbTipoFolio(), null);
129
                this.add(getLDistancia(), null);
130
                this.add(getCbUnidades(), null);
131
                this.add(getLAnchura(), null);
132
                this.add(getLAltura(), null);
133
                this.add(getTAncho(), null);
134
                this.add(getTAlto(), null);
135
                this.add(getLOrientacion(), null);
136
                this.add(getLMargenes(), null);
137
                this.add(getChbMargenes(), null);
138
                this.add(getLSuperior(), null);
139
                this.add(getTSuperior(), null);
140
                this.add(getLIzquierdo(), null);
141
                this.add(getTIzquierdo(), null);
142
                this.add(getLInferior(), null);
143
                this.add(getTInferior(), null);
144
                this.add(getLDerecho(), null);
145
                this.add(getTDerecho(), null);
146
                this.add(getLResolucion(), null);
147
                this.add(getCbResolucion(), null);
148
                this.add(getBAceptar(), null);
149
                this.add(getBCancelar(), null);
150
                this.add(getChbHorizontal(), null);
151
                this.add(getChbVertical(), null);
152
                this.setPreferredSize(new Dimension(371, 300));
153
        }
154

    
155
        /**
156
         * This method initializes lTamPag
157
         *
158
         * @return javax.swing.JLabel
159
         */
160
        private javax.swing.JLabel getLTamPag() {
161
                if (lTamPag == null) {
162
                        lTamPag = new javax.swing.JLabel();
163
                        lTamPag.setSize(134, 20);
164
                        lTamPag.setText(PluginServices.getText(this, "tamano_pagina") +
165
                                ":");
166
                        lTamPag.setLocation(25, 15);
167
                }
168

    
169
                return lTamPag;
170
        }
171

    
172
        /**
173
         * This method initializes cbTipoFolio
174
         *
175
         * @return javax.swing.JComboBox
176
         */
177
        private javax.swing.JComboBox getCbTipoFolio() {
178
                if (cbTipoFolio == null) {
179
                        cbTipoFolio = new javax.swing.JComboBox();
180
                        cbTipoFolio.setSize(175, 20);
181
                        cbTipoFolio.setPreferredSize(new java.awt.Dimension(130, 20));
182
                        cbTipoFolio.setLocation(175, 15);
183
                        cbTipoFolio.addItem(PluginServices.getText(this,
184
                                        "Igual_que_la_impresora"));
185
                        cbTipoFolio.addItem(PluginServices.getText(this, "A4"));
186
                        cbTipoFolio.addItem(PluginServices.getText(this, "A3"));
187
                        cbTipoFolio.addItem(PluginServices.getText(this, "A2"));
188
                        cbTipoFolio.addItem(PluginServices.getText(this, "A1"));
189
                        cbTipoFolio.addItem(PluginServices.getText(this, "A0"));
190
                        cbTipoFolio.addItem(PluginServices.getText(this, "Personalizado"));
191

    
192
                        cbTipoFolio.setSelectedIndex(m_layout.getLayoutContext().getAtributes().getType());
193
                        cbTipoFolio.addActionListener(new java.awt.event.ActionListener() {
194
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
195
                                                type = cbTipoFolio.getSelectedIndex();
196

    
197
                                                Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand,
198
                                                                type);
199
                                                getTAlto().setText(String.valueOf(nf.format(
200
                                                                        size.getAlto())));
201
                                                getTAncho().setText(String.valueOf(nf.format(
202
                                                                        size.getAncho())));
203
                                                setMargin(margin);
204
                                        }
205
                                });
206
                }
207

    
208
                return cbTipoFolio;
209
        }
210

    
211
        /**
212
         * This method initializes lDistancia
213
         *
214
         * @return javax.swing.JLabel
215
         */
216
        private javax.swing.JLabel getLDistancia() {
217
                if (lDistancia == null) {
218
                        lDistancia = new javax.swing.JLabel();
219
                        lDistancia.setSize(137, 19);
220
                        lDistancia.setText(PluginServices.getText(this, "distance_units"));
221
                        lDistancia.setLocation(25, 40);
222
                }
223

    
224
                return lDistancia;
225
        }
226

    
227
        /**
228
         * This method initializes cbUnidades
229
         *
230
         * @return javax.swing.JComboBox
231
         */
232
        private javax.swing.JComboBox getCbUnidades() {
233
                if (cbUnidades == null) {
234
                        cbUnidades = new javax.swing.JComboBox(Attributes.NAMES);
235
                        cbUnidades.setSize(175, 20);
236
                        cbUnidades.setLocation(175, 40);
237
                        cbUnidades.setSelectedIndex(m_layout.getLayoutContext().getAtributes().getSelTypeUnit());
238
                        cbUnidades.addActionListener(new java.awt.event.ActionListener() {
239
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
240
                                                unit = cbUnidades.getSelectedIndex();
241
                                                m_layout.getLayoutContext().getAtributes().setUnit(unit);
242

    
243
                                                Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand,
244
                                                                type);
245
                                                getTAlto().setText(String.valueOf(nf.format(
246
                                                                        size.getAncho())));
247
                                                getTAncho().setText(String.valueOf(nf.format(
248
                                                                        size.getAlto())));
249
                                                setMargin(margin);
250
                                        }
251
                                });
252
                }
253

    
254
                return cbUnidades;
255
        }
256

    
257
        /**
258
         * This method initializes lAnchura
259
         *
260
         * @return javax.swing.JLabel
261
         */
262
        private javax.swing.JLabel getLAnchura() {
263
                if (lAnchura == null) {
264
                        lAnchura = new javax.swing.JLabel();
265
                        lAnchura.setSize(81, 21);
266
                        lAnchura.setText(PluginServices.getText(this, "anchura"));
267
                        lAnchura.setLocation(25, 65);
268
                }
269

    
270
                return lAnchura;
271
        }
272

    
273
        /**
274
         * This method initializes lAltura
275
         *
276
         * @return javax.swing.JLabel
277
         */
278
        private javax.swing.JLabel getLAltura() {
279
                if (lAltura == null) {
280
                        lAltura = new javax.swing.JLabel();
281
                        lAltura.setSize(90, 21);
282
                        lAltura.setText(PluginServices.getText(this, "altura"));
283
                        lAltura.setLocation(180, 65);
284
                }
285

    
286
                return lAltura;
287
        }
288

    
289
        /**
290
         * This method initializes tAncho
291
         *
292
         * @return javax.swing.JTextField
293
         */
294
        private javax.swing.JTextField getTAncho() {
295
                if (tAncho == null) {
296
                        tAncho = new javax.swing.JTextField();
297
                        tAncho.setSize(60, 20);
298
                        tAncho.setLocation(110, 65);
299

    
300
                        Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand, type);
301
                        String s = String.valueOf(nf.format(size.getAncho()));
302
                        tAncho.setText(s);
303
                }
304

    
305
                return tAncho;
306
        }
307

    
308
        /**
309
         * This method initializes tAlto
310
         *
311
         * @return javax.swing.JTextField
312
         */
313
        private javax.swing.JTextField getTAlto() {
314
                if (tAlto == null) {
315
                        tAlto = new javax.swing.JTextField();
316
                        tAlto.setSize(60, 20);
317
                        tAlto.setLocation(280, 65);
318

    
319
                        Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand, type);
320
                        String s = String.valueOf(nf.format(size.getAlto()));
321
                        tAlto.setText(s);
322
                }
323

    
324
                return tAlto;
325
        }
326

    
327
        /**
328
         * This method initializes lOrientacion
329
         *
330
         * @return javax.swing.JLabel
331
         */
332
        private javax.swing.JLabel getLOrientacion() {
333
                if (lOrientacion == null) {
334
                        lOrientacion = new javax.swing.JLabel();
335
                        lOrientacion.setSize(102, 38);
336
                        lOrientacion.setText(PluginServices.getText(this, "orientacion"));
337
                        lOrientacion.setLocation(25, 100);
338
                }
339

    
340
                return lOrientacion;
341
        }
342

    
343
        /**
344
         * This method initializes lMargenes
345
         *
346
         * @return javax.swing.JLabel
347
         */
348
        private javax.swing.JLabel getLMargenes() {
349
                if (lMargenes == null) {
350
                        lMargenes = new javax.swing.JLabel();
351
                        lMargenes.setSize(95, 20);
352
                        lMargenes.setText(PluginServices.getText(this, "margenes"));
353
                        lMargenes.setLocation(25, 145);
354
                }
355

    
356
                return lMargenes;
357
        }
358

    
359
        /**
360
         * Inserta si se dibuja los margenes sobre el Layout o no.
361
         *
362
         * @param b True si se tiene que dibujar los margenes.
363
         */
364
        private void setMargin(boolean b) {
365
                margin = b;
366

    
367
                if (b) {
368
                        getTSuperior().setText(String.valueOf(nf.format(
369
                                                m_layout.getLayoutContext().getAtributes().toUnits(sup))));
370
                        getTIzquierdo().setText(String.valueOf(nf.format(
371
                                                m_layout.getLayoutContext().getAtributes().toUnits(izq))));
372
                        getTInferior().setText(String.valueOf(nf.format(
373
                                                m_layout.getLayoutContext().getAtributes().toUnits(inf))));
374
                        getTDerecho().setText(String.valueOf(nf.format(
375
                                                m_layout.getLayoutContext().getAtributes().toUnits(der))));
376
                        getTSuperior().setEnabled(true);
377
                        getTIzquierdo().setEnabled(true);
378
                        getTInferior().setEnabled(true);
379
                        getTDerecho().setEnabled(true);
380
                } else {
381
                        getTSuperior().setText("");
382
                        getTIzquierdo().setText("");
383
                        getTInferior().setText("");
384
                        getTDerecho().setText("");
385
                        getTSuperior().setEnabled(false);
386
                        getTIzquierdo().setEnabled(false);
387
                        getTInferior().setEnabled(false);
388
                        getTDerecho().setEnabled(false);
389
                }
390
        }
391

    
392
        /**
393
         * This method initializes chbMargenes
394
         *
395
         * @return javax.swing.JCheckBox
396
         */
397
        private javax.swing.JCheckBox getChbMargenes() {
398
                if (chbMargenes == null) {
399
                        chbMargenes = new javax.swing.JCheckBox();
400
                        chbMargenes.setSize(230, 21);
401
                        chbMargenes.setText(PluginServices.getText(this,"personalizar_margenes"));
402
                        chbMargenes.setLocation(125, 145);
403
                        chbMargenes.setSelected(m_layout.getLayoutContext().getAtributes().isMargin());
404
                        setMargin(m_layout.getLayoutContext().getAtributes().isMargin());
405
                        chbMargenes.addActionListener(new java.awt.event.ActionListener() {
406
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
407
                                                if (chbMargenes.isSelected()) {
408
                                                        margin = true;
409
                                                } else {
410
                                                        margin = false;
411
                                                }
412

    
413
                                                setMargin(margin);
414
                                        }
415
                                });
416
                }
417

    
418
                return chbMargenes;
419
        }
420

    
421
        /**
422
         * This method initializes lSuperior
423
         *
424
         * @return javax.swing.JLabel
425
         */
426
        private javax.swing.JLabel getLSuperior() {
427
                if (lSuperior == null) {
428
                        lSuperior = new javax.swing.JLabel();
429
                        lSuperior.setSize(81, 20);
430
                        lSuperior.setText(PluginServices.getText(this, "Superior"));
431
                        lSuperior.setLocation(25, 167);
432
                }
433

    
434
                return lSuperior;
435
        }
436

    
437
        /**
438
         * This method initializes tSuperior
439
         *
440
         * @return javax.swing.JTextField
441
         */
442
        private javax.swing.JTextField getTSuperior() {
443
                if (tSuperior == null) {
444
                        tSuperior = new javax.swing.JTextField();
445
                        tSuperior.setSize(60, 20);
446
                        tSuperior.setLocation(110, 167);
447

    
448
                        if (m_layout.getLayoutContext().getAtributes().isMargin()) {
449
                                tSuperior.setText(String.valueOf(nf.format(
450
                                                        m_layout.getLayoutContext().getAtributes().toUnits(sup))));
451
                        }
452
                }
453

    
454
                return tSuperior;
455
        }
456

    
457
        /**
458
         * This method initializes lIzquierdo
459
         *
460
         * @return javax.swing.JLabel
461
         */
462
        private javax.swing.JLabel getLIzquierdo() {
463
                if (lIzquierdo == null) {
464
                        lIzquierdo = new javax.swing.JLabel();
465
                        lIzquierdo.setSize(88, 20);
466
                        lIzquierdo.setText(PluginServices.getText(this, "Izquierdo"));
467
                        lIzquierdo.setLocation(180, 167);
468
                }
469

    
470
                return lIzquierdo;
471
        }
472

    
473
        /**
474
         * This method initializes tIzquierdo
475
         *
476
         * @return javax.swing.JTextField
477
         */
478
        private javax.swing.JTextField getTIzquierdo() {
479
                if (tIzquierdo == null) {
480
                        tIzquierdo = new javax.swing.JTextField();
481
                        tIzquierdo.setSize(60, 20);
482
                        tIzquierdo.setLocation(280, 167);
483

    
484
                        if (m_layout.getLayoutContext().getAtributes().isMargin()) {
485
                                tIzquierdo.setText(String.valueOf(nf.format(
486
                                                        m_layout.getLayoutContext().getAtributes().toUnits(izq))));
487
                        }
488
                }
489

    
490
                return tIzquierdo;
491
        }
492

    
493
        /**
494
         * This method initializes lInferior
495
         *
496
         * @return javax.swing.JLabel
497
         */
498
        private javax.swing.JLabel getLInferior() {
499
                if (lInferior == null) {
500
                        lInferior = new javax.swing.JLabel();
501
                        lInferior.setSize(81, 21);
502
                        lInferior.setText(PluginServices.getText(this, "Inferior"));
503
                        lInferior.setLocation(25, 190);
504
                }
505

    
506
                return lInferior;
507
        }
508

    
509
        /**
510
         * This method initializes tInferior
511
         *
512
         * @return javax.swing.JTextField
513
         */
514
        private javax.swing.JTextField getTInferior() {
515
                if (tInferior == null) {
516
                        tInferior = new javax.swing.JTextField();
517
                        tInferior.setSize(60, 20);
518
                        tInferior.setLocation(110, 190);
519

    
520
                        if (m_layout.getLayoutContext().getAtributes().isMargin()) {
521
                                tInferior.setText(String.valueOf(nf.format(
522
                                                        m_layout.getLayoutContext().getAtributes().toUnits(inf))));
523
                        }
524
                }
525

    
526
                return tInferior;
527
        }
528

    
529
        /**
530
         * This method initializes lDerecho
531
         *
532
         * @return javax.swing.JLabel
533
         */
534
        private javax.swing.JLabel getLDerecho() {
535
                if (lDerecho == null) {
536
                        lDerecho = new javax.swing.JLabel();
537
                        lDerecho.setSize(87, 21);
538
                        lDerecho.setText(PluginServices.getText(this, "Derecho"));
539
                        lDerecho.setLocation(180, 190);
540
                }
541

    
542
                return lDerecho;
543
        }
544

    
545
        /**
546
         * This method initializes tDerecho
547
         *
548
         * @return javax.swing.JTextField
549
         */
550
        private javax.swing.JTextField getTDerecho() {
551
                if (tDerecho == null) {
552
                        tDerecho = new javax.swing.JTextField();
553
                        tDerecho.setSize(60, 20);
554
                        tDerecho.setLocation(280, 190);
555

    
556
                        if (m_layout.getLayoutContext().getAtributes().isMargin()) {
557
                                tDerecho.setText(String.valueOf(nf.format(
558
                                                        m_layout.getLayoutContext().getAtributes().toUnits(der))));
559
                        }
560
                }
561

    
562
                return tDerecho;
563
        }
564

    
565
        /**
566
         * This method initializes lResolucion
567
         *
568
         * @return javax.swing.JLabel
569
         */
570
        private javax.swing.JLabel getLResolucion() {
571
                if (lResolucion == null) {
572
                        lResolucion = new javax.swing.JLabel();
573
                        lResolucion.setSize(164, 21);
574
                        lResolucion.setText(PluginServices.getText(this,
575
                                        "resolucion_resultado"));
576
                        lResolucion.setLocation(25, 215);
577
                }
578

    
579
                return lResolucion;
580
        }
581

    
582
        /**
583
         * This method initializes cbResolucion
584
         *
585
         * @return javax.swing.JComboBox
586
         */
587
        private javax.swing.JComboBox getCbResolucion() {
588
                if (cbResolucion == null) {
589
                        cbResolucion = new javax.swing.JComboBox();
590
                        cbResolucion.setSize(150, 20);
591
                        cbResolucion.setLocation(195, 215);
592
                        cbResolucion.addItem(PluginServices.getText(this, "alta"));
593
                        cbResolucion.addItem(PluginServices.getText(this, "normal"));
594
                        cbResolucion.addItem(PluginServices.getText(this, "baja"));
595
                        cbResolucion.setSelectedIndex(m_layout.getLayoutContext().getAtributes().getResolution());
596
                        cbResolucion.addActionListener(new java.awt.event.ActionListener() {
597
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
598
                                                resolution = cbResolucion.getSelectedIndex();
599
                                        }
600
                                });
601
                }
602

    
603
                return cbResolucion;
604
        }
605

    
606
        /**
607
         * This method initializes bAceptar
608
         *
609
         * @return javax.swing.JButton
610
         */
611
        private javax.swing.JButton getBAceptar() {
612
                if (bAceptar == null) {
613
                        bAceptar = new javax.swing.JButton();
614
                        bAceptar.setSize(84, 23);
615
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
616
                        bAceptar.setLocation(130, 245);
617
                        bAceptar.addActionListener(new java.awt.event.ActionListener() {
618
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
619
                                                m_layout.getLayoutContext().getAtributes().setUnit(unit);
620

    
621
                                                if (isLand) {
622
                                                        m_layout.getLayoutContext().getAtributes().setIsLandScape(true);
623
                                                } else {
624
                                                        m_layout.getLayoutContext().getAtributes().setIsLandScape(false);
625
                                                }
626

    
627
                                                m_layout.getLayoutContext().getAtributes().setType(type);
628
                                                m_layout.getLayoutContext().getAtributes().setSizeinUnits(isLand);
629
                                                obtainArea();
630

    
631
                                                double[] area = { sup, inf, izq, der };
632

    
633
                                                if (type == Attributes.CUSTOM) {
634
                                                        Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
635
                                                                                getTAncho().getText()).doubleValue(),
636
                                                                        Double.valueOf(getTAlto().getText())
637
                                                                                  .doubleValue());
638
                                                }
639

    
640
                                                m_layout.getLayoutContext().getAtributes().setSelectedOptions(type, unit,
641
                                                        isLand, margin, resolution, area);
642
                                                PluginServices.getMDIManager().closeWindow(FConfigLayoutDialog.this);
643
                                                m_layout.getLayoutControl().fullRect();
644
                                                //m_layout.refresh();
645
                                        }
646
                                });
647
                }
648

    
649
                return bAceptar;
650
        }
651

    
652
        /**
653
         * This method initializes bCancelar
654
         *
655
         * @return javax.swing.JButton
656
         */
657
        private javax.swing.JButton getBCancelar() {
658
                if (bCancelar == null) {
659
                        bCancelar = new javax.swing.JButton();
660
                        bCancelar.setSize(85, 23);
661
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
662
                        bCancelar.setLocation(245, 245);
663
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
664
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
665
                                                //setVisible(false);
666
                                                PluginServices.getMDIManager().closeWindow(FConfigLayoutDialog.this);
667
                                        }
668
                                });
669
                }
670

    
671
                return bCancelar;
672
        }
673

    
674
        /**
675
         * This method initializes chbHorizontal
676
         *
677
         * @return javax.swing.JCheckBox
678
         */
679
        private javax.swing.JCheckBox getChbHorizontal() {
680
                if (chbHorizontal == null) {
681
                        chbHorizontal = new javax.swing.JCheckBox();
682
                        chbHorizontal.setSize(99, 21);
683
                        chbHorizontal.setText(PluginServices.getText(this, "horizontal"));
684
                        chbHorizontal.setLocation(130, 110);
685
                        chbHorizontal.setSelected(isLand);
686
                        chbHorizontal.addActionListener(new java.awt.event.ActionListener() {
687
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
688
                                                isLand = true;
689
                                                getChbVertical().setSelected(false);
690

    
691
                                                if (chbHorizontal.isSelected()) {
692
                                                        double iz = izq;
693
                                                        izq = inf;
694
                                                        inf = der;
695
                                                        der = sup;
696
                                                        sup = iz;
697

    
698
                                                        setMargin(margin);
699

    
700
                                                        //}else{
701
                                                        if (type == Attributes.CUSTOM) {
702
                                                                Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
703
                                                                                        getTAlto().getText()).doubleValue(),
704
                                                                                Double.valueOf(getTAncho().getText())
705
                                                                                          .doubleValue());
706
                                                        }
707

    
708
                                                        Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand,
709
                                                                        type);
710
                                                        getTAncho().setText(String.valueOf(nf.format(
711
                                                                                size.getAncho())));
712
                                                        getTAlto().setText(String.valueOf(nf.format(
713
                                                                                size.getAlto())));
714
                                                }
715

    
716
                                                chbHorizontal.setSelected(true);
717
                                        }
718
                                });
719
                }
720

    
721
                return chbHorizontal;
722
        }
723

    
724
        /**
725
         * This method initializes chbVertical
726
         *
727
         * @return javax.swing.JCheckBox
728
         */
729
        private javax.swing.JCheckBox getChbVertical() {
730
                if (chbVertical == null) {
731
                        chbVertical = new javax.swing.JCheckBox();
732
                        chbVertical.setSize(94, 23);
733
                        chbVertical.setText(PluginServices.getText(this, "vertical"));
734
                        chbVertical.setLocation(245, 110);
735
                        chbVertical.setSelected(!isLand);
736
                        chbVertical.addActionListener(new java.awt.event.ActionListener() {
737
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
738
                                                isLand = false;
739
                                                getChbHorizontal().setSelected(false);
740

    
741
                                                if (chbVertical.isSelected()) {
742
                                                        double in = inf;
743
                                                        inf = izq;
744
                                                        izq = sup;
745
                                                        sup = der;
746
                                                        der = in;
747

    
748
                                                        setMargin(margin);
749

    
750
                                                        //}else{
751
                                                        if (type == Attributes.CUSTOM) {
752
                                                                Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
753
                                                                                        getTAncho().getText()).doubleValue(),
754
                                                                                Double.valueOf(getTAlto().getText())
755
                                                                                          .doubleValue());
756
                                                        }
757

    
758
                                                        Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand,
759
                                                                        type);
760
                                                        getTAncho().setText(String.valueOf(nf.format(
761
                                                                                size.getAncho())));
762
                                                        getTAlto().setText(String.valueOf(nf.format(
763
                                                                                size.getAlto())));
764
                                                }
765

    
766
                                                chbVertical.setSelected(true);
767
                                        }
768
                                });
769
                }
770

    
771
                return chbVertical;
772
        }
773

    
774
        /* (non-Javadoc)
775
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
776
         */
777
        public WindowInfo getWindowInfo() {
778
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
779
                m_viewinfo.setWidth(371);
780
                m_viewinfo.setHeight(300);
781
                m_viewinfo.setTitle(PluginServices.getText(this, "Preparar_pagina"));
782

    
783
                return m_viewinfo;
784
        }
785

    
786
        /**
787
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
788
         */
789
        public void viewActivated() {
790
        }
791

    
792
        /**
793
         * Obtiene el ?rea de los JtextField.
794
         */
795
        private void obtainArea() {
796
                String s = (getTSuperior().getText());
797
                s = s.replace(',', '.');
798

    
799
                if (s.length() == 0) {
800
                        s = "0";
801
                }
802

    
803
                sup = m_layout.getLayoutContext().getAtributes().fromUnits(Double.valueOf(s).doubleValue());
804
                s = (getTIzquierdo().getText());
805
                s = s.replace(',', '.');
806

    
807
                if (s.length() == 0) {
808
                        s = "0";
809
                }
810

    
811
                izq = m_layout.getLayoutContext().getAtributes().fromUnits(Double.valueOf(s).doubleValue());
812
                s = (getTInferior().getText());
813
                s = s.replace(',', '.');
814

    
815
                if (s.length() == 0) {
816
                        s = "0";
817
                }
818

    
819
                inf = m_layout.getLayoutContext().getAtributes().fromUnits(Double.valueOf(s).doubleValue());
820
                s = (getTDerecho().getText());
821
                s = s.replace(',', '.');
822

    
823
                if (s.length() == 0) {
824
                        s = "0";
825
                }
826

    
827
                der = m_layout.getLayoutContext().getAtributes().fromUnits(Double.valueOf(s).doubleValue());
828
        }
829
}