Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app.document.table.app / org.gvsig.app.document.table.app.mainplugin / src / main / java / org / gvsig / app / project / documents / table / gui / FeatureTypeEditingPanel.java @ 43989

History | View | Annotate | Download (25.7 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.app.project.documents.table.gui;
25

    
26
import java.awt.BorderLayout;
27
import java.awt.Component;
28
import java.awt.FlowLayout;
29
import java.awt.GridLayout;
30
import java.awt.event.ActionListener;
31
import java.text.ParseException;
32
import java.util.ArrayList;
33
import java.util.List;
34

    
35
import javax.swing.DefaultCellEditor;
36
import javax.swing.JButton;
37
import javax.swing.JComboBox;
38
import javax.swing.JLabel;
39
import javax.swing.JOptionPane;
40
import javax.swing.JPanel;
41
import javax.swing.JScrollPane;
42
import javax.swing.JTable;
43
import javax.swing.ListSelectionModel;
44
import javax.swing.event.ListSelectionEvent;
45
import javax.swing.event.ListSelectionListener;
46
import javax.swing.table.AbstractTableModel;
47
import javax.swing.table.TableColumn;
48
import javax.swing.table.TableModel;
49

    
50
import org.gvsig.andami.PluginServices;
51
import org.gvsig.andami.messages.NotificationManager;
52
import org.gvsig.andami.ui.mdiManager.IWindow;
53
import org.gvsig.andami.ui.mdiManager.WindowInfo;
54
import org.gvsig.app.project.documents.table.TableOperations;
55
import org.gvsig.fmap.dal.DALLocator;
56
import org.gvsig.fmap.dal.DataManager;
57
import org.gvsig.fmap.dal.DataTypes;
58
import org.gvsig.fmap.dal.exception.DataException;
59
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
60
import org.gvsig.fmap.dal.feature.EditableFeatureType;
61
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
62
import org.gvsig.fmap.dal.feature.FeatureStore;
63
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory;
64
import org.gvsig.i18n.Messages;
65
import org.gvsig.tools.swing.api.ToolsSwingLocator;
66
import org.slf4j.Logger;
67
import org.slf4j.LoggerFactory;
68

    
69
/**
70
 * To modify FeatureTypes from the interface.
71
 *
72
 * @author Vicente Caballero Navarro
73
 *
74
 */
75
public class FeatureTypeEditingPanel extends JPanel implements IWindow {
76

    
77
    private static final long serialVersionUID = -4284879326692474318L;
78

    
79
    private static final Logger logger = LoggerFactory
80
        .getLogger(FeatureTypeEditingPanel.class);
81

    
82
    WindowInfo windowInfo = null;
83

    
84
    private JLabel jLabel = null;
85

    
86
    private JScrollPane jScrollPane = null;
87

    
88
    private JTable jTableFields = null;
89

    
90
    private JButton jBtnNewField = null;
91

    
92
    private JButton jBtnDeleteField = null;
93

    
94
    private JButton jBtnRenameField = null;
95

    
96
    private JButton jBtnOK = null;
97

    
98
    private JButton jBtnCancel = null;
99

    
100
    private CreateNewAttributePanel panelNewField;
101

    
102
    private FeatureStore featureStore = null;
103

    
104
    private JPanel jPanelButtons = null;
105

    
106
    private EditableFeatureType editableType = null;
107

    
108
    private class MyTableModel extends AbstractTableModel {
109

    
110
        /**
111
                 *
112
                 */
113
        private static final long serialVersionUID = -2847526298987536118L;
114

    
115
        public MyTableModel() {
116

    
117
        }
118

    
119
        public int getColumnCount() {
120
            return 6;
121
        }
122

    
123
        public int getRowCount() {
124
            return editableType.size();
125
        }
126

    
127
        public Object getValueAt(int rowIndex, int columnIndex) {
128
            FeatureAttributeDescriptor myField = null;
129
            myField = (FeatureAttributeDescriptor) editableType.get(rowIndex);
130

    
131
            switch (columnIndex) {
132
            case 0:
133
                return myField.getName();
134
            case 1:
135
                return myField.getDataType().getName();
136
            case 2:
137
                return new Integer(myField.getSize());
138
            case 3:
139
                return new Integer(myField.getPrecision());
140
            case 4:
141
                return myField.getDefaultValue();
142
            case 5:
143
                if (myField.isComputed() && (myField.getFeatureAttributeEmulator() instanceof EmulatedFieldExpression)) {
144
                EmulatedFieldExpression code = (EmulatedFieldExpression) myField.getFeatureAttributeEmulator();
145
                    return code.getCode();
146
                } else if (myField.isComputed()) {
147
                    return PluginServices.getText(this, "_Virtual_field");
148
                } else {
149
                    return "";
150
                }
151

    
152
            }
153
            return null;
154
        }
155

    
156
        public Class<?> getColumnClass(int columnIndex) {
157
            return super.getColumnClass(columnIndex);
158
        }
159

    
160
        public String getColumnName(int column) {
161
            switch (column) {
162
            case 0:
163
                return PluginServices.getText(this, "field_name");
164
            case 1:
165
                return PluginServices.getText(this, "field_type");
166
            case 2:
167
                return PluginServices.getText(this, "field_length");
168
            case 3:
169
                return PluginServices.getText(this, "field_decimal_count");
170
            case 4:
171
                return PluginServices.getText(this, "field_default_value");
172
            case 5:
173
                return PluginServices.getText(this, "_Calculated");
174

    
175
            }
176
            return super.getColumnName(column);
177
        }
178

    
179
        public boolean isCellEditable(int rowIndex, int columnIndex) {
180
            return false;
181

    
182
        }
183

    
184
        public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
185
            if (columnIndex == 0) {
186
                editableType.remove(rowIndex);
187
            }
188
            String name = "";
189
            int type = DataTypes.STRING;
190
            int size = 0;
191
            int precision = 0;
192
            switch (columnIndex) {
193
            case 0:
194
                name = (String) aValue;
195
                break;
196
            case 1:
197
                String strType = (String) aValue;
198
                if (strType.equals("String")) {
199
                    type = DataTypes.STRING;
200
                }
201
                if (strType.equals("Double")) {
202
                    type = DataTypes.DOUBLE;
203
                    precision = 5;
204
                }
205
                if (strType.equals("Integer")) {
206
                    type = DataTypes.INT;
207
                }
208
                if (strType.equals("Boolean")) {
209
                    type = DataTypes.BOOLEAN;
210
                }
211
                if (strType.equals("Date")) {
212
                    type = DataTypes.DATE;
213
                }
214
                break;
215
            case 2:
216
                size = ((Integer) aValue).intValue();
217

    
218
                // TODO: HACERLO BIEN
219
                // if (ead.getDataType()==DataTypes.STRING) {
220
                // ead.setPrecision(5);
221
                // }
222
            }
223
            EditableFeatureAttributeDescriptor ead =
224
                editableType.add(name, type, size);
225
            ead.setPrecision(precision);
226
        }
227

    
228
    }
229

    
230
    /**
231
     * This method initializes
232
     *
233
     * @throws DataException
234
     *
235
     */
236
    public FeatureTypeEditingPanel(FeatureStore fs) throws DataException {
237
        super();
238
        this.featureStore = fs;
239
        this.editableType = fs.getDefaultFeatureType().getEditable();
240
        this.panelNewField = new CreateNewAttributePanel(this.featureStore);
241

    
242
        initialize();
243
        // Add a new row
244
        TableModel tm;
245
        tm = new MyTableModel();
246
        getJTableFields().setModel(tm);
247
        // Esto lo a?ado aqu? porque si no tiene registros, no hace caso.
248
        // (Por eso no
249
        // lo pongo en getJTable()
250
        TableColumn typeColumn = jTableFields.getColumnModel().getColumn(1);
251
        JComboBox comboBox = new JComboBox();
252
        comboBox.addItem("Boolean");
253
        comboBox.addItem("Date");
254
        comboBox.addItem("Integer");
255
        comboBox.addItem("Double");
256
        comboBox.addItem("String");
257
        typeColumn.setCellEditor(new DefaultCellEditor(comboBox));
258

    
259
    }
260

    
261
    /**
262
     * This method initializes this
263
     *
264
     */
265
    private void initialize() {
266
        FlowLayout flowLayout = new FlowLayout();
267
        flowLayout.setVgap(5);
268
        flowLayout.setHgap(0);
269
        BorderLayout borderLayout = new BorderLayout();
270
        borderLayout.setHgap(15);
271
        borderLayout.setVgap(15);
272
        jLabel = new JLabel();
273
        jLabel.setText(PluginServices.getText(this, "add_delete_edit_fields")
274
            + ": ");
275
        this.setLayout(borderLayout);
276
        this.setSize(new java.awt.Dimension(663, 404));
277
        this.setPreferredSize(new java.awt.Dimension(getWidth(), getHeight()));
278
        JPanel jPanelNorth = new JPanel(new FlowLayout(FlowLayout.LEFT));
279
        jPanelNorth.add(jLabel);
280
        this.add(jPanelNorth, BorderLayout.NORTH);
281
        JPanel jPanelCenter =
282
            new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0));
283
        jPanelCenter.add(getJScrollPane());
284
        this.add(jPanelCenter, BorderLayout.CENTER);
285

    
286
        this.add(getJPanelButtons(), BorderLayout.EAST);
287
        JPanel jPanelSouth = new JPanel();
288
        jPanelSouth.setLayout(flowLayout);
289
        jPanelSouth.add(getJBtnOK(), null);
290
        jPanelSouth.add(getJBtnCancel(), null);
291
        this.add(jPanelSouth, BorderLayout.SOUTH);
292

    
293
    }
294

    
295
    public WindowInfo getWindowInfo() {
296
        if (windowInfo == null) {
297
            windowInfo =
298
                new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.PALETTE
299
                    | WindowInfo.RESIZABLE);
300
            windowInfo.setTitle(PluginServices.getText(this, "field_manager"));
301
            windowInfo.setHeight(this.getHeight());
302
            windowInfo.setWidth(this.getWidth());
303
        }
304
        return windowInfo;
305
    }
306

    
307
    // /**
308
    // * Convierte lo que hay en la tabla en una definici?n de campos adecuada
309
    // * para crear un LayerDefinition
310
    // *
311
    // * @return
312
    // */
313
    // public FieldDescription[] getFieldsDescription() {
314
    // DefaultTableModel tm = (DefaultTableModel) jTableFields.getModel();
315
    // FieldDescription[] fieldsDesc = new FieldDescription[tm.getRowCount()];
316
    //
317
    // for (int i = 0; i < tm.getRowCount(); i++) {
318
    // fieldsDesc[i] = new FieldDescription();
319
    // fieldsDesc[i].setFieldName((String) tm.getValueAt(i, 0));
320
    // String strType = (String) tm.getValueAt(i, 1);
321
    // if (strType.equals("String"))
322
    // fieldsDesc[i].setFieldType(Types.VARCHAR);
323
    // if (strType.equals("Double"))
324
    // fieldsDesc[i].setFieldType(Types.DOUBLE);
325
    // if (strType.equals("Integer"))
326
    // fieldsDesc[i].setFieldType(Types.INTEGER);
327
    // if (strType.equals("Boolean"))
328
    // fieldsDesc[i].setFieldType(Types.BOOLEAN);
329
    // if (strType.equals("Date"))
330
    // fieldsDesc[i].setFieldType(Types.DATE);
331
    // int fieldLength = Integer.parseInt((String) tm.getValueAt(i, 2));
332
    // fieldsDesc[i].setFieldLength(fieldLength);
333
    //
334
    // // TODO: HACERLO BIEN
335
    // if (strType.equals("Double"))
336
    // fieldsDesc[i].setFieldDecimalCount(5);
337
    //
338
    // }
339
    //
340
    // return fieldsDesc;
341
    // }
342

    
343
    /**
344
     * This method initializes jScrollPane
345
     *
346
     * @return javax.swing.JScrollPane
347
     */
348
    private JScrollPane getJScrollPane() {
349
        if (jScrollPane == null) {
350
            jScrollPane = new JScrollPane();
351
            jScrollPane.setPreferredSize(new java.awt.Dimension(482, 350));
352
            jScrollPane.setViewportView(getJTableFields());
353
        }
354
        return jScrollPane;
355
    }
356

    
357
    /**
358
     * This method initializes jTableFields
359
     *
360
     * @return javax.swing.JTable
361
     */
362
    private JTable getJTableFields() {
363
        if (jTableFields == null) {
364
            jTableFields = new JTable();
365
            jTableFields
366
                .setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
367

    
368
            jTableFields.setColumnSelectionAllowed(false);
369
            // Ask to be notified of selection changes.
370
            ListSelectionModel rowSM = jTableFields.getSelectionModel();
371
            rowSM.addListSelectionListener(new ListSelectionListener() {
372

    
373
                public void valueChanged(ListSelectionEvent e) {
374
                    // Ignore extra messages.
375
                    if (e.getValueIsAdjusting()) {
376
                        return;
377
                    }
378

    
379
                    ListSelectionModel lsm = (ListSelectionModel) e.getSource();
380
                    if (lsm.isSelectionEmpty()) {
381
                        // no rows are selected
382
                        jBtnDeleteField.setEnabled(false);
383
                    } else {
384
                        jBtnDeleteField.setEnabled(true);
385
                    }
386
                    if (jTableFields.getSelectedRows().length != 1) {
387
                        getJBtnRenameField().setEnabled(false);
388
                    } else {
389
                        getJBtnRenameField().setEnabled(true);
390
                    }
391

    
392
                }
393
            });
394

    
395
        }
396
        return jTableFields;
397
    }
398

    
399
    /**
400
     * This method initializes jBtnNewField
401
     *
402
     * @return javax.swing.JButton
403
     */
404
    private JButton getJBtnNewField() {
405
        if (jBtnNewField == null) {
406
            jBtnNewField =
407
                ToolsSwingLocator.getUsabilitySwingManager().createJButton();
408
            jBtnNewField.setText(PluginServices.getText(this, "new_field"));
409
            jBtnNewField.addActionListener(new java.awt.event.ActionListener() {
410

    
411
                private List<String> tempFieldNames = new ArrayList<String>();
412

    
413
                {
414
                    try {
415
                        int size = editableType.size();
416
                        for (int i = 0; i < size; i++) {
417
                            FeatureAttributeDescriptor ad =
418
                                (FeatureAttributeDescriptor) editableType
419
                                    .get(i);
420
                            tempFieldNames.add(ad.getName());
421
                        }
422
                    } catch (Exception ex) {
423
                        logger.warn("Can't initialize tempFieldNames", ex);
424
                    }
425
                }
426

    
427
                public void actionPerformed(java.awt.event.ActionEvent e) {
428
                    ActionListener okAction;
429
                    DataManager dataManager = DALLocator.getDataManager();
430
                    FeatureStoreProviderFactory factory =
431
                            (FeatureStoreProviderFactory) dataManager.
432
                            getStoreProviderFactory(featureStore.getProviderName());
433
                    panelNewField.setMaxAttributeNameSize(factory.getMaxAttributeNameSize());
434
                    okAction = new java.awt.event.ActionListener() {
435

    
436
                        public void actionPerformed(java.awt.event.ActionEvent e) {
437
                            try {
438
                                EditableFeatureAttributeDescriptor ead =
439
                                    panelNewField
440
                                        .loadFieldDescription(editableType);
441
                                if (ead == null) {
442
                                    return;
443
                                }
444
                                if (ead.getType() == DataTypes.STRING
445
                                    && ead.getSize() > TableOperations.MAX_FIELD_LENGTH) {
446
                                    NotificationManager.showMessageInfo(
447
                                        PluginServices.getText(this,
448
                                            "max_length_is")
449
                                            + ":"
450
                                            + TableOperations.MAX_FIELD_LENGTH,
451
                                        null);
452
                                    ead.setSize(TableOperations.MAX_FIELD_LENGTH);
453
                                }
454
                                tempFieldNames.add(ead.getName());
455
                                jTableFields.revalidate();
456
                                PluginServices.getMDIManager().closeWindow(
457
                                    panelNewField);
458
                            } catch (ParseException e2) {
459
                                NotificationManager.addError(e2);
460
                            }
461

    
462
                        }
463
                    };
464
                    panelNewField.setOkAction(okAction);
465
                    String[] names =
466
                        (String[]) tempFieldNames.toArray(new String[0]);
467
                    panelNewField.setCurrentFieldNames(names);
468
                    panelNewField =
469
                        (CreateNewAttributePanel) PluginServices
470
                            .getMDIManager().addWindow(panelNewField);
471
                }
472
            });
473
        }
474
        return jBtnNewField;
475
    }
476

    
477
    /**
478
     * This method initializes jButton
479
     *
480
     * @return javax.swing.JButton
481
     */
482
    private JButton getJBtnDelete() {
483
        if (jBtnDeleteField == null) {
484
            jBtnDeleteField =
485
                ToolsSwingLocator.getUsabilitySwingManager().createJButton();
486
            jBtnDeleteField.setText(PluginServices
487
                .getText(this, "delete_field"));
488
            jBtnDeleteField
489
                .addActionListener(new java.awt.event.ActionListener() {
490

    
491
                    public void actionPerformed(java.awt.event.ActionEvent e) {
492
                        int[] selecteds = jTableFields.getSelectedRows();
493
                        TableModel tm = jTableFields.getModel();
494

    
495
                        for (int i = selecteds.length - 1; i >= 0; i--) {
496
                            String fieldName =
497
                                (String) tm.getValueAt(selecteds[i], 0);
498

    
499
                            String old_geom_fld = editableType.getDefaultGeometryAttributeName();
500
                            if (old_geom_fld.compareTo(fieldName) == 0) {
501
                                JOptionPane.showMessageDialog(
502
                                    jTableFields,
503
                                    Messages.getText("_Cannot_delete_geometry_field"),
504
                                    Messages.getText("_Remove_column"),
505
                                    JOptionPane.WARNING_MESSAGE);
506
                                continue;
507
                            }
508

    
509
                            editableType.remove(fieldName);
510
                        }
511
                        jTableFields.getSelectionModel().clearSelection();
512
                        jTableFields.revalidate();
513
                    }
514
                });
515
        }
516
        return jBtnDeleteField;
517
    }
518

    
519
    /**
520
     * This method initializes jBtnRenameField
521
     *
522
     * @return javax.swing.JButton
523
     */
524
    private JButton getJBtnRenameField() {
525
        if (jBtnRenameField == null) {
526
            jBtnRenameField =
527
                ToolsSwingLocator.getUsabilitySwingManager().createJButton();
528
            jBtnRenameField.setText(PluginServices
529
                .getText(this, "rename_field"));
530
            jBtnRenameField
531
                .addActionListener(new java.awt.event.ActionListener() {
532

    
533
                    public void actionPerformed(java.awt.event.ActionEvent e) {
534
                        int[] selecteds = jTableFields.getSelectedRows();
535
                        TableModel tm = jTableFields.getModel();
536

    
537
                        for (int i = selecteds.length - 1; i >= 0; i--) {
538
                            String fieldName =
539
                                (String) tm.getValueAt(selecteds[i], 0);
540

    
541
                            String old_geom_fld = editableType.getDefaultGeometryAttributeName();
542
                            /*
543
                             * old_geom_fld is null if we are dealing with
544
                             * table (no geometry column)
545
                             */
546
                            if (old_geom_fld != null && old_geom_fld.compareTo(fieldName) == 0) {
547
                                JOptionPane.showMessageDialog(
548
                                    jTableFields,
549
                                    Messages.getText("_Cannot_rename_geometry_field"),
550
                                    Messages.getText("_Rename_column"),
551
                                    JOptionPane.WARNING_MESSAGE);
552
                                continue;
553
                            }
554

    
555
                            String newName =
556
                                JOptionPane.showInputDialog(
557
                                    (Component) PluginServices.getMDIManager()
558
                                        .getActiveWindow(), PluginServices
559
                                        .getText(this, "_Please_insert_new_field_name"),
560
                                    fieldName);
561
                            if (newName == null) {
562
                                continue;
563
                            }
564

    
565
                            if (newName.length() == 0)  {
566
                                JOptionPane.showMessageDialog(
567
                                        jTableFields,
568
                                        Messages.getText("_No_input_name"),
569
                                        Messages.getText("_Rename_column"),
570
                                        JOptionPane.ERROR_MESSAGE);
571
                                continue;
572
                            }
573

    
574
                            //In case there is a field length limit, it is validated
575
                            DataManager dataManager = DALLocator.getDataManager();
576
                            FeatureStoreProviderFactory factory =
577
                                (FeatureStoreProviderFactory) dataManager.
578
                                getStoreProviderFactory(featureStore.getProviderName());
579
                            if (factory.getMaxAttributeNameSize()>0){
580
                                if (newName.length()>factory.getMaxAttributeNameSize()){
581
                                    JOptionPane.showMessageDialog(
582
                                        jTableFields,
583
                                        Messages.getText("_Name_too_long"),
584
                                        Messages.getText("_Rename_column"),
585
                                        JOptionPane.ERROR_MESSAGE);
586
                                continue;
587
                                }
588
                            }
589

    
590
                            if (editableType.getIndex(newName) != -1) {
591
                                NotificationManager.showMessageInfo(
592
                                    PluginServices.getText(this,
593
                                        "field_already_exists"), null);
594
                                continue;
595
                            }
596

    
597
                            try {
598
                                EditableFeatureAttributeDescriptor efad =
599
                                    (EditableFeatureAttributeDescriptor)
600
                                    editableType.getAttributeDescriptor(fieldName);
601
                                efad.setName(newName);
602

    
603
                            } catch (Exception de) {
604
                                JOptionPane.showMessageDialog(
605
                                    jTableFields,
606
                                    Messages.getText("_Unable_to_rename_field")
607
                                    + ": " + de.getMessage(),
608
                                    Messages.getText("_Rename_column"),
609
                                    JOptionPane.ERROR_MESSAGE);
610
                            }
611
                        }
612
                        jTableFields.repaint();
613
                    }
614
                });
615
        }
616
        return jBtnRenameField;
617
    }
618

    
619
    /**
620
     * This method initializes jBtnOK
621
     *
622
     * @return javax.swing.JButton
623
     */
624
    private JButton getJBtnOK() {
625
        if (jBtnOK == null) {
626
            jBtnOK =
627
                ToolsSwingLocator.getUsabilitySwingManager().createJButton();
628
            jBtnOK.setText(PluginServices.getText(this, "aceptar"));
629
            jBtnOK.addActionListener(new java.awt.event.ActionListener() {
630

    
631
                public void actionPerformed(java.awt.event.ActionEvent e) {
632
                    try {
633
                        featureStore.update(editableType);
634
                    } catch (DataException e1) {
635
                        NotificationManager.showMessageError(PluginServices
636
                            .getText(this, "update_featuretype_error"), e1);
637
                    }
638
                    PluginServices.getMDIManager().closeWindow(
639
                        FeatureTypeEditingPanel.this);
640
                }
641
            });
642
        }
643
        return jBtnOK;
644
    }
645

    
646
    /**
647
     * This method initializes jButton
648
     *
649
     * @return javax.swing.JButton
650
     */
651
    private JButton getJBtnCancel() {
652
        if (jBtnCancel == null) {
653
            jBtnCancel =
654
                ToolsSwingLocator.getUsabilitySwingManager().createJButton();
655
            jBtnCancel.setText(PluginServices.getText(this, "cancelar"));
656
            jBtnCancel.addActionListener(new java.awt.event.ActionListener() {
657

    
658
                public void actionPerformed(java.awt.event.ActionEvent e) {
659
                    PluginServices.getMDIManager().closeWindow(
660
                        FeatureTypeEditingPanel.this);
661
                }
662
            });
663
            // jBtnCancel.setVisible(false);
664
        }
665
        return jBtnCancel;
666
    }
667

    
668
    /**
669
     * This method initializes jPanelButtons
670
     *
671
     * @return javax.swing.JPanel
672
     */
673
    private JPanel getJPanelButtons() {
674
        if (jPanelButtons == null) {
675
            jPanelButtons = new JPanel();
676
            JPanel aux = new JPanel(new GridLayout(3, 1));
677
            aux.add(getJBtnNewField());
678
            aux.add(getJBtnRenameField());
679
            aux.add(getJBtnDelete());
680
            jPanelButtons.add(aux, BorderLayout.NORTH);
681
        }
682
        return jPanelButtons;
683
    }
684

    
685
    public Object getWindowProfile() {
686
        return WindowInfo.DIALOG_PROFILE;
687
    }
688

    
689
}