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