Statistics
| Revision:

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

History | View | Annotate | Download (3.97 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.layout.dialogs;
42

    
43
import com.iver.andami.PluginServices;
44
import com.iver.andami.ui.mdiManager.View;
45
import com.iver.andami.ui.mdiManager.ViewInfo;
46

    
47
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
48

    
49
import javax.swing.JButton;
50
import javax.swing.JLabel;
51
import javax.swing.JPanel;
52
import javax.swing.JTextField;
53

    
54

    
55
/**
56
 * Di?logo para insertar o modificar el Tag asociado a un FFrame.
57
 *
58
 * @author Vicente Caballero Navarro
59
 */
60
public class Tag extends JPanel implements View {
61
        private JTextField jTextField = null;
62
        private JLabel jLabel = null;
63
        private JButton jButton = null;
64
        private JButton jButton1 = null;
65
        private IFFrame fframe = null;
66

    
67
        /**
68
         * This is the default constructor
69
         *
70
         * @param f FFrame al que asociar el Tag.
71
         */
72
        public Tag(IFFrame f) {
73
                super();
74
                fframe = f;
75
                initialize();
76
        }
77

    
78
        /**
79
         * This method initializes jTextField
80
         *
81
         * @return javax.swing.JTextField
82
         */
83
        private JTextField getJTextField() {
84
                if (jTextField == null) {
85
                        jTextField = new JTextField();
86

    
87
                        if (fframe.getTag() != null) {
88
                                jTextField.setText(fframe.getTag());
89
                        }
90

    
91
                        jTextField.setPreferredSize(new java.awt.Dimension(200, 20));
92
                }
93

    
94
                return jTextField;
95
        }
96

    
97
        /**
98
         * This method initializes jButton
99
         *
100
         * @return javax.swing.JButton
101
         */
102
        private JButton getJButton() {
103
                if (jButton == null) {
104
                        jButton = new JButton();
105
                        jButton.setText("Aceptar");
106
                        jButton.addActionListener(new java.awt.event.ActionListener() {
107
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
108
                                                if (getJTextField().getText().compareTo("") == 0) {
109
                                                        fframe.setTag(null);
110
                                                } else {
111
                                                        fframe.setTag(getJTextField().getText());
112
                                                }
113

    
114
                                                PluginServices.getMDIManager().closeView(Tag.this);
115
                                        }
116
                                });
117
                }
118

    
119
                return jButton;
120
        }
121

    
122
        /**
123
         * This method initializes jButton1
124
         *
125
         * @return javax.swing.JButton
126
         */
127
        private JButton getJButton1() {
128
                if (jButton1 == null) {
129
                        jButton1 = new JButton();
130
                        jButton1.setText("Cancelar");
131
                        jButton1.addActionListener(new java.awt.event.ActionListener() {
132
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
133
                                                PluginServices.getMDIManager().closeView(Tag.this);
134
                                        }
135
                                });
136
                }
137

    
138
                return jButton1;
139
        }
140

    
141
        /**
142
         * This method initializes this
143
         */
144
        private void initialize() {
145
                jLabel = new JLabel();
146
                this.setSize(284, 100);
147
                jLabel.setText("tag");
148
                this.add(jLabel, null);
149
                this.add(getJTextField(), null);
150
                this.add(getJButton(), null);
151
                this.add(getJButton1(), null);
152
        }
153

    
154
        /**
155
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
156
         */
157
        public ViewInfo getViewInfo() {
158
                ViewInfo m_viewinfo = new ViewInfo();
159
                m_viewinfo.setTitle(PluginServices.getText(this, "tag"));
160

    
161
                return m_viewinfo;
162
        }
163

    
164
        /**
165
         * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
166
         */
167
        public void viewActivated() {
168
        }
169
}