root / trunk / extensions / extQuickPrint / src / es / iver / quickPrint / SelectTemplatePanel.java @ 28298
History | View | Annotate | Download (22.3 KB)
1 |
package es.iver.quickPrint; |
---|---|
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
import java.awt.Color; |
5 |
import java.awt.Component; |
6 |
import java.awt.FlowLayout; |
7 |
import java.awt.GridBagConstraints; |
8 |
import java.awt.GridBagLayout; |
9 |
import java.awt.GridLayout; |
10 |
import java.awt.Insets; |
11 |
import java.awt.image.BufferedImage; |
12 |
import java.io.File; |
13 |
|
14 |
import javax.swing.BorderFactory; |
15 |
import javax.swing.ButtonGroup; |
16 |
import javax.swing.JButton; |
17 |
import javax.swing.JCheckBox; |
18 |
import javax.swing.JComboBox; |
19 |
import javax.swing.JFileChooser; |
20 |
import javax.swing.JLabel; |
21 |
import javax.swing.JPanel; |
22 |
import javax.swing.JRadioButton; |
23 |
import javax.swing.JTextArea; |
24 |
import javax.swing.JTextField; |
25 |
import javax.swing.filechooser.FileFilter; |
26 |
|
27 |
import sun.awt.HorizBagLayout; |
28 |
|
29 |
import com.iver.andami.PluginServices; |
30 |
import com.iver.andami.ui.mdiManager.IWindow; |
31 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
32 |
|
33 |
public class SelectTemplatePanel extends JPanel implements IWindow{ |
34 |
|
35 |
private JPanel jPanel2 = null; |
36 |
private JPanel jPanel3 = null; |
37 |
private JPanel jPanel4 = null; |
38 |
private JPanel jPanel = null; |
39 |
private JPanel jPanel1 = null; |
40 |
private JPanel jPanel5 = null; |
41 |
private JPanel jPanel6 = null; |
42 |
private JPanel jPanel7 = null; |
43 |
private JCheckBox checkGrid = null; |
44 |
private JCheckBox checkLegend = null; |
45 |
private JRadioButton rbWithOutLogo = null; |
46 |
private JRadioButton rbDefault = null; |
47 |
private JRadioButton rbImage = null; |
48 |
private JPanel jPanel8 = null; |
49 |
private JTextField txtScale = null; |
50 |
private JPanel jPanel9 = null; |
51 |
private JTextField txtGrid = null; |
52 |
private JPanel jPanel10 = null; |
53 |
private JComboBox cmbLegend = null; |
54 |
private JTextField txtImage = null; |
55 |
private JButton bImage = null; |
56 |
private JPanel jPanel11 = null; |
57 |
private JButton bOk = null; |
58 |
private JButton bPrevView = null; |
59 |
private JButton bCancel = null; |
60 |
private JTextArea txtATitle = null; |
61 |
private JPanel jPanel12 = null; |
62 |
private JLabel lblFormat = null; |
63 |
private JComboBox cmbFormat = null; |
64 |
private JPanel jPanel13 = null; |
65 |
private JLabel lblOrientation = null; |
66 |
private JComboBox cmbOrientation = null; |
67 |
private JLabel lblCopies = null; |
68 |
private JTextField txtCopies = null; |
69 |
private ModelTemplatePanel model;
|
70 |
private ButtonGroup group=new ButtonGroup(); |
71 |
private JCheckBox chbScale = null; |
72 |
|
73 |
/**
|
74 |
* This is the default constructor
|
75 |
*/
|
76 |
public SelectTemplatePanel(ModelTemplatePanel model) {
|
77 |
super();
|
78 |
this.model=model;
|
79 |
initialize(); |
80 |
} |
81 |
|
82 |
/**
|
83 |
* This method initializes this
|
84 |
*
|
85 |
* @return void
|
86 |
*/
|
87 |
private void initialize() { |
88 |
BorderLayout layout = new BorderLayout(); |
89 |
layout.setHgap(5);
|
90 |
layout.setVgap(5);
|
91 |
this.setLayout(layout);
|
92 |
|
93 |
this.add(getMainPanel(), BorderLayout.CENTER); |
94 |
|
95 |
this.add(getAcceptCancelPanel(), BorderLayout.SOUTH); |
96 |
|
97 |
// constraints.anchor = GridBagConstraints.SOUTH;
|
98 |
// constraints.fill = GridBagConstraints.HORIZONTAL;
|
99 |
// this.add(getAcceptCancelPanel(), constraints);
|
100 |
|
101 |
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* This method initializes jPanel2
|
106 |
*
|
107 |
* @return javax.swing.JPanel
|
108 |
*/
|
109 |
private JPanel getAcceptCancelPanel() { |
110 |
if (jPanel2 == null) { |
111 |
jPanel2 = new JPanel(); |
112 |
jPanel2.add(getBPrevView(), null);
|
113 |
jPanel2.add(getBOk(), null);
|
114 |
jPanel2.add(getBCancel(), null);
|
115 |
} |
116 |
return jPanel2;
|
117 |
} |
118 |
|
119 |
/**
|
120 |
* This method initializes jPanel3
|
121 |
*
|
122 |
* @return javax.swing.JPanel
|
123 |
*/
|
124 |
private JPanel getPrintingPanel() { |
125 |
if (jPanel3 == null) { |
126 |
GridLayout gridLayout6 = new GridLayout(); |
127 |
gridLayout6.setRows(2);
|
128 |
jPanel3 = new JPanel(); |
129 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"impresora"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
130 |
jPanel3.setLayout(gridLayout6); |
131 |
jPanel3.add(getJPanel12(), null);
|
132 |
jPanel3.add(getJPanel13(), null);
|
133 |
} |
134 |
return jPanel3;
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* This method initializes jPanel4
|
139 |
*
|
140 |
* @return javax.swing.JPanel
|
141 |
*/
|
142 |
private JPanel getMainPanel() { |
143 |
if (jPanel4 == null) { |
144 |
jPanel4 = new JPanel(new GridBagLayout()); |
145 |
GridBagConstraints constraints = new GridBagConstraints(); |
146 |
constraints.gridx = 0;
|
147 |
constraints.insets = new Insets(5, 5, 5, 5); |
148 |
constraints.anchor = GridBagConstraints.NORTH;
|
149 |
constraints.fill = GridBagConstraints.HORIZONTAL;
|
150 |
constraints.weightx = 1.0;
|
151 |
jPanel4.add(getPrintingPanel(), constraints); |
152 |
|
153 |
constraints.anchor = GridBagConstraints.NORTH;
|
154 |
constraints.fill = GridBagConstraints.BOTH;
|
155 |
constraints.weighty = 1.0;
|
156 |
jPanel4.add(getViewTitlePanel(), constraints); |
157 |
|
158 |
constraints.anchor = GridBagConstraints.NORTH;
|
159 |
constraints.fill = GridBagConstraints.BOTH;
|
160 |
constraints.weighty = 0.0;
|
161 |
jPanel4.add(getOptionsPanel(), constraints); |
162 |
|
163 |
constraints.anchor = GridBagConstraints.NORTH;
|
164 |
constraints.fill = GridBagConstraints.BOTH;
|
165 |
jPanel4.add(getLogoPanel(), constraints); |
166 |
} |
167 |
return jPanel4;
|
168 |
} |
169 |
|
170 |
/**
|
171 |
* This method initializes jPanel5
|
172 |
*
|
173 |
* @return javax.swing.JPanel
|
174 |
*/
|
175 |
private JPanel getViewTitlePanel() { |
176 |
if (jPanel5 == null) { |
177 |
GridBagLayout layout = new GridBagLayout(); |
178 |
jPanel5 = new JPanel(layout); |
179 |
|
180 |
GridBagConstraints constraints = new GridBagConstraints(); |
181 |
constraints.fill = GridBagConstraints.BOTH;
|
182 |
constraints.weightx = 1.0;
|
183 |
constraints.weighty = 1.0;
|
184 |
constraints.insets = new Insets(4, 4, 4, 4); |
185 |
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"titulo_vista"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
186 |
jPanel5.add(getTxtATitle(), constraints); |
187 |
} |
188 |
return jPanel5;
|
189 |
} |
190 |
|
191 |
/**
|
192 |
* This method initializes jPanel6
|
193 |
*
|
194 |
* @return javax.swing.JPanel
|
195 |
*/
|
196 |
private JPanel getOptionsPanel() { |
197 |
if (jPanel6 == null) { |
198 |
GridBagLayout gridLayout = new GridBagLayout(); |
199 |
GridBagConstraints constraints = new GridBagConstraints(); |
200 |
constraints.fill = GridBagConstraints.HORIZONTAL;
|
201 |
constraints.gridx = 0;
|
202 |
constraints.weightx = 1.0;
|
203 |
constraints.insets = new Insets(5,5,5,5); |
204 |
jPanel6 = new JPanel(); |
205 |
jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"Options"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
206 |
jPanel6.setLayout(gridLayout); |
207 |
jPanel6.add(getJPanel10(), constraints); |
208 |
jPanel6.add(getJPanel9(), constraints); |
209 |
jPanel6.add(getJPanel8(), constraints); |
210 |
} |
211 |
return jPanel6;
|
212 |
} |
213 |
|
214 |
/**
|
215 |
* This method initializes jPanel7
|
216 |
*
|
217 |
* @return javax.swing.JPanel
|
218 |
*/
|
219 |
private JPanel getLogoPanel() { |
220 |
if (jPanel7 == null) { |
221 |
GridLayout gridLayout1 = new GridLayout(); |
222 |
gridLayout1.setRows(3);
|
223 |
|
224 |
jPanel7 = new JPanel(new GridBagLayout()); |
225 |
jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"Image"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
226 |
|
227 |
GridBagConstraints constraints = new GridBagConstraints(); |
228 |
constraints.fill = GridBagConstraints.HORIZONTAL;
|
229 |
constraints.gridx = 0;
|
230 |
constraints.weightx = 1.0;
|
231 |
constraints.insets = new Insets(5,5,5,5); |
232 |
|
233 |
jPanel7.add(getRbWithOutLogo(), constraints); |
234 |
jPanel7.add(getRbDefault(), constraints); |
235 |
jPanel7.add(getJPanel11(), constraints); |
236 |
} |
237 |
return jPanel7;
|
238 |
} |
239 |
|
240 |
/**
|
241 |
* This method initializes checkGrid
|
242 |
*
|
243 |
* @return javax.swing.JCheckBox
|
244 |
*/
|
245 |
private JCheckBox getCheckGrid() { |
246 |
if (checkGrid == null) { |
247 |
checkGrid = new JCheckBox(); |
248 |
checkGrid.setText(PluginServices.getText(this,"mostrar_cuadricula")); |
249 |
checkGrid.addActionListener(new java.awt.event.ActionListener() {
|
250 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
251 |
if (checkGrid.isSelected()){
|
252 |
getTxtGrid().setEditable(true);
|
253 |
}else{
|
254 |
getTxtGrid().setEditable(false);
|
255 |
} |
256 |
} |
257 |
}); |
258 |
} |
259 |
return checkGrid;
|
260 |
} |
261 |
|
262 |
/**
|
263 |
* This method initializes checkLegend
|
264 |
*
|
265 |
* @return javax.swing.JCheckBox
|
266 |
*/
|
267 |
private JCheckBox getCheckLegend() { |
268 |
if (checkLegend == null) { |
269 |
checkLegend = new JCheckBox(); |
270 |
checkLegend.setText(PluginServices.getText(this,"mostrar_leyenda")); |
271 |
// checkLegend.addActionListener(new java.awt.event.ActionListener() {
|
272 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
273 |
// if (checkLegend.isSelected()){
|
274 |
// getCmbLegend().setEnabled(true);
|
275 |
// }else{
|
276 |
// getCmbLegend().setEnabled(false);
|
277 |
// }
|
278 |
// }
|
279 |
// });
|
280 |
} |
281 |
return checkLegend;
|
282 |
} |
283 |
|
284 |
/**
|
285 |
* This method initializes rbWithOutLogo
|
286 |
*
|
287 |
* @return javax.swing.JRadioButton
|
288 |
*/
|
289 |
private JRadioButton getRbWithOutLogo() { |
290 |
if (rbWithOutLogo == null) { |
291 |
rbWithOutLogo = new JRadioButton(); |
292 |
group.add(rbWithOutLogo); |
293 |
if (model.getLogo()==ModelTemplatePanel.WITHOUTLOGO){
|
294 |
rbWithOutLogo.setSelected(true);
|
295 |
} |
296 |
rbWithOutLogo.setText(PluginServices.getText(this,"sin_logo")); |
297 |
rbWithOutLogo.setPreferredSize(new java.awt.Dimension(73,20)); |
298 |
rbWithOutLogo.addActionListener(new java.awt.event.ActionListener() {
|
299 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
300 |
if (rbWithOutLogo.isSelected()){
|
301 |
getTxtImage().setEnabled(false);
|
302 |
getBImage().setEnabled(false);
|
303 |
} |
304 |
} |
305 |
}); |
306 |
} |
307 |
return rbWithOutLogo;
|
308 |
} |
309 |
|
310 |
/**
|
311 |
* This method initializes rbDefault
|
312 |
*
|
313 |
* @return javax.swing.JRadioButton
|
314 |
*/
|
315 |
private JRadioButton getRbDefault() { |
316 |
if (rbDefault == null) { |
317 |
rbDefault = new JRadioButton(); |
318 |
group.add(rbDefault); |
319 |
if (model.getLogo()==ModelTemplatePanel.DEFAULT){
|
320 |
rbDefault.setSelected(true);
|
321 |
} |
322 |
rbDefault.setText(PluginServices.getText(this,"por_defecto")); |
323 |
rbDefault.setPreferredSize(new java.awt.Dimension(94,20)); |
324 |
rbDefault.addActionListener(new java.awt.event.ActionListener() {
|
325 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
326 |
if (rbDefault.isSelected()){
|
327 |
getTxtImage().setEnabled(false);
|
328 |
getBImage().setEnabled(false);
|
329 |
} |
330 |
} |
331 |
}); |
332 |
} |
333 |
return rbDefault;
|
334 |
} |
335 |
|
336 |
/**
|
337 |
* This method initializes rbImage
|
338 |
*
|
339 |
* @return javax.swing.JRadioButton
|
340 |
*/
|
341 |
private JRadioButton getRbImage() { |
342 |
if (rbImage == null) { |
343 |
rbImage = new JRadioButton(); |
344 |
group.add(rbImage); |
345 |
if (model.getLogo()==ModelTemplatePanel.IMAGE){
|
346 |
rbImage.setSelected(true);
|
347 |
} |
348 |
rbImage.setText(PluginServices.getText(this,"imagen")); |
349 |
rbImage.setPreferredSize(new java.awt.Dimension(67,20)); |
350 |
rbImage.addActionListener(new java.awt.event.ActionListener() {
|
351 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
352 |
if (rbImage.isSelected()){
|
353 |
getTxtImage().setEnabled(true);
|
354 |
getBImage().setEnabled(true);
|
355 |
} |
356 |
} |
357 |
}); |
358 |
} |
359 |
return rbImage;
|
360 |
} |
361 |
|
362 |
/**
|
363 |
* This method initializes jPanel8
|
364 |
*
|
365 |
* @return javax.swing.JPanel
|
366 |
*/
|
367 |
private JPanel getJPanel8() { |
368 |
if (jPanel8 == null) { |
369 |
jPanel8 = new JPanel(); |
370 |
jPanel8.setLayout(new BorderLayout()); |
371 |
|
372 |
jPanel8.add(getChbScale(), java.awt.BorderLayout.WEST); |
373 |
FlowLayout layout = new FlowLayout(FlowLayout.LEFT, 0, 0); |
374 |
JPanel panel = new JPanel(layout); |
375 |
panel.add(new JLabel("1:")); |
376 |
panel.add(getTxtScale()); |
377 |
jPanel8.add(panel, java.awt.BorderLayout.EAST); |
378 |
} |
379 |
return jPanel8;
|
380 |
} |
381 |
|
382 |
/**
|
383 |
* This method initializes txtScale
|
384 |
*
|
385 |
* @return javax.swing.JTextField
|
386 |
*/
|
387 |
private JTextField getTxtScale() { |
388 |
if (txtScale == null) { |
389 |
txtScale = new JTextField(); |
390 |
txtScale.setText(String.valueOf(model.getScale()));
|
391 |
if (!model.isForceScale()){
|
392 |
txtScale.setEditable(false);
|
393 |
} |
394 |
txtScale.setPreferredSize(new java.awt.Dimension(80,20)); |
395 |
} |
396 |
return txtScale;
|
397 |
} |
398 |
|
399 |
/**
|
400 |
* This method initializes jPanel9
|
401 |
*
|
402 |
* @return javax.swing.JPanel
|
403 |
*/
|
404 |
private JPanel getJPanel9() { |
405 |
if (jPanel9 == null) { |
406 |
jPanel9 = new JPanel(); |
407 |
jPanel9.setLayout(new BorderLayout()); |
408 |
jPanel9.add(getCheckGrid(), java.awt.BorderLayout.WEST); |
409 |
jPanel9.add(getTxtGrid(), java.awt.BorderLayout.EAST); |
410 |
} |
411 |
return jPanel9;
|
412 |
} |
413 |
|
414 |
/**
|
415 |
* This method initializes txtGrid
|
416 |
*
|
417 |
* @return javax.swing.JTextField
|
418 |
*/
|
419 |
private JTextField getTxtGrid() { |
420 |
if (txtGrid == null) { |
421 |
txtGrid = new JTextField(); |
422 |
txtGrid.setText(String.valueOf(model.getGrid()));
|
423 |
if (!model.isGrid()){
|
424 |
txtGrid.setEditable(false);
|
425 |
} |
426 |
txtGrid.setPreferredSize(new java.awt.Dimension(80,20)); |
427 |
} |
428 |
return txtGrid;
|
429 |
} |
430 |
|
431 |
/**
|
432 |
* This method initializes jPanel10
|
433 |
*
|
434 |
* @return javax.swing.JPanel
|
435 |
*/
|
436 |
private JPanel getJPanel10() { |
437 |
if (jPanel10 == null) { |
438 |
jPanel10 = new JPanel(); |
439 |
jPanel10.setLayout(new BorderLayout()); |
440 |
jPanel10.add(getCheckLegend(), java.awt.BorderLayout.WEST); |
441 |
// commented out: currently is not possible to customize legend size in maps
|
442 |
//jPanel10.add(getCmbLegend(), java.awt.BorderLayout.EAST);
|
443 |
jPanel10.add(new JPanel(), java.awt.BorderLayout.EAST); |
444 |
} |
445 |
return jPanel10;
|
446 |
} |
447 |
|
448 |
/**
|
449 |
* This method initializes cmbLegend
|
450 |
*
|
451 |
* @return javax.swing.JComboBox
|
452 |
*/
|
453 |
// private JComboBox getCmbLegend() {
|
454 |
// if (cmbLegend == null) {
|
455 |
// cmbLegend = new JComboBox(ModelTemplatePanel.sizeFont);
|
456 |
// if (!model.isLegend()){
|
457 |
// cmbLegend.setEnabled(false);
|
458 |
// }
|
459 |
// cmbLegend.setSelectedItem(new Integer(model.getLegend()));
|
460 |
// cmbLegend.setPreferredSize(new java.awt.Dimension(80,20));
|
461 |
// }
|
462 |
// return cmbLegend;
|
463 |
// }
|
464 |
|
465 |
/**
|
466 |
* This method initializes txtImage
|
467 |
*
|
468 |
* @return javax.swing.JTextField
|
469 |
*/
|
470 |
private JTextField getTxtImage() { |
471 |
if (txtImage == null) { |
472 |
txtImage = new JTextField(); |
473 |
txtImage.setText(model.getImage()); |
474 |
if (!getRbImage().isSelected()){
|
475 |
txtImage.setEnabled(false);
|
476 |
} |
477 |
txtImage.setPreferredSize(new java.awt.Dimension(220,20)); |
478 |
} |
479 |
return txtImage;
|
480 |
} |
481 |
|
482 |
/**
|
483 |
* This method initializes bImage
|
484 |
*
|
485 |
* @return javax.swing.JButton
|
486 |
*/
|
487 |
private JButton getBImage() { |
488 |
if (bImage == null) { |
489 |
bImage = new JButton(); |
490 |
bImage.setPreferredSize(new java.awt.Dimension(34,20)); |
491 |
bImage.setText("...");
|
492 |
if (!getRbImage().isSelected()){
|
493 |
bImage.setEnabled(false);
|
494 |
} |
495 |
bImage.addActionListener(new java.awt.event.ActionListener() {
|
496 |
private String lastPath; |
497 |
|
498 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
499 |
JFileChooser fileChooser=new JFileChooser(); |
500 |
fileChooser.setFileFilter(new FileFilter(){ |
501 |
|
502 |
public boolean accept(File f) { |
503 |
String path=f.getAbsolutePath();
|
504 |
return path.toLowerCase().endsWith(".bmp") || path.toLowerCase().endsWith(".png") || path.toLowerCase().endsWith(".jpg") || path.toLowerCase().endsWith(".jpeg"); |
505 |
} |
506 |
|
507 |
public String getDescription() { |
508 |
return PluginServices.getText(this,"imagenes"); |
509 |
} |
510 |
|
511 |
}); |
512 |
if (fileChooser.showOpenDialog(
|
513 |
(Component) PluginServices.getMainFrame()
|
514 |
) == JFileChooser.APPROVE_OPTION) {
|
515 |
BufferedImage tempImage;
|
516 |
|
517 |
File f = fileChooser.getSelectedFile();
|
518 |
|
519 |
lastPath = f.getParent(); |
520 |
|
521 |
getTxtImage().setText(f.getAbsolutePath()); |
522 |
} |
523 |
|
524 |
} |
525 |
}); |
526 |
} |
527 |
return bImage;
|
528 |
} |
529 |
|
530 |
/**
|
531 |
* This method initializes jPanel11
|
532 |
*
|
533 |
* @return javax.swing.JPanel
|
534 |
*/
|
535 |
private JPanel getJPanel11() { |
536 |
if (jPanel11 == null) { |
537 |
jPanel11 = new JPanel(); |
538 |
FlowLayout layout = new FlowLayout(FlowLayout.LEADING, 0, 0); |
539 |
jPanel11.setLayout(layout); |
540 |
jPanel11.add(getRbImage()); |
541 |
JPanel panel = new JPanel(); |
542 |
panel.add(getTxtImage()); |
543 |
panel.add(getBImage()); |
544 |
jPanel11.add(panel); |
545 |
} |
546 |
return jPanel11;
|
547 |
} |
548 |
|
549 |
/**
|
550 |
* This method initializes bOk
|
551 |
*
|
552 |
* @return javax.swing.JButton
|
553 |
*/
|
554 |
private JButton getBOk() { |
555 |
if (bOk == null) { |
556 |
bOk = new JButton(); |
557 |
bOk.setText(PluginServices.getText(this,"Aceptar")); |
558 |
bOk.addActionListener(new java.awt.event.ActionListener() {
|
559 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
560 |
model.setCopies(Integer.parseInt(getTxtCopies().getText()));
|
561 |
model.setFormat((String)getCmbFormat().getSelectedItem());
|
562 |
model.setOrientation((String)getCmbOrientation().getSelectedItem());
|
563 |
model.setTitle(getTxtATitle().getText()); |
564 |
model.setLegend(getCheckLegend().isSelected()); |
565 |
model.setGrid(getCheckGrid().isSelected()); |
566 |
model.setScale(Double.parseDouble(getTxtScale().getText()));
|
567 |
model.setGrid(Double.parseDouble(getTxtGrid().getText()));
|
568 |
// model.setLegend(((Integer)getCmbLegend().getSelectedItem()).intValue());
|
569 |
model.forceScale(getChbScale().isSelected()); |
570 |
if (getRbWithOutLogo().isSelected()){
|
571 |
model.setLogo(ModelTemplatePanel.WITHOUTLOGO); |
572 |
}else if (getRbDefault().isSelected()){ |
573 |
model.setLogo(ModelTemplatePanel.DEFAULT); |
574 |
}else if (getRbImage().isSelected()){ |
575 |
model.setLogo(ModelTemplatePanel.IMAGE); |
576 |
model.setImage(getTxtImage().getText()); |
577 |
} |
578 |
model.printReport(); |
579 |
PluginServices.getMDIManager().closeWindow(SelectTemplatePanel.this); |
580 |
} |
581 |
}); |
582 |
} |
583 |
return bOk;
|
584 |
} |
585 |
|
586 |
/**
|
587 |
* This method initializes bPrevView
|
588 |
*
|
589 |
* @return javax.swing.JButton
|
590 |
*/
|
591 |
private JButton getBPrevView() { |
592 |
if (bPrevView == null) { |
593 |
bPrevView = new JButton(); |
594 |
bPrevView.setText(PluginServices.getText(this,"vista_previa")); |
595 |
bPrevView.addActionListener(new java.awt.event.ActionListener() {
|
596 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
597 |
model.setCopies(Integer.parseInt(getTxtCopies().getText()));
|
598 |
model.setFormat((String)getCmbFormat().getSelectedItem());
|
599 |
model.setOrientation((String)getCmbOrientation().getSelectedItem());
|
600 |
model.setTitle(getTxtATitle().getText()); |
601 |
model.setLegend(getCheckLegend().isSelected()); |
602 |
model.setGrid(getCheckGrid().isSelected()); |
603 |
model.setScale(Double.parseDouble(getTxtScale().getText()));
|
604 |
model.setGrid(Double.parseDouble(getTxtGrid().getText()));
|
605 |
model.forceScale(getChbScale().isSelected()); |
606 |
// model.setLegend(((Integer)getCmbLegend().getSelectedItem()).intValue());
|
607 |
if (getRbWithOutLogo().isSelected()){
|
608 |
model.setLogo(ModelTemplatePanel.WITHOUTLOGO); |
609 |
}else if (getRbDefault().isSelected()){ |
610 |
model.setLogo(ModelTemplatePanel.DEFAULT); |
611 |
}else if (getRbImage().isSelected()){ |
612 |
model.setLogo(ModelTemplatePanel.IMAGE); |
613 |
model.setImage(getTxtImage().getText()); |
614 |
} |
615 |
model.openReport(); |
616 |
} |
617 |
}); |
618 |
} |
619 |
return bPrevView;
|
620 |
} |
621 |
|
622 |
/**
|
623 |
* This method initializes bCancel
|
624 |
*
|
625 |
* @return javax.swing.JButton
|
626 |
*/
|
627 |
private JButton getBCancel() { |
628 |
if (bCancel == null) { |
629 |
bCancel = new JButton(); |
630 |
bCancel.setText(PluginServices.getText(this,"Cancelar")); |
631 |
bCancel.addActionListener(new java.awt.event.ActionListener() {
|
632 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
633 |
PluginServices.getMDIManager().closeWindow(SelectTemplatePanel.this); |
634 |
} |
635 |
}); |
636 |
} |
637 |
return bCancel;
|
638 |
} |
639 |
|
640 |
/**
|
641 |
* This method initializes txtATitle
|
642 |
*
|
643 |
* @return javax.swing.JTextArea
|
644 |
*/
|
645 |
private JTextArea getTxtATitle() { |
646 |
if (txtATitle == null) { |
647 |
txtATitle = new JTextArea(); |
648 |
txtATitle.setText(model.getTitle()); |
649 |
txtATitle.setRows(2);
|
650 |
txtATitle.setName("txtATitle");
|
651 |
txtATitle.setBorder(getTxtScale().getBorder()); |
652 |
} |
653 |
return txtATitle;
|
654 |
} |
655 |
|
656 |
/**
|
657 |
* This method initializes jPanel12
|
658 |
*
|
659 |
* @return javax.swing.JPanel
|
660 |
*/
|
661 |
private JPanel getJPanel12() { |
662 |
if (jPanel12 == null) { |
663 |
lblCopies = new JLabel(); |
664 |
lblCopies.setText(PluginServices.getText(this,"copias")); |
665 |
lblFormat = new JLabel(); |
666 |
lblFormat.setText(PluginServices.getText(this,"formatos")); |
667 |
jPanel12 = new JPanel(); |
668 |
jPanel12.add(lblFormat, null);
|
669 |
jPanel12.add(getCmbFormat(), null);
|
670 |
jPanel12.add(lblCopies, null);
|
671 |
jPanel12.add(getTxtCopies(), null);
|
672 |
} |
673 |
return jPanel12;
|
674 |
} |
675 |
|
676 |
/**
|
677 |
* This method initializes cmbFormat
|
678 |
*
|
679 |
* @return javax.swing.JComboBox
|
680 |
*/
|
681 |
private JComboBox getCmbFormat() { |
682 |
if (cmbFormat == null) { |
683 |
cmbFormat = new JComboBox(); |
684 |
for (int i = 0; i <ModelTemplatePanel.formats.length; i++) { |
685 |
cmbFormat.addItem(ModelTemplatePanel.formats[i]); |
686 |
} |
687 |
cmbFormat.setSelectedItem(model.getFormat()); |
688 |
cmbFormat.setPreferredSize(new java.awt.Dimension(100,20)); |
689 |
} |
690 |
return cmbFormat;
|
691 |
} |
692 |
|
693 |
/**
|
694 |
* This method initializes jPanel13
|
695 |
*
|
696 |
* @return javax.swing.JPanel
|
697 |
*/
|
698 |
private JPanel getJPanel13() { |
699 |
if (jPanel13 == null) { |
700 |
lblOrientation = new JLabel(); |
701 |
lblOrientation.setText(PluginServices.getText(this,"orientacion")); |
702 |
jPanel13 = new JPanel(); |
703 |
jPanel13.add(lblOrientation, null);
|
704 |
jPanel13.add(getCmbOrientation(), null);
|
705 |
} |
706 |
return jPanel13;
|
707 |
} |
708 |
|
709 |
/**
|
710 |
* This method initializes cmbOrientation
|
711 |
*
|
712 |
* @return javax.swing.JComboBox
|
713 |
*/
|
714 |
private JComboBox getCmbOrientation() { |
715 |
if (cmbOrientation == null) { |
716 |
cmbOrientation = new JComboBox(); |
717 |
cmbOrientation.addItem(PluginServices.getText(this,"horizontal")); |
718 |
cmbOrientation.addItem(PluginServices.getText(this,"vertical")); |
719 |
cmbOrientation.setSelectedItem(model.getOrientation()); |
720 |
cmbOrientation.setPreferredSize(new java.awt.Dimension(100,20)); |
721 |
} |
722 |
return cmbOrientation;
|
723 |
} |
724 |
|
725 |
/**
|
726 |
* This method initializes txtCopies
|
727 |
*
|
728 |
* @return javax.swing.JTextField
|
729 |
*/
|
730 |
private JTextField getTxtCopies() { |
731 |
if (txtCopies == null) { |
732 |
txtCopies = new JTextField(); |
733 |
txtCopies.setText(String.valueOf(model.getCopies()));
|
734 |
txtCopies.setPreferredSize(new java.awt.Dimension(50,20)); |
735 |
} |
736 |
return txtCopies;
|
737 |
} |
738 |
|
739 |
public WindowInfo getWindowInfo() {
|
740 |
WindowInfo wi=new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE);
|
741 |
wi.setWidth(420);
|
742 |
wi.setHeight(460);
|
743 |
wi.setTitle(PluginServices.getText(this,"configuracion_impresion")); |
744 |
return wi;
|
745 |
} |
746 |
|
747 |
/**
|
748 |
* This method initializes chbScale
|
749 |
*
|
750 |
* @return javax.swing.JCheckBox
|
751 |
*/
|
752 |
private JCheckBox getChbScale() { |
753 |
if (chbScale == null) { |
754 |
chbScale = new JCheckBox(); |
755 |
chbScale.setSelected(model.isForceScale()); |
756 |
chbScale.setText(PluginServices.getText(this,"force_scale")); |
757 |
chbScale.addActionListener(new java.awt.event.ActionListener() {
|
758 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
759 |
if (chbScale.isSelected()){
|
760 |
getTxtScale().setEditable(true);
|
761 |
}else{
|
762 |
getTxtScale().setEditable(false);
|
763 |
} |
764 |
} |
765 |
}); |
766 |
} |
767 |
return chbScale;
|
768 |
} |
769 |
|
770 |
public Object getWindowProfile() { |
771 |
return WindowInfo.DIALOG_PROFILE;
|
772 |
} |
773 |
|
774 |
} // @jve:decl-index=0:visual-constraint="10,10"
|