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