Statistics
| Revision:

svn-gvsig-desktop / trunk / examples / exaTemplateLayout / src / com / iver / templateLayout / AskOne.java @ 9591

History | View | Annotate | Download (2.68 KB)

1
package com.iver.templateLayout;
2

    
3
import javax.swing.JButton;
4
import javax.swing.JLabel;
5
import javax.swing.JPanel;
6

    
7
import com.iver.andami.PluginServices;
8
import com.iver.andami.ui.mdiManager.IWindow;
9
import com.iver.andami.ui.mdiManager.WindowInfo;
10
import com.iver.cit.gvsig.Print;
11
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
12

    
13

    
14
/**
15
 * Clase que extiende JPanel e implementa View para poder a?adirse como una
16
 * ventana m?s a la aplicaci?n.
17
 *
18
 *Es como un di?logo que consulta al usuario si se desea enviar una ficha en concreto a impresi?n.
19
 *
20
 * @author Vicente Caballero Navarro
21
 * 
22
 */
23
public class AskOne extends JPanel implements IWindow {
24
        private WindowInfo m_viewinfo = null;
25
        private Layout layout = null;
26
        private JLabel jLabel = null;
27
        private JButton jButton = null;
28
        private JButton jButton1 = null;
29

    
30
        /**
31
         * Constructor.
32
         *
33
         * @param l Layout que contiene la ficha actual.
34
         */
35
        public AskOne(Layout l) {
36
                super();
37
                layout = l;
38
                initialize();
39
        }
40

    
41
        /**
42
         * This method initializes this
43
         */
44
        private void initialize() {
45
                jLabel = new JLabel();
46
                this.setSize(198, 68);
47
                jLabel.setText(PluginServices.getText(this, "imprimir_ficha_actual"));
48
                this.add(jLabel, null);
49
                this.add(getJButton(), null);
50
                this.add(getJButton1(), null);
51
        }
52

    
53
        /**
54
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
55
         */
56
        public WindowInfo getWindowInfo() {
57
                if (m_viewinfo == null) {
58
                        m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
59
                        m_viewinfo.setTitle(PluginServices.getText(this, "uno"));
60
                }
61

    
62
                return m_viewinfo;
63
        }
64

    
65
        /**
66
         * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
67
         */
68
        public void viewActivated() {
69
        }
70

    
71
        /**
72
         * This method initializes jButton
73
         *
74
         * @return javax.swing.JButton
75
         */
76
        private JButton getJButton() {
77
                if (jButton == null) {
78
                        jButton = new JButton();
79
                        jButton.setText(PluginServices.getText(this, "aceptar"));
80
                        jButton.addActionListener(new java.awt.event.ActionListener() {
81
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
82
                                                Print printExtension = new Print();
83
                                                printExtension.OpenDialogToPrint(layout);
84
                                                PluginServices.getMDIManager().closeWindow(AskOne.this);
85
                                        }
86
                                });
87
                }
88

    
89
                return jButton;
90
        }
91

    
92
        /**
93
         * This method initializes jButton1
94
         *
95
         * @return javax.swing.JButton
96
         */
97
        private JButton getJButton1() {
98
                if (jButton1 == null) {
99
                        jButton1 = new JButton();
100
                        jButton1.setText(PluginServices.getText(this, "cancelar"));
101
                        jButton1.addActionListener(new java.awt.event.ActionListener() {
102
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
103
                                                PluginServices.getMDIManager().closeWindow(AskOne.this);
104
                                        }
105
                                });
106
                }
107

    
108
                return jButton1;
109
        }
110
} //  @jve:decl-index=0:visual-constraint="10,10"