svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / dialogs / DlgFieldManager.java @ 6458
History | View | Annotate | Download (14.9 KB)
1 | 6127 | fjp | /* 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.dialogs; |
||
42 | |||
43 | 6458 | fjp | import java.awt.BorderLayout; |
44 | import java.awt.event.ActionListener; |
||
45 | 6127 | fjp | import java.sql.Types; |
46 | |||
47 | import javax.swing.DefaultCellEditor; |
||
48 | import javax.swing.JButton; |
||
49 | import javax.swing.JComboBox; |
||
50 | 6399 | fjp | import javax.swing.JComponent; |
51 | 6458 | fjp | import javax.swing.JDialog; |
52 | import javax.swing.JFrame; |
||
53 | 6127 | fjp | import javax.swing.JLabel; |
54 | 6399 | fjp | import javax.swing.JOptionPane; |
55 | 6127 | fjp | import javax.swing.JPanel; |
56 | import javax.swing.JScrollPane; |
||
57 | import javax.swing.JTable; |
||
58 | import javax.swing.ListSelectionModel; |
||
59 | import javax.swing.event.ListSelectionEvent; |
||
60 | import javax.swing.event.ListSelectionListener; |
||
61 | import javax.swing.table.AbstractTableModel; |
||
62 | import javax.swing.table.DefaultTableModel; |
||
63 | import javax.swing.table.TableColumn; |
||
64 | import javax.swing.table.TableModel; |
||
65 | |||
66 | 6458 | fjp | import org.gvsig.gui.beans.AcceptCancelPanel; |
67 | |||
68 | 6356 | fjp | import com.hardcode.driverManager.DriverLoadException; |
69 | import com.hardcode.gdbms.engine.data.driver.DriverException; |
||
70 | 6127 | fjp | import com.iver.andami.PluginServices; |
71 | 6458 | fjp | import com.iver.andami.messages.NotificationManager; |
72 | 6127 | fjp | import com.iver.andami.ui.mdiManager.View; |
73 | import com.iver.andami.ui.mdiManager.ViewInfo; |
||
74 | import com.iver.cit.gvsig.fmap.drivers.FieldDescription; |
||
75 | 6356 | fjp | import com.iver.cit.gvsig.fmap.edition.EditableAdapter; |
76 | 6365 | fjp | import com.iver.cit.gvsig.fmap.edition.EditionException; |
77 | 6356 | fjp | import com.iver.cit.gvsig.fmap.edition.IEditableSource; |
78 | 6458 | fjp | import com.iver.cit.gvsig.gui.panels.FPanelCreateField; |
79 | import com.iver.cit.gvsig.gui.project.MapProperties; |
||
80 | 6127 | fjp | |
81 | public class DlgFieldManager extends JPanel implements View { |
||
82 | |||
83 | /**
|
||
84 | *
|
||
85 | */
|
||
86 | private static final long serialVersionUID = -4284879326692474318L; |
||
87 | 6365 | fjp | |
88 | 6127 | fjp | ViewInfo viewInfo = null;
|
89 | 6365 | fjp | |
90 | 6127 | fjp | private JLabel jLabel = null; |
91 | 6365 | fjp | |
92 | 6127 | fjp | private JScrollPane jScrollPane = null; |
93 | 6365 | fjp | |
94 | 6127 | fjp | private JTable jTableFields = null; |
95 | 6365 | fjp | |
96 | 6127 | fjp | private JButton jBtnNewField = null; |
97 | 6365 | fjp | |
98 | 6127 | fjp | private JButton jBtnDeleteField = null; |
99 | 6365 | fjp | |
100 | 6127 | fjp | private JButton jBtnRenameField = null; |
101 | 6365 | fjp | |
102 | 6127 | fjp | private JButton jBtnOK = null; |
103 | 6365 | fjp | |
104 | 6127 | fjp | private JButton jBtnCancel = null; |
105 | 6458 | fjp | |
106 | private FPanelCreateField panelNewField = new FPanelCreateField(); |
||
107 | 6365 | fjp | |
108 | // private IFieldManager fieldManager;;
|
||
109 | 6356 | fjp | private EditableAdapter edAdapter = null; |
110 | 6365 | fjp | |
111 | private class MyFieldDescription { |
||
112 | 6127 | fjp | boolean isOriginal;
|
113 | 6365 | fjp | |
114 | 6127 | fjp | FieldDescription fieldDesc; |
115 | 6365 | fjp | |
116 | MyFieldDescription(FieldDescription fieldDesc, boolean isOriginal) {
|
||
117 | this.fieldDesc = fieldDesc;
|
||
118 | 6127 | fjp | this.isOriginal = isOriginal;
|
119 | } |
||
120 | 6365 | fjp | |
121 | FieldDescription getFieldDescription() { |
||
122 | 6127 | fjp | return fieldDesc;
|
123 | } |
||
124 | 6365 | fjp | |
125 | boolean isOriginal() {
|
||
126 | 6127 | fjp | return isOriginal;
|
127 | } |
||
128 | 6365 | fjp | |
129 | 6127 | fjp | } |
130 | 6365 | fjp | |
131 | private class MyTableModel extends AbstractTableModel { |
||
132 | IEditableSource myIes; |
||
133 | |||
134 | public MyTableModel(IEditableSource ies) {
|
||
135 | myIes = ies; |
||
136 | 6127 | fjp | } |
137 | |||
138 | public int getColumnCount() { |
||
139 | return 3; |
||
140 | } |
||
141 | |||
142 | public int getRowCount() { |
||
143 | 6365 | fjp | try {
|
144 | return myIes.getRecordset().getFieldCount();
|
||
145 | } catch (DriverLoadException e) {
|
||
146 | e.printStackTrace(); |
||
147 | } catch (DriverException e) {
|
||
148 | e.printStackTrace(); |
||
149 | } |
||
150 | return 0; |
||
151 | 6127 | fjp | } |
152 | |||
153 | public Object getValueAt(int rowIndex, int columnIndex) { |
||
154 | 6365 | fjp | FieldDescription[] myFields;
|
155 | try {
|
||
156 | myFields = myIes.getRecordset().getFieldsDescription(); |
||
157 | FieldDescription aux = myFields[rowIndex]; |
||
158 | switch (columnIndex) {
|
||
159 | case 0: |
||
160 | return aux.getFieldAlias();
|
||
161 | case 1: |
||
162 | String strType = null; |
||
163 | int type = aux.getFieldType();
|
||
164 | if (type == Types.VARCHAR) |
||
165 | strType = "String";
|
||
166 | if (type == Types.DOUBLE) |
||
167 | strType = "Double";
|
||
168 | if (type == Types.INTEGER) |
||
169 | strType = "Integer";
|
||
170 | if (type == Types.BOOLEAN) |
||
171 | strType = "Boolean";
|
||
172 | if (type == Types.DATE) |
||
173 | strType = "Date";
|
||
174 | 6127 | fjp | |
175 | 6365 | fjp | return strType;
|
176 | case 2: |
||
177 | return new Integer(aux.getFieldLength()); |
||
178 | } |
||
179 | } catch (DriverLoadException e) {
|
||
180 | e.printStackTrace(); |
||
181 | } catch (DriverException e) {
|
||
182 | e.printStackTrace(); |
||
183 | 6127 | fjp | } |
184 | 6365 | fjp | |
185 | 6127 | fjp | return null; |
186 | } |
||
187 | |||
188 | public Class getColumnClass(int columnIndex) { |
||
189 | // TODO Auto-generated method stub
|
||
190 | return super.getColumnClass(columnIndex); |
||
191 | } |
||
192 | |||
193 | public String getColumnName(int column) { |
||
194 | 6365 | fjp | switch (column) {
|
195 | 6127 | fjp | case 0: |
196 | return PluginServices.getText(this, "FieldName"); |
||
197 | case 1: |
||
198 | return PluginServices.getText(this, "FieldType"); |
||
199 | case 2: |
||
200 | 6365 | fjp | return PluginServices.getText(this, "FieldLength"); |
201 | 6127 | fjp | } |
202 | return super.getColumnName(column); |
||
203 | } |
||
204 | |||
205 | public boolean isCellEditable(int rowIndex, int columnIndex) { |
||
206 | return false; |
||
207 | |||
208 | } |
||
209 | |||
210 | public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
||
211 | 6365 | fjp | FieldDescription[] myFields;
|
212 | try {
|
||
213 | myFields = myIes.getRecordset().getFieldsDescription(); |
||
214 | FieldDescription fDesc = myFields[rowIndex]; |
||
215 | 6127 | fjp | |
216 | 6365 | fjp | switch (columnIndex) {
|
217 | case 0: |
||
218 | fDesc.setFieldAlias((String) aValue);
|
||
219 | break;
|
||
220 | case 1: |
||
221 | String strType = (String) aValue; |
||
222 | if (strType.equals("String")) |
||
223 | fDesc.setFieldType(Types.VARCHAR);
|
||
224 | if (strType.equals("Double")) |
||
225 | fDesc.setFieldType(Types.DOUBLE);
|
||
226 | if (strType.equals("Integer")) |
||
227 | fDesc.setFieldType(Types.INTEGER);
|
||
228 | if (strType.equals("Boolean")) |
||
229 | fDesc.setFieldType(Types.BOOLEAN);
|
||
230 | if (strType.equals("Date")) |
||
231 | fDesc.setFieldType(Types.DATE);
|
||
232 | break;
|
||
233 | case 2: |
||
234 | int fieldLength = ((Integer) aValue).intValue(); |
||
235 | fDesc.setFieldLength(fieldLength); |
||
236 | 6127 | fjp | |
237 | 6365 | fjp | // TODO: HACERLO BIEN
|
238 | if (fDesc.getFieldType() == Types.VARCHAR) |
||
239 | fDesc.setFieldDecimalCount(5);
|
||
240 | |||
241 | } |
||
242 | } catch (DriverLoadException e) {
|
||
243 | e.printStackTrace(); |
||
244 | } catch (DriverException e) {
|
||
245 | e.printStackTrace(); |
||
246 | 6127 | fjp | } |
247 | 6365 | fjp | |
248 | 6127 | fjp | } |
249 | 6365 | fjp | |
250 | 6127 | fjp | } |
251 | 6365 | fjp | |
252 | 6127 | fjp | /**
|
253 | 6365 | fjp | * This method initializes
|
254 | 6127 | fjp | *
|
255 | */
|
||
256 | 6356 | fjp | public DlgFieldManager(IEditableSource ies) {
|
257 | 6127 | fjp | super();
|
258 | 6356 | fjp | this.edAdapter = (EditableAdapter) ies;
|
259 | 6127 | fjp | initialize(); |
260 | // Add a new row
|
||
261 | 6356 | fjp | TableModel tm;
|
262 | try {
|
||
263 | 6365 | fjp | tm = new MyTableModel(ies);
|
264 | 6356 | fjp | getJTableFields().setModel(tm); |
265 | 6365 | fjp | // Esto lo a?ado aqu? porque si no tiene registros, no hace caso.
|
266 | // (Por eso no
|
||
267 | 6356 | fjp | // lo pongo en getJTable()
|
268 | TableColumn typeColumn = jTableFields.getColumnModel().getColumn(1); |
||
269 | JComboBox comboBox = new JComboBox(); |
||
270 | comboBox.addItem("Boolean");
|
||
271 | comboBox.addItem("Date");
|
||
272 | comboBox.addItem("Integer");
|
||
273 | comboBox.addItem("Double");
|
||
274 | comboBox.addItem("String");
|
||
275 | typeColumn.setCellEditor(new DefaultCellEditor(comboBox)); |
||
276 | 6365 | fjp | |
277 | TableColumn widthColumn = jTableFields.getColumnModel()
|
||
278 | .getColumn(2);
|
||
279 | 6356 | fjp | } catch (DriverLoadException e) {
|
280 | // TODO Auto-generated catch block
|
||
281 | e.printStackTrace(); |
||
282 | } |
||
283 | 6127 | fjp | |
284 | } |
||
285 | |||
286 | /**
|
||
287 | * This method initializes this
|
||
288 | *
|
||
289 | */
|
||
290 | private void initialize() { |
||
291 | 6365 | fjp | jLabel = new JLabel(); |
292 | jLabel.setBounds(new java.awt.Rectangle(14, 9, 361, 34)); |
||
293 | jLabel.setText("Puede a?adir, borrar o renombrar los campos:");
|
||
294 | this.setLayout(null); |
||
295 | this.setSize(new java.awt.Dimension(387, 327)); |
||
296 | this.add(jLabel, null); |
||
297 | this.add(getJScrollPane(), null); |
||
298 | this.add(getJBtnNewField(), null); |
||
299 | this.add(getJButton(), null); |
||
300 | this.add(getJBtnRenameField(), null); |
||
301 | this.add(getJBtnOK(), null); |
||
302 | this.add(getJButton2(), null); |
||
303 | |||
304 | 6127 | fjp | } |
305 | |||
306 | public ViewInfo getViewInfo() {
|
||
307 | 6365 | fjp | if (viewInfo == null) { |
308 | viewInfo = new ViewInfo(ViewInfo.MODALDIALOG | ViewInfo.PALETTE
|
||
309 | | ViewInfo.RESIZABLE); |
||
310 | 6127 | fjp | } |
311 | return viewInfo;
|
||
312 | } |
||
313 | 6365 | fjp | |
314 | 6127 | fjp | /**
|
315 | 6365 | fjp | * Convierte lo que hay en la tabla en una definici?n de campos adecuada
|
316 | * para crear un LayerDefinition
|
||
317 | *
|
||
318 | 6127 | fjp | * @return
|
319 | */
|
||
320 | public FieldDescription[] getFieldsDescription() { |
||
321 | DefaultTableModel tm = (DefaultTableModel) jTableFields.getModel(); |
||
322 | FieldDescription[] fieldsDesc = new FieldDescription[tm.getRowCount()]; |
||
323 | |||
324 | 6365 | fjp | for (int i = 0; i < tm.getRowCount(); i++) { |
325 | 6127 | fjp | fieldsDesc[i] = new FieldDescription();
|
326 | 6365 | fjp | fieldsDesc[i].setFieldName((String) tm.getValueAt(i, 0)); |
327 | String strType = (String) tm.getValueAt(i, 1); |
||
328 | 6127 | fjp | if (strType.equals("String")) |
329 | fieldsDesc[i].setFieldType(Types.VARCHAR);
|
||
330 | if (strType.equals("Double")) |
||
331 | fieldsDesc[i].setFieldType(Types.DOUBLE);
|
||
332 | if (strType.equals("Integer")) |
||
333 | fieldsDesc[i].setFieldType(Types.INTEGER);
|
||
334 | if (strType.equals("Boolean")) |
||
335 | fieldsDesc[i].setFieldType(Types.BOOLEAN);
|
||
336 | if (strType.equals("Date")) |
||
337 | fieldsDesc[i].setFieldType(Types.DATE);
|
||
338 | 6365 | fjp | int fieldLength = Integer.parseInt((String) tm.getValueAt(i, 2)); |
339 | 6127 | fjp | fieldsDesc[i].setFieldLength(fieldLength); |
340 | |||
341 | // TODO: HACERLO BIEN
|
||
342 | if (strType.equals("Double")) |
||
343 | fieldsDesc[i].setFieldDecimalCount(5);
|
||
344 | |||
345 | } |
||
346 | |||
347 | return fieldsDesc;
|
||
348 | } |
||
349 | |||
350 | /**
|
||
351 | 6365 | fjp | * This method initializes jScrollPane
|
352 | *
|
||
353 | * @return javax.swing.JScrollPane
|
||
354 | 6127 | fjp | */
|
355 | private JScrollPane getJScrollPane() { |
||
356 | if (jScrollPane == null) { |
||
357 | jScrollPane = new JScrollPane(); |
||
358 | 6365 | fjp | jScrollPane.setBounds(new java.awt.Rectangle(13, 53, 236, 203)); |
359 | 6127 | fjp | jScrollPane.setViewportView(getJTableFields()); |
360 | } |
||
361 | return jScrollPane;
|
||
362 | } |
||
363 | |||
364 | /**
|
||
365 | 6365 | fjp | * This method initializes jTableFields
|
366 | *
|
||
367 | * @return javax.swing.JTable
|
||
368 | 6127 | fjp | */
|
369 | private JTable getJTableFields() { |
||
370 | if (jTableFields == null) { |
||
371 | jTableFields = new JTable(); |
||
372 | 6365 | fjp | jTableFields |
373 | .setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
||
374 | |||
375 | 6399 | fjp | jTableFields.setColumnSelectionAllowed(false);
|
376 | 6365 | fjp | // Ask to be notified of selection changes.
|
377 | 6127 | fjp | ListSelectionModel rowSM = jTableFields.getSelectionModel();
|
378 | rowSM.addListSelectionListener(new ListSelectionListener() { |
||
379 | 6365 | fjp | public void valueChanged(ListSelectionEvent e) { |
380 | // Ignore extra messages.
|
||
381 | if (e.getValueIsAdjusting())
|
||
382 | return;
|
||
383 | 6127 | fjp | |
384 | 6365 | fjp | ListSelectionModel lsm = (ListSelectionModel) e.getSource(); |
385 | if (lsm.isSelectionEmpty()) {
|
||
386 | // no rows are selected
|
||
387 | jBtnDeleteField.setEnabled(false);
|
||
388 | } else {
|
||
389 | jBtnDeleteField.setEnabled(true);
|
||
390 | } |
||
391 | 6399 | fjp | if (jTableFields.getSelectedRows().length != 1) |
392 | { |
||
393 | getJBtnRenameField().setEnabled(false);
|
||
394 | } |
||
395 | else
|
||
396 | { |
||
397 | getJBtnRenameField().setEnabled(true);
|
||
398 | } |
||
399 | |||
400 | 6365 | fjp | } |
401 | 6127 | fjp | }); |
402 | 6365 | fjp | |
403 | 6127 | fjp | } |
404 | return jTableFields;
|
||
405 | } |
||
406 | |||
407 | /**
|
||
408 | 6365 | fjp | * This method initializes jBtnNewField
|
409 | *
|
||
410 | * @return javax.swing.JButton
|
||
411 | 6127 | fjp | */
|
412 | private JButton getJBtnNewField() { |
||
413 | if (jBtnNewField == null) { |
||
414 | jBtnNewField = new JButton(); |
||
415 | 6365 | fjp | jBtnNewField.setBounds(new java.awt.Rectangle(255, 60, 118, 25)); |
416 | 6212 | fjp | jBtnNewField.setText(PluginServices.getText(this, "New Field")); |
417 | 6127 | fjp | jBtnNewField.addActionListener(new java.awt.event.ActionListener() {
|
418 | 6458 | fjp | public void actionPerformed(java.awt.event.ActionEvent e) { |
419 | |||
420 | ActionListener okAction;
|
||
421 | okAction = new java.awt.event.ActionListener() {
|
||
422 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
423 | FieldDescription fld = panelNewField.getFieldDescription(); |
||
424 | try {
|
||
425 | edAdapter.addField(fld); |
||
426 | jTableFields.revalidate(); |
||
427 | } catch (EditionException e1) {
|
||
428 | // TODO Auto-generated catch block
|
||
429 | e1.printStackTrace(); |
||
430 | } |
||
431 | |||
432 | |||
433 | } |
||
434 | }; |
||
435 | panelNewField.setOkAction(okAction); |
||
436 | panelNewField = (FPanelCreateField) PluginServices.getMDIManager().addView(panelNewField); |
||
437 | 6127 | fjp | } |
438 | }); |
||
439 | } |
||
440 | return jBtnNewField;
|
||
441 | } |
||
442 | |||
443 | /**
|
||
444 | 6365 | fjp | * This method initializes jButton
|
445 | *
|
||
446 | * @return javax.swing.JButton
|
||
447 | 6127 | fjp | */
|
448 | private JButton getJButton() { |
||
449 | if (jBtnDeleteField == null) { |
||
450 | jBtnDeleteField = new JButton(); |
||
451 | 6365 | fjp | jBtnDeleteField.setBounds(new java.awt.Rectangle(255, 90, 118, 25)); |
452 | 6127 | fjp | jBtnDeleteField.setText("Delete Field");
|
453 | 6365 | fjp | jBtnDeleteField |
454 | .addActionListener(new java.awt.event.ActionListener() {
|
||
455 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
456 | int[] selecteds = jTableFields.getSelectedRows(); |
||
457 | TableModel tm = jTableFields.getModel();
|
||
458 | |||
459 | 6356 | fjp | |
460 | 6365 | fjp | for (int i = selecteds.length - 1; i >= 0; i--) |
461 | { |
||
462 | String fieldName = (String) tm.getValueAt(selecteds[i],0); |
||
463 | try {
|
||
464 | edAdapter.removeField(fieldName); |
||
465 | } catch (EditionException e1) {
|
||
466 | // TODO Auto-generated catch block
|
||
467 | e1.printStackTrace(); |
||
468 | } |
||
469 | } |
||
470 | jTableFields.revalidate(); |
||
471 | 6356 | fjp | |
472 | 6365 | fjp | } |
473 | }); |
||
474 | 6127 | fjp | } |
475 | return jBtnDeleteField;
|
||
476 | } |
||
477 | |||
478 | /**
|
||
479 | 6365 | fjp | * This method initializes jBtnRenameField
|
480 | *
|
||
481 | * @return javax.swing.JButton
|
||
482 | 6127 | fjp | */
|
483 | private JButton getJBtnRenameField() { |
||
484 | if (jBtnRenameField == null) { |
||
485 | jBtnRenameField = new JButton(); |
||
486 | 6365 | fjp | jBtnRenameField |
487 | .setBounds(new java.awt.Rectangle(255, 120, 118, 25)); |
||
488 | 6127 | fjp | jBtnRenameField.setText("Rename Field...");
|
489 | 6399 | fjp | jBtnRenameField.addActionListener(new java.awt.event.ActionListener() {
|
490 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
491 | int[] selecteds = jTableFields.getSelectedRows(); |
||
492 | TableModel tm = jTableFields.getModel();
|
||
493 | |||
494 | |||
495 | for (int i = selecteds.length - 1; i >= 0; i--) |
||
496 | { |
||
497 | String fieldName = (String) tm.getValueAt(selecteds[i],0); |
||
498 | try {
|
||
499 | String newName = JOptionPane.showInputDialog( |
||
500 | (JComponent) PluginServices.getMDIManager().getActiveView(),
|
||
501 | PluginServices.getText(this, "please_insert_new_field_name"), |
||
502 | fieldName |
||
503 | ); |
||
504 | if (newName == null) return; |
||
505 | |||
506 | edAdapter.renameField(fieldName, newName); |
||
507 | } catch (EditionException e1) {
|
||
508 | // TODO Auto-generated catch block
|
||
509 | e1.printStackTrace(); |
||
510 | } |
||
511 | } |
||
512 | jTableFields.repaint(); |
||
513 | |||
514 | } |
||
515 | }); |
||
516 | 6127 | fjp | } |
517 | return jBtnRenameField;
|
||
518 | } |
||
519 | |||
520 | /**
|
||
521 | 6365 | fjp | * This method initializes jBtnOK
|
522 | *
|
||
523 | * @return javax.swing.JButton
|
||
524 | 6127 | fjp | */
|
525 | private JButton getJBtnOK() { |
||
526 | if (jBtnOK == null) { |
||
527 | jBtnOK = new JButton(); |
||
528 | 6365 | fjp | jBtnOK.setBounds(new java.awt.Rectangle(180, 285, 91, 23)); |
529 | 6127 | fjp | jBtnOK.setText("Aceptar");
|
530 | 6356 | fjp | jBtnOK.addActionListener(new java.awt.event.ActionListener() {
|
531 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
532 | 6399 | fjp | PluginServices.getMDIManager().closeView(DlgFieldManager.this); |
533 | 6356 | fjp | } |
534 | }); |
||
535 | 6127 | fjp | } |
536 | return jBtnOK;
|
||
537 | } |
||
538 | |||
539 | /**
|
||
540 | 6365 | fjp | * This method initializes jButton
|
541 | *
|
||
542 | * @return javax.swing.JButton
|
||
543 | 6127 | fjp | */
|
544 | private JButton getJButton2() { |
||
545 | if (jBtnCancel == null) { |
||
546 | jBtnCancel = new JButton(); |
||
547 | 6365 | fjp | jBtnCancel.setBounds(new java.awt.Rectangle(285, 285, 91, 23)); |
548 | 6127 | fjp | jBtnCancel.setText("Cancelar");
|
549 | 6399 | fjp | jBtnCancel.addActionListener(new java.awt.event.ActionListener() {
|
550 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
551 | PluginServices.getMDIManager().closeView(DlgFieldManager.this); |
||
552 | } |
||
553 | }); |
||
554 | 6127 | fjp | } |
555 | return jBtnCancel;
|
||
556 | } |
||
557 | |||
558 | 6365 | fjp | } // @jve:decl-index=0:visual-constraint="12,23"
|