svn-gvsig-desktop / branches / v10 / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / toc / gui / ChangeName.java @ 10339
History | View | Annotate | Download (5.11 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.project.documents.view.toc.gui; |
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 |
private boolean isAccepted=false; |
71 |
|
72 |
/**
|
73 |
* This is the default constructor
|
74 |
*
|
75 |
* @param layout Referencia al Layout.
|
76 |
* @param fframe Referencia al fframe de imagen.
|
77 |
*/
|
78 |
public ChangeName(String n) { |
79 |
super();
|
80 |
if (n==null){ |
81 |
name=PluginServices.getText(this, "agrupacion"); |
82 |
}else{
|
83 |
name=n; |
84 |
} |
85 |
initialize(); |
86 |
} |
87 |
|
88 |
/**
|
89 |
* This method initializes this
|
90 |
*/
|
91 |
private void initialize() { |
92 |
this.setLayout(null); |
93 |
this.add(getJContentPane(), null); |
94 |
this.setSize(381, 77); |
95 |
} |
96 |
|
97 |
/**
|
98 |
* This method initializes jContentPane
|
99 |
*
|
100 |
* @return javax.swing.JPanel
|
101 |
*/
|
102 |
private JPanel getJContentPane() { |
103 |
if (jContentPane == null) { |
104 |
jContentPane = new JPanel(); |
105 |
jContentPane.setLayout(null);
|
106 |
jContentPane.setSize(385, 77); |
107 |
jContentPane.setLocation(0, 0); |
108 |
jContentPane.add(getJPanel(), null);
|
109 |
jContentPane.add(getJPanel1(), null);
|
110 |
} |
111 |
|
112 |
return jContentPane;
|
113 |
} |
114 |
|
115 |
/**
|
116 |
* This method initializes lFichero
|
117 |
*
|
118 |
* @return javax.swing.JLabel
|
119 |
*/
|
120 |
private JLabel getLblName() { |
121 |
if (lblName == null) { |
122 |
lblName = new JLabel(); |
123 |
lblName.setSize(42, 20); |
124 |
lblName.setText(PluginServices.getText(this, "nombre")); |
125 |
lblName.setLocation(10, 9); |
126 |
} |
127 |
|
128 |
return lblName;
|
129 |
} |
130 |
|
131 |
/**
|
132 |
* This method initializes tFichero
|
133 |
*
|
134 |
* @return javax.swing.JTextField
|
135 |
*/
|
136 |
private JTextField getTxtName() { |
137 |
if (txtName == null) { |
138 |
txtName = new JTextField(); |
139 |
txtName.setBounds(62, 8, 280, 20); |
140 |
txtName.setPreferredSize(new java.awt.Dimension(270, 20)); |
141 |
txtName.setText(name); |
142 |
} |
143 |
return txtName;
|
144 |
} |
145 |
|
146 |
/**
|
147 |
* Inserta el path al TFichero.
|
148 |
*
|
149 |
* @param val path del fichero.
|
150 |
*/
|
151 |
public void setText(String val) { |
152 |
getTxtName().setText(val); |
153 |
} |
154 |
|
155 |
/* (non-Javadoc)
|
156 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
157 |
*/
|
158 |
public WindowInfo getWindowInfo() {
|
159 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
160 |
m_viewinfo.setTitle(PluginServices.getText(this,
|
161 |
"cambio_nombre"));
|
162 |
return m_viewinfo;
|
163 |
} |
164 |
public String getName(){ |
165 |
return name;
|
166 |
} |
167 |
|
168 |
/**
|
169 |
* This method initializes jPanel
|
170 |
*
|
171 |
* @return javax.swing.JPanel
|
172 |
*/
|
173 |
private JPanel getJPanel() { |
174 |
if (jPanel == null) { |
175 |
jPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); |
176 |
jPanel.add(getLblName(), null);
|
177 |
jPanel.add(getTxtName(), null);
|
178 |
|
179 |
jPanel.setBounds(new java.awt.Rectangle(4,3,329,35)); |
180 |
} |
181 |
return jPanel;
|
182 |
} |
183 |
|
184 |
/**
|
185 |
* This method initializes jPanel1
|
186 |
*
|
187 |
* @return javax.swing.JPanel
|
188 |
*/
|
189 |
private AcceptCancelPanel getJPanel1() {
|
190 |
if (jPanel1 == null) { |
191 |
ActionListener okAction, cancelAction;
|
192 |
okAction = new java.awt.event.ActionListener() {
|
193 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
194 |
name=getTxtName().getText(); |
195 |
isAccepted=true;
|
196 |
PluginServices.getMDIManager().closeWindow(ChangeName.this); |
197 |
} |
198 |
}; |
199 |
cancelAction = new java.awt.event.ActionListener() {
|
200 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
201 |
isAccepted=false;
|
202 |
PluginServices.getMDIManager().closeWindow(ChangeName.this); |
203 |
} |
204 |
}; |
205 |
jPanel1 = new AcceptCancelPanel(okAction, cancelAction);
|
206 |
jPanel1.setBounds(new java.awt.Rectangle(3,39,374,35)); |
207 |
} |
208 |
return jPanel1;
|
209 |
} |
210 |
public boolean isAccepted() { |
211 |
return isAccepted;
|
212 |
} |
213 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
214 |
|