Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / toc / ChangeName.java @ 2262

History | View | Annotate | Download (5.05 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.toc;
42

    
43

    
44
import javax.swing.JPanel;
45

    
46
import com.iver.andami.PluginServices;
47
import com.iver.andami.ui.mdiManager.View;
48
import com.iver.andami.ui.mdiManager.ViewInfo;
49

    
50

    
51
/**
52
 * Di?logo para cambiar el nombre de una capa.
53
 *
54
 * @author Vicente Caballero Navarro
55
 */
56
public class ChangeName extends JPanel implements View {
57
        private javax.swing.JPanel jContentPane = null;
58
        private javax.swing.JLabel lblName = null;
59
        private javax.swing.JTextField txtName = null;
60
        private javax.swing.JButton bAceptar = null;
61
        private javax.swing.JButton bCancelar = null;
62
        private String name;
63
        
64
        /**
65
         * This is the default constructor
66
         *
67
         * @param layout Referencia al Layout.
68
         * @param fframe Referencia al fframe de imagen.
69
         */
70
        public ChangeName(String n) {
71
                super();
72
                if (n==null){
73
                        name=PluginServices.getText(this, "agrupacion");
74
                }else{
75
                        name=n;
76
                }
77
                initialize();
78
        }
79

    
80
        /**
81
         * This method initializes this
82
         */
83
        private void initialize() {
84
                this.setLayout(null);
85
                this.add(getJContentPane(), null);
86
                this.setSize(381, 88);
87
        }
88

    
89
        /**
90
         * This method initializes jContentPane
91
         *
92
         * @return javax.swing.JPanel
93
         */
94
        private javax.swing.JPanel getJContentPane() {
95
                if (jContentPane == null) {
96
                        jContentPane = new javax.swing.JPanel();
97
                        jContentPane.setLayout(null);
98
                        jContentPane.add(getLblName(), null);
99
                        jContentPane.add(getTxtName(), null);
100
                        jContentPane.add(getBAceptar(), null);
101
                        jContentPane.add(getBCancelar(), null);
102
                        jContentPane.setSize(385, 86);
103
                        jContentPane.setLocation(0, 0);
104
                }
105

    
106
                return jContentPane;
107
        }
108

    
109
        /**
110
         * This method initializes lFichero
111
         *
112
         * @return javax.swing.JLabel
113
         */
114
        private javax.swing.JLabel getLblName() {
115
                if (lblName == null) {
116
                        lblName = new javax.swing.JLabel();
117
                        lblName.setSize(42, 20);
118
                        lblName.setText(PluginServices.getText(this, "nombre"));
119
                        lblName.setLocation(10, 9);
120
                }
121

    
122
                return lblName;
123
        }
124

    
125
        /**
126
         * This method initializes tFichero
127
         *
128
         * @return javax.swing.JTextField
129
         */
130
        private javax.swing.JTextField getTxtName() {
131
                if (txtName == null) {
132
                        txtName = new javax.swing.JTextField();
133
                        txtName.setBounds(62, 8, 280, 20);
134
                        txtName.setPreferredSize(new java.awt.Dimension(200, 20));
135
                        txtName.setText(name);
136
                }
137
                return txtName;
138
        }
139

    
140
        /**
141
         * Inserta el path al TFichero.
142
         *
143
         * @param val path del fichero.
144
         */
145
        public void setText(String val) {
146
                getTxtName().setText(val);
147
        }
148

    
149
        /**
150
         * This method initializes bAceptar
151
         *
152
         * @return javax.swing.JButton
153
         */
154
        private javax.swing.JButton getBAceptar() {
155
                if (bAceptar == null) {
156
                        bAceptar = new javax.swing.JButton();
157
                        bAceptar.setSize(85, 26);
158
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
159
                        bAceptar.addActionListener(new java.awt.event.ActionListener() { 
160
                                public void actionPerformed(java.awt.event.ActionEvent e) {    
161
                                        name=getTxtName().getText();
162
                                        PluginServices.getMDIManager().closeView(ChangeName.this);
163
                                }
164
                        });
165
                        bAceptar.setLocation(69, 44);
166
                        
167
                }
168

    
169
                return bAceptar;
170
        }
171

    
172
        /**
173
         * This method initializes bCancelar
174
         *
175
         * @return javax.swing.JButton
176
         */
177
        private javax.swing.JButton getBCancelar() {
178
                if (bCancelar == null) {
179
                        bCancelar = new javax.swing.JButton();
180
                        bCancelar.setSize(85, 26);
181
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
182
                        bCancelar.setLocation(219, 44);
183
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
184
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
185
                                                PluginServices.getMDIManager().closeView(ChangeName.this);
186
                                        }
187
                                });
188
                }
189

    
190
                return bCancelar;
191
        }
192

    
193
        /* (non-Javadoc)
194
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
195
         */
196
        public ViewInfo getViewInfo() {
197
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
198
                m_viewinfo.setTitle(PluginServices.getText(this,
199
                                "cambio_nombre"));
200
                return m_viewinfo;
201
        }
202
        public String getName(){
203
                return name;
204
        }
205
        
206
}  //  @jve:decl-index=0:visual-constraint="10,10"
207