root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / gui / dialogs / FConfigLayoutDialog.java @ 24986
History | View | Annotate | Download (24.4 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 |
getChbVertical().setSelected(true);
|
209 |
isLand=false;
|
210 |
getChbHorizontal().setSelected(false);
|
211 |
getChbVertical().setEnabled(false);
|
212 |
getChbHorizontal().setEnabled(false);
|
213 |
}else {
|
214 |
getTAlto().setEnabled(false);
|
215 |
getTAncho().setEnabled(false);
|
216 |
getChbVertical().setEnabled(true);
|
217 |
getChbHorizontal().setEnabled(true);
|
218 |
} |
219 |
} |
220 |
}); |
221 |
} |
222 |
|
223 |
return cbTipoFolio;
|
224 |
} |
225 |
|
226 |
/**
|
227 |
* This method initializes lDistancia
|
228 |
*
|
229 |
* @return javax.swing.JLabel
|
230 |
*/
|
231 |
private javax.swing.JLabel getLDistancia() {
|
232 |
if (lDistancia == null) { |
233 |
lDistancia = new javax.swing.JLabel();
|
234 |
lDistancia.setSize(137, 19); |
235 |
lDistancia.setText(PluginServices.getText(this, "distance_units")); |
236 |
lDistancia.setLocation(25, 40); |
237 |
} |
238 |
|
239 |
return lDistancia;
|
240 |
} |
241 |
|
242 |
/**
|
243 |
* This method initializes cbUnidades
|
244 |
*
|
245 |
* @return javax.swing.JComboBox
|
246 |
*/
|
247 |
private javax.swing.JComboBox getCbUnidades() {
|
248 |
if (cbUnidades == null) { |
249 |
cbUnidades = new javax.swing.JComboBox();
|
250 |
String[] names= MapContext.getDistanceNames(); |
251 |
for (int i=0;i<names.length;i++) { |
252 |
cbUnidades.addItem(PluginServices.getText(this,names[i]));
|
253 |
} |
254 |
cbUnidades.setSize(175, 20); |
255 |
cbUnidades.setLocation(175, 40); |
256 |
cbUnidades.setSelectedIndex(m_layout.getLayoutContext().getAtributes().getSelTypeUnit()); |
257 |
cbUnidades.addActionListener(new java.awt.event.ActionListener() {
|
258 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
259 |
unit = cbUnidades.getSelectedIndex(); |
260 |
m_layout.getLayoutContext().getAtributes().setUnit(unit); |
261 |
|
262 |
Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand, |
263 |
type); |
264 |
getTAlto().setText(String.valueOf(nf.format(
|
265 |
size.getAncho()))); |
266 |
getTAncho().setText(String.valueOf(nf.format(
|
267 |
size.getAlto()))); |
268 |
setMargin(margin); |
269 |
} |
270 |
}); |
271 |
} |
272 |
|
273 |
return cbUnidades;
|
274 |
} |
275 |
|
276 |
/**
|
277 |
* This method initializes lAnchura
|
278 |
*
|
279 |
* @return javax.swing.JLabel
|
280 |
*/
|
281 |
private javax.swing.JLabel getLAnchura() {
|
282 |
if (lAnchura == null) { |
283 |
lAnchura = new javax.swing.JLabel();
|
284 |
lAnchura.setSize(81, 21); |
285 |
lAnchura.setText(PluginServices.getText(this, "anchura")); |
286 |
lAnchura.setLocation(25, 65); |
287 |
} |
288 |
|
289 |
return lAnchura;
|
290 |
} |
291 |
|
292 |
/**
|
293 |
* This method initializes lAltura
|
294 |
*
|
295 |
* @return javax.swing.JLabel
|
296 |
*/
|
297 |
private javax.swing.JLabel getLAltura() {
|
298 |
if (lAltura == null) { |
299 |
lAltura = new javax.swing.JLabel();
|
300 |
lAltura.setSize(90, 21); |
301 |
lAltura.setText(PluginServices.getText(this, "altura")); |
302 |
lAltura.setLocation(180, 65); |
303 |
} |
304 |
|
305 |
return lAltura;
|
306 |
} |
307 |
|
308 |
/**
|
309 |
* This method initializes tAncho
|
310 |
*
|
311 |
* @return javax.swing.JTextField
|
312 |
*/
|
313 |
private javax.swing.JTextField getTAncho() {
|
314 |
if (tAncho == null) { |
315 |
tAncho = new javax.swing.JTextField();
|
316 |
tAncho.setSize(60, 20); |
317 |
tAncho.setLocation(110, 65); |
318 |
|
319 |
Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand, type); |
320 |
String s = String.valueOf(nf.format(size.getAncho())); |
321 |
tAncho.setText(s); |
322 |
if (getCbTipoFolio().getSelectedItem().equals(PluginServices.getText(this,"Personalizado"))) { |
323 |
getTAncho().setEnabled(true);
|
324 |
}else {
|
325 |
getTAncho().setEnabled(false);
|
326 |
} |
327 |
} |
328 |
|
329 |
return tAncho;
|
330 |
} |
331 |
|
332 |
/**
|
333 |
* This method initializes tAlto
|
334 |
*
|
335 |
* @return javax.swing.JTextField
|
336 |
*/
|
337 |
private javax.swing.JTextField getTAlto() {
|
338 |
if (tAlto == null) { |
339 |
tAlto = new javax.swing.JTextField();
|
340 |
tAlto.setSize(60, 20); |
341 |
tAlto.setLocation(280, 65); |
342 |
|
343 |
Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand, type); |
344 |
String s = String.valueOf(nf.format(size.getAlto())); |
345 |
tAlto.setText(s); |
346 |
if (getCbTipoFolio().getSelectedItem().equals(PluginServices.getText(this,"Personalizado"))) { |
347 |
getTAlto().setEnabled(true);
|
348 |
}else {
|
349 |
getTAlto().setEnabled(false);
|
350 |
} |
351 |
} |
352 |
|
353 |
return tAlto;
|
354 |
} |
355 |
|
356 |
/**
|
357 |
* This method initializes lOrientacion
|
358 |
*
|
359 |
* @return javax.swing.JLabel
|
360 |
*/
|
361 |
private javax.swing.JLabel getLOrientacion() {
|
362 |
if (lOrientacion == null) { |
363 |
lOrientacion = new javax.swing.JLabel();
|
364 |
lOrientacion.setSize(102, 38); |
365 |
lOrientacion.setText(PluginServices.getText(this, "orientacion")); |
366 |
lOrientacion.setLocation(25, 100); |
367 |
} |
368 |
|
369 |
return lOrientacion;
|
370 |
} |
371 |
|
372 |
/**
|
373 |
* This method initializes lMargenes
|
374 |
*
|
375 |
* @return javax.swing.JLabel
|
376 |
*/
|
377 |
private javax.swing.JLabel getLMargenes() {
|
378 |
if (lMargenes == null) { |
379 |
lMargenes = new javax.swing.JLabel();
|
380 |
lMargenes.setSize(95, 20); |
381 |
lMargenes.setText(PluginServices.getText(this, "margenes")); |
382 |
lMargenes.setLocation(25, 145); |
383 |
} |
384 |
|
385 |
return lMargenes;
|
386 |
} |
387 |
|
388 |
/**
|
389 |
* Inserta si se dibuja los margenes sobre el Layout o no.
|
390 |
*
|
391 |
* @param b True si se tiene que dibujar los margenes.
|
392 |
*/
|
393 |
private void setMargin(boolean b) { |
394 |
margin = b; |
395 |
|
396 |
if (b) {
|
397 |
getTSuperior().setText(String.valueOf(nf.format(
|
398 |
m_layout.getLayoutContext().getAtributes().toUnits(sup)))); |
399 |
getTIzquierdo().setText(String.valueOf(nf.format(
|
400 |
m_layout.getLayoutContext().getAtributes().toUnits(izq)))); |
401 |
getTInferior().setText(String.valueOf(nf.format(
|
402 |
m_layout.getLayoutContext().getAtributes().toUnits(inf)))); |
403 |
getTDerecho().setText(String.valueOf(nf.format(
|
404 |
m_layout.getLayoutContext().getAtributes().toUnits(der)))); |
405 |
getTSuperior().setEnabled(true);
|
406 |
getTIzquierdo().setEnabled(true);
|
407 |
getTInferior().setEnabled(true);
|
408 |
getTDerecho().setEnabled(true);
|
409 |
} else {
|
410 |
getTSuperior().setText("");
|
411 |
getTIzquierdo().setText("");
|
412 |
getTInferior().setText("");
|
413 |
getTDerecho().setText("");
|
414 |
getTSuperior().setEnabled(false);
|
415 |
getTIzquierdo().setEnabled(false);
|
416 |
getTInferior().setEnabled(false);
|
417 |
getTDerecho().setEnabled(false);
|
418 |
} |
419 |
} |
420 |
|
421 |
/**
|
422 |
* This method initializes chbMargenes
|
423 |
*
|
424 |
* @return javax.swing.JCheckBox
|
425 |
*/
|
426 |
private javax.swing.JCheckBox getChbMargenes() {
|
427 |
if (chbMargenes == null) { |
428 |
chbMargenes = new javax.swing.JCheckBox();
|
429 |
chbMargenes.setSize(230, 21); |
430 |
chbMargenes.setText(PluginServices.getText(this,"personalizar_margenes")); |
431 |
chbMargenes.setLocation(125, 145); |
432 |
chbMargenes.setSelected(m_layout.getLayoutContext().getAtributes().isMargin()); |
433 |
setMargin(m_layout.getLayoutContext().getAtributes().isMargin()); |
434 |
chbMargenes.addActionListener(new java.awt.event.ActionListener() {
|
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().getAtributes().isMargin()) {
|
478 |
tSuperior.setText(String.valueOf(nf.format(
|
479 |
m_layout.getLayoutContext().getAtributes().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().getAtributes().isMargin()) {
|
514 |
tIzquierdo.setText(String.valueOf(nf.format(
|
515 |
m_layout.getLayoutContext().getAtributes().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().getAtributes().isMargin()) {
|
550 |
tInferior.setText(String.valueOf(nf.format(
|
551 |
m_layout.getLayoutContext().getAtributes().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().getAtributes().isMargin()) {
|
586 |
tDerecho.setText(String.valueOf(nf.format(
|
587 |
m_layout.getLayoutContext().getAtributes().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().getAtributes().getResolution()); |
625 |
cbResolucion.addActionListener(new java.awt.event.ActionListener() {
|
626 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
627 |
resolution = cbResolucion.getSelectedIndex(); |
628 |
} |
629 |
}); |
630 |
} |
631 |
|
632 |
return cbResolucion;
|
633 |
} |
634 |
|
635 |
/**
|
636 |
* This method initializes bAceptar
|
637 |
*
|
638 |
* @return javax.swing.JButton
|
639 |
*/
|
640 |
private javax.swing.JButton getBAceptar() {
|
641 |
if (bAceptar == null) { |
642 |
bAceptar = new javax.swing.JButton();
|
643 |
bAceptar.setSize(84, 23); |
644 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); |
645 |
bAceptar.setLocation(130, 245); |
646 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
647 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
648 |
m_layout.getLayoutContext().getAtributes().setUnit(unit); |
649 |
|
650 |
if (isLand) {
|
651 |
m_layout.getLayoutContext().getAtributes().setIsLandScape(true);
|
652 |
} else {
|
653 |
m_layout.getLayoutContext().getAtributes().setIsLandScape(false);
|
654 |
} |
655 |
|
656 |
m_layout.getLayoutContext().getAtributes().setType(type); |
657 |
m_layout.getLayoutContext().getAtributes().setSizeinUnits(isLand); |
658 |
obtainArea(); |
659 |
|
660 |
double[] area = { sup, inf, izq, der }; |
661 |
|
662 |
if (type == Attributes.CUSTOM) { |
663 |
String width=getTAncho().getText().replace(',','.'); |
664 |
String height=getTAlto().getText().replace(',','.'); |
665 |
Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf( |
666 |
width).doubleValue(), |
667 |
Double.valueOf(height)
|
668 |
.doubleValue()); |
669 |
m_layout.getLayoutContext().getAtributes().m_sizePaper=Attributes.CUSTOM_PAPER_SIZE;
|
670 |
} |
671 |
m_layout.getLayoutContext().getAtributes().setType(type); |
672 |
m_layout.obtainRect(false);
|
673 |
m_layout.getLayoutContext().getAtributes().setSelectedOptions(type, unit, |
674 |
isLand, margin, resolution, area); |
675 |
PluginServices.getMDIManager().closeWindow(FConfigLayoutDialog.this); |
676 |
m_layout.getLayoutControl().fullRect(); |
677 |
//m_layout.refresh();
|
678 |
} |
679 |
}); |
680 |
} |
681 |
|
682 |
return bAceptar;
|
683 |
} |
684 |
|
685 |
/**
|
686 |
* This method initializes bCancelar
|
687 |
*
|
688 |
* @return javax.swing.JButton
|
689 |
*/
|
690 |
private javax.swing.JButton getBCancelar() {
|
691 |
if (bCancelar == null) { |
692 |
bCancelar = new javax.swing.JButton();
|
693 |
bCancelar.setSize(85, 23); |
694 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); |
695 |
bCancelar.setLocation(245, 245); |
696 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
697 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
698 |
//setVisible(false);
|
699 |
PluginServices.getMDIManager().closeWindow(FConfigLayoutDialog.this); |
700 |
} |
701 |
}); |
702 |
} |
703 |
|
704 |
return bCancelar;
|
705 |
} |
706 |
|
707 |
/**
|
708 |
* This method initializes chbHorizontal
|
709 |
*
|
710 |
* @return javax.swing.JCheckBox
|
711 |
*/
|
712 |
private javax.swing.JCheckBox getChbHorizontal() {
|
713 |
if (chbHorizontal == null) { |
714 |
chbHorizontal = new javax.swing.JCheckBox();
|
715 |
chbHorizontal.setSize(99, 21); |
716 |
chbHorizontal.setText(PluginServices.getText(this, "horizontal")); |
717 |
chbHorizontal.setLocation(130, 110); |
718 |
chbHorizontal.setSelected(isLand); |
719 |
if (getCbTipoFolio().getSelectedItem().equals(PluginServices.getText(this,"Personalizado"))) { |
720 |
chbHorizontal.setEnabled(false);
|
721 |
chbHorizontal.setSelected(false);
|
722 |
isLand=false;
|
723 |
} |
724 |
chbHorizontal.addActionListener(new java.awt.event.ActionListener() {
|
725 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
726 |
isLand = true;
|
727 |
getChbVertical().setSelected(false);
|
728 |
|
729 |
if (chbHorizontal.isSelected()) {
|
730 |
double iz = izq;
|
731 |
izq = inf; |
732 |
inf = der; |
733 |
der = sup; |
734 |
sup = iz; |
735 |
|
736 |
setMargin(margin); |
737 |
|
738 |
//}else{
|
739 |
if (type == Attributes.CUSTOM) { |
740 |
Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf( |
741 |
getTAlto().getText()).doubleValue(), |
742 |
Double.valueOf(getTAncho().getText())
|
743 |
.doubleValue()); |
744 |
} |
745 |
|
746 |
Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand, |
747 |
type); |
748 |
getTAncho().setText(String.valueOf(nf.format(
|
749 |
size.getAncho()))); |
750 |
getTAlto().setText(String.valueOf(nf.format(
|
751 |
size.getAlto()))); |
752 |
} |
753 |
|
754 |
chbHorizontal.setSelected(true);
|
755 |
} |
756 |
}); |
757 |
} |
758 |
|
759 |
return chbHorizontal;
|
760 |
} |
761 |
|
762 |
/**
|
763 |
* This method initializes chbVertical
|
764 |
*
|
765 |
* @return javax.swing.JCheckBox
|
766 |
*/
|
767 |
private javax.swing.JCheckBox getChbVertical() {
|
768 |
if (chbVertical == null) { |
769 |
chbVertical = new javax.swing.JCheckBox();
|
770 |
chbVertical.setSize(94, 23); |
771 |
chbVertical.setText(PluginServices.getText(this, "vertical")); |
772 |
chbVertical.setLocation(245, 110); |
773 |
chbVertical.setSelected(!isLand); |
774 |
if (getCbTipoFolio().getSelectedItem().equals(PluginServices.getText(this,"Personalizado"))) { |
775 |
chbVertical.setEnabled(false);
|
776 |
chbVertical.setSelected(true);
|
777 |
isLand=false;
|
778 |
} |
779 |
chbVertical.addActionListener(new java.awt.event.ActionListener() {
|
780 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
781 |
isLand = false;
|
782 |
getChbHorizontal().setSelected(false);
|
783 |
|
784 |
if (chbVertical.isSelected()) {
|
785 |
double in = inf;
|
786 |
inf = izq; |
787 |
izq = sup; |
788 |
sup = der; |
789 |
der = in; |
790 |
|
791 |
setMargin(margin); |
792 |
|
793 |
//}else{
|
794 |
if (type == Attributes.CUSTOM) { |
795 |
Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf( |
796 |
getTAncho().getText()).doubleValue(), |
797 |
Double.valueOf(getTAlto().getText())
|
798 |
.doubleValue()); |
799 |
} |
800 |
|
801 |
Size size = m_layout.getLayoutContext().getAtributes().getSizeinUnits(isLand, |
802 |
type); |
803 |
getTAncho().setText(String.valueOf(nf.format(
|
804 |
size.getAncho()))); |
805 |
getTAlto().setText(String.valueOf(nf.format(
|
806 |
size.getAlto()))); |
807 |
} |
808 |
|
809 |
chbVertical.setSelected(true);
|
810 |
} |
811 |
}); |
812 |
} |
813 |
|
814 |
return chbVertical;
|
815 |
} |
816 |
|
817 |
/* (non-Javadoc)
|
818 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
819 |
*/
|
820 |
public WindowInfo getWindowInfo() {
|
821 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
822 |
m_viewinfo.setWidth(371);
|
823 |
m_viewinfo.setHeight(300);
|
824 |
m_viewinfo.setTitle(PluginServices.getText(this, "Preparar_pagina")); |
825 |
|
826 |
return m_viewinfo;
|
827 |
} |
828 |
|
829 |
/**
|
830 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
831 |
*/
|
832 |
public void viewActivated() { |
833 |
} |
834 |
|
835 |
/**
|
836 |
* Obtiene el ?rea de los JtextField.
|
837 |
*/
|
838 |
private void obtainArea() { |
839 |
String s = (getTSuperior().getText());
|
840 |
s = s.replace(',', '.'); |
841 |
|
842 |
if (s.length() == 0) { |
843 |
s = "0";
|
844 |
} |
845 |
|
846 |
sup = m_layout.getLayoutContext().getAtributes().fromUnits(Double.valueOf(s).doubleValue());
|
847 |
s = (getTIzquierdo().getText()); |
848 |
s = s.replace(',', '.'); |
849 |
|
850 |
if (s.length() == 0) { |
851 |
s = "0";
|
852 |
} |
853 |
|
854 |
izq = m_layout.getLayoutContext().getAtributes().fromUnits(Double.valueOf(s).doubleValue());
|
855 |
s = (getTInferior().getText()); |
856 |
s = s.replace(',', '.'); |
857 |
|
858 |
if (s.length() == 0) { |
859 |
s = "0";
|
860 |
} |
861 |
|
862 |
inf = m_layout.getLayoutContext().getAtributes().fromUnits(Double.valueOf(s).doubleValue());
|
863 |
s = (getTDerecho().getText()); |
864 |
s = s.replace(',', '.'); |
865 |
|
866 |
if (s.length() == 0) { |
867 |
s = "0";
|
868 |
} |
869 |
|
870 |
der = m_layout.getLayoutContext().getAtributes().fromUnits(Double.valueOf(s).doubleValue());
|
871 |
} |
872 |
|
873 |
public Object getWindowProfile() { |
874 |
return WindowInfo.DIALOG_PROFILE;
|
875 |
} |
876 |
} |