Statistics
| Revision:

svn-gvsig-desktop / tags / v10_RC2c / applications / appgvSIG / src / com / iver / cit / gvsig / gui / toc / ChangeName.java @ 8745

History | View | Annotate | Download (4.96 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 java.awt.FlowLayout;
45
import java.awt.event.ActionListener;
46

    
47
import javax.swing.JLabel;
48
import javax.swing.JPanel;
49
import javax.swing.JTextField;
50

    
51
import org.gvsig.gui.beans.AcceptCancelPanel;
52

    
53
import com.iver.andami.PluginServices;
54
import com.iver.andami.ui.mdiManager.IWindow;
55
import com.iver.andami.ui.mdiManager.WindowInfo;
56

    
57

    
58
/**
59
 * Di?logo para cambiar el nombre de una capa.
60
 *
61
 * @author Vicente Caballero Navarro
62
 */
63
public class ChangeName extends JPanel implements IWindow {
64
        private JPanel jContentPane = null;
65
        private JLabel lblName = null;
66
        private JTextField txtName = null;
67
        private String name;
68
        private JPanel jPanel = null;
69
        private AcceptCancelPanel jPanel1 = null;
70

    
71
        /**
72
         * This is the default constructor
73
         *
74
         * @param layout Referencia al Layout.
75
         * @param fframe Referencia al fframe de imagen.
76
         */
77
        public ChangeName(String n) {
78
                super();
79
                if (n==null){
80
                        name=PluginServices.getText(this, "agrupacion");
81
                }else{
82
                        name=n;
83
                }
84
                initialize();
85
        }
86

    
87
        /**
88
         * This method initializes this
89
         */
90
        private void initialize() {
91
                this.setLayout(null);
92
                this.add(getJContentPane(), null);
93
                this.setSize(381, 77);
94
        }
95

    
96
        /**
97
         * This method initializes jContentPane
98
         *
99
         * @return javax.swing.JPanel
100
         */
101
        private JPanel getJContentPane() {
102
                if (jContentPane == null) {
103
                        jContentPane = new JPanel();
104
                        jContentPane.setLayout(null);
105
                        jContentPane.setSize(385, 77);
106
                        jContentPane.setLocation(0, 0);
107
                        jContentPane.add(getJPanel(), null);
108
                        jContentPane.add(getJPanel1(), null);
109
                }
110

    
111
                return jContentPane;
112
        }
113

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

    
127
                return lblName;
128
        }
129

    
130
        /**
131
         * This method initializes tFichero
132
         *
133
         * @return javax.swing.JTextField
134
         */
135
        private JTextField getTxtName() {
136
                if (txtName == null) {
137
                        txtName = new JTextField();
138
                        txtName.setBounds(62, 8, 280, 20);
139
                        txtName.setPreferredSize(new java.awt.Dimension(270, 20));
140
                        txtName.setText(name);
141
                }
142
                return txtName;
143
        }
144

    
145
        /**
146
         * Inserta el path al TFichero.
147
         *
148
         * @param val path del fichero.
149
         */
150
        public void setText(String val) {
151
                getTxtName().setText(val);
152
        }
153

    
154
        /* (non-Javadoc)
155
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
156
         */
157
        public WindowInfo getWindowInfo() {
158
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
159
                m_viewinfo.setTitle(PluginServices.getText(this,
160
                                "cambio_nombre"));
161
                return m_viewinfo;
162
        }
163
        public String getName(){
164
                return name;
165
        }
166

    
167
        /**
168
         * This method initializes jPanel
169
         *
170
         * @return javax.swing.JPanel
171
         */
172
        private JPanel getJPanel() {
173
                if (jPanel == null) {
174
                        jPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
175
                        jPanel.add(getLblName(), null);
176
                        jPanel.add(getTxtName(), null);
177

    
178
                        jPanel.setBounds(new java.awt.Rectangle(4,3,329,35));
179
                }
180
                return jPanel;
181
        }
182

    
183
        /**
184
         * This method initializes jPanel1
185
         *
186
         * @return javax.swing.JPanel
187
         */
188
        private AcceptCancelPanel getJPanel1() {
189
                if (jPanel1 == null) {
190
                        ActionListener okAction, cancelAction;
191
                        okAction = new java.awt.event.ActionListener() {
192
                                public void actionPerformed(java.awt.event.ActionEvent e) {
193
                                        name=getTxtName().getText();
194
                                        PluginServices.getMDIManager().closeWindow(ChangeName.this);
195
                                }
196
                        };
197
                        cancelAction = new java.awt.event.ActionListener() {
198
                                public void actionPerformed(java.awt.event.ActionEvent e) {
199
                                        PluginServices.getMDIManager().closeWindow(ChangeName.this);
200
                                }
201
                        };
202
                        jPanel1 = new AcceptCancelPanel(okAction, cancelAction);
203
                        jPanel1.setBounds(new java.awt.Rectangle(3,39,374,35));
204
                }
205
                return jPanel1;
206
        }
207

    
208
}  //  @jve:decl-index=0:visual-constraint="10,10"
209