Statistics
| Revision:

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

History | View | Annotate | Download (4.94 KB)

1 2262 vcaballero
/* 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 6122 jaume
import java.awt.FlowLayout;
45
import java.awt.event.ActionListener;
46
47
import javax.swing.JLabel;
48 2262 vcaballero
import javax.swing.JPanel;
49 6122 jaume
import javax.swing.JTextField;
50 2262 vcaballero
51 6122 jaume
import org.gvsig.gui.beans.AcceptCancelPanel;
52
53 2262 vcaballero
import com.iver.andami.PluginServices;
54 6877 cesar
import com.iver.andami.ui.mdiManager.IWindow;
55 2262 vcaballero
import com.iver.andami.ui.mdiManager.ViewInfo;
56
57
58
/**
59
 * Di?logo para cambiar el nombre de una capa.
60
 *
61
 * @author Vicente Caballero Navarro
62
 */
63 6877 cesar
public class ChangeName extends JPanel implements IWindow {
64 6122 jaume
        private JPanel jContentPane = null;
65
        private JLabel lblName = null;
66
        private JTextField txtName = null;
67 2262 vcaballero
        private String name;
68 6122 jaume
        private JPanel jPanel = null;
69
        private AcceptCancelPanel jPanel1 = null;
70
71 2262 vcaballero
        /**
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 6122 jaume
                this.setSize(381, 77);
94 2262 vcaballero
        }
95
96
        /**
97
         * This method initializes jContentPane
98
         *
99
         * @return javax.swing.JPanel
100
         */
101 6122 jaume
        private JPanel getJContentPane() {
102 2262 vcaballero
                if (jContentPane == null) {
103 6122 jaume
                        jContentPane = new JPanel();
104 2262 vcaballero
                        jContentPane.setLayout(null);
105 6122 jaume
                        jContentPane.setSize(385, 77);
106 2262 vcaballero
                        jContentPane.setLocation(0, 0);
107 6122 jaume
                        jContentPane.add(getJPanel(), null);
108
                        jContentPane.add(getJPanel1(), null);
109 2262 vcaballero
                }
110
111
                return jContentPane;
112
        }
113
114
        /**
115
         * This method initializes lFichero
116
         *
117
         * @return javax.swing.JLabel
118
         */
119 6122 jaume
        private JLabel getLblName() {
120 2262 vcaballero
                if (lblName == null) {
121 6122 jaume
                        lblName = new JLabel();
122 2262 vcaballero
                        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 6122 jaume
        private JTextField getTxtName() {
136 2262 vcaballero
                if (txtName == null) {
137 6122 jaume
                        txtName = new JTextField();
138 2262 vcaballero
                        txtName.setBounds(62, 8, 280, 20);
139 6122 jaume
                        txtName.setPreferredSize(new java.awt.Dimension(270, 20));
140 2262 vcaballero
                        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 6122 jaume
        /* (non-Javadoc)
155
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
156
         */
157
        public ViewInfo getViewInfo() {
158
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.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 2262 vcaballero
        /**
168 6122 jaume
         * This method initializes jPanel
169 2262 vcaballero
         *
170 6122 jaume
         * @return javax.swing.JPanel
171 2262 vcaballero
         */
172 6122 jaume
        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 2262 vcaballero
                }
180 6122 jaume
                return jPanel;
181 2262 vcaballero
        }
182
183
        /**
184 6122 jaume
         * This method initializes jPanel1
185 2262 vcaballero
         *
186 6122 jaume
         * @return javax.swing.JPanel
187 2262 vcaballero
         */
188 6122 jaume
        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().closeView(ChangeName.this);
195
                                }
196
                        };
197
                        cancelAction = new java.awt.event.ActionListener() {
198
                                public void actionPerformed(java.awt.event.ActionEvent e) {
199
                                        PluginServices.getMDIManager().closeView(ChangeName.this);
200
                                }
201
                        };
202
                        jPanel1 = new AcceptCancelPanel(okAction, cancelAction);
203
                        jPanel1.setBounds(new java.awt.Rectangle(3,39,374,35));
204 2262 vcaballero
                }
205 6122 jaume
                return jPanel1;
206 2262 vcaballero
        }
207
208
}  //  @jve:decl-index=0:visual-constraint="10,10"