Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / dialogs / Tag.java @ 1074

History | View | Annotate | Download (2.78 KB)

1
package com.iver.cit.gvsig.gui.layout.dialogs;
2

    
3
import com.iver.andami.PluginServices;
4
import com.iver.andami.ui.mdiManager.View;
5
import com.iver.andami.ui.mdiManager.ViewInfo;
6

    
7
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
8

    
9
import javax.swing.JButton;
10
import javax.swing.JLabel;
11
import javax.swing.JPanel;
12
import javax.swing.JTextField;
13

    
14

    
15
/**
16
 * Di?logo para insertar o modificar el Tag asociado a un FFrame.
17
 *
18
 * @author Vicente Caballero Navarro
19
 */
20
public class Tag extends JPanel implements View {
21
        private JTextField jTextField = null;
22
        private JLabel jLabel = null;
23
        private JButton jButton = null;
24
        private JButton jButton1 = null;
25
        private IFFrame fframe = null;
26

    
27
        /**
28
         * This is the default constructor
29
         *
30
         * @param f FFrame al que asociar el Tag.
31
         */
32
        public Tag(IFFrame f) {
33
                super();
34
                fframe = f;
35
                initialize();
36
        }
37

    
38
        /**
39
         * This method initializes jTextField
40
         *
41
         * @return javax.swing.JTextField
42
         */
43
        private JTextField getJTextField() {
44
                if (jTextField == null) {
45
                        jTextField = new JTextField();
46

    
47
                        if (fframe.getTag() != null) {
48
                                jTextField.setText(fframe.getTag());
49
                        }
50

    
51
                        jTextField.setPreferredSize(new java.awt.Dimension(200, 20));
52
                }
53

    
54
                return jTextField;
55
        }
56

    
57
        /**
58
         * This method initializes jButton
59
         *
60
         * @return javax.swing.JButton
61
         */
62
        private JButton getJButton() {
63
                if (jButton == null) {
64
                        jButton = new JButton();
65
                        jButton.setText("Aceptar");
66
                        jButton.addActionListener(new java.awt.event.ActionListener() {
67
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
68
                                                if (getJTextField().getText().compareTo("") == 0) {
69
                                                        fframe.setTag(null);
70
                                                } else {
71
                                                        fframe.setTag(getJTextField().getText());
72
                                                }
73

    
74
                                                PluginServices.getMDIManager().closeView(Tag.this);
75
                                        }
76
                                });
77
                }
78

    
79
                return jButton;
80
        }
81

    
82
        /**
83
         * This method initializes jButton1
84
         *
85
         * @return javax.swing.JButton
86
         */
87
        private JButton getJButton1() {
88
                if (jButton1 == null) {
89
                        jButton1 = new JButton();
90
                        jButton1.setText("Cancelar");
91
                        jButton1.addActionListener(new java.awt.event.ActionListener() {
92
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
93
                                                PluginServices.getMDIManager().closeView(Tag.this);
94
                                        }
95
                                });
96
                }
97

    
98
                return jButton1;
99
        }
100

    
101
        /**
102
         * This method initializes this
103
         */
104
        private void initialize() {
105
                jLabel = new JLabel();
106
                this.setSize(267, 72);
107
                jLabel.setText("tag");
108
                this.add(jLabel, null);
109
                this.add(getJTextField(), null);
110
                this.add(getJButton(), null);
111
                this.add(getJButton1(), null);
112
        }
113

    
114
        /**
115
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
116
         */
117
        public ViewInfo getViewInfo() {
118
                ViewInfo m_viewinfo = new ViewInfo();
119
                m_viewinfo.setTitle(PluginServices.getText(this, "tag"));
120

    
121
                return m_viewinfo;
122
        }
123

    
124
        /**
125
         * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
126
         */
127
        public void viewActivated() {
128
        }
129
}