Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / dialogs / DlgFieldManager.java @ 6944

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