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