Revision 6828 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/dialogs/DlgFieldManager.java
DlgFieldManager.java | ||
---|---|---|
77 | 77 |
public class DlgFieldManager extends JPanel implements View { |
78 | 78 |
|
79 | 79 |
/** |
80 |
*
|
|
80 |
* |
|
81 | 81 |
*/ |
82 | 82 |
private static final long serialVersionUID = -4284879326692474318L; |
83 | 83 |
|
... | ... | |
98 | 98 |
private JButton jBtnOK = null; |
99 | 99 |
|
100 | 100 |
private JButton jBtnCancel = null; |
101 |
|
|
101 |
|
|
102 | 102 |
private FPanelCreateField panelNewField = new FPanelCreateField(); |
103 | 103 |
|
104 | 104 |
// private IFieldManager fieldManager;; |
... | ... | |
175 | 175 |
return new Integer(aux.getFieldDecimalCount()); |
176 | 176 |
case 4: |
177 | 177 |
return aux.getDefaultValue(); |
178 |
|
|
178 |
|
|
179 | 179 |
} |
180 | 180 |
} catch (DriverLoadException e) { |
181 | 181 |
e.printStackTrace(); |
... | ... | |
201 | 201 |
return PluginServices.getText(this, "FieldDecimalCount"); |
202 | 202 |
case 4: |
203 | 203 |
return PluginServices.getText(this, "FieldDefaultValue"); |
204 |
|
|
204 |
|
|
205 | 205 |
} |
206 | 206 |
return super.getColumnName(column); |
207 | 207 |
} |
... | ... | |
255 | 255 |
|
256 | 256 |
/** |
257 | 257 |
* This method initializes |
258 |
*
|
|
258 |
* |
|
259 | 259 |
*/ |
260 | 260 |
public DlgFieldManager(IEditableSource ies) { |
261 | 261 |
super(); |
... | ... | |
289 | 289 |
|
290 | 290 |
/** |
291 | 291 |
* This method initializes this |
292 |
*
|
|
292 |
* |
|
293 | 293 |
*/ |
294 | 294 |
private void initialize() { |
295 | 295 |
jLabel = new JLabel(); |
296 | 296 |
jLabel.setBounds(new java.awt.Rectangle(14, 9, 361, 34)); |
297 |
jLabel.setText("Puede a?adir, borrar o renombrar los campos:");
|
|
297 |
jLabel.setText(PluginServices.getText(this, "add_delete_edit_fields")+": ");
|
|
298 | 298 |
this.setLayout(null); |
299 | 299 |
this.setSize(new java.awt.Dimension(462,327)); |
300 | 300 |
this.add(jLabel, null); |
... | ... | |
311 | 311 |
if (viewInfo == null) { |
312 | 312 |
viewInfo = new ViewInfo(ViewInfo.MODALDIALOG | ViewInfo.PALETTE |
313 | 313 |
| ViewInfo.RESIZABLE); |
314 |
viewInfo.setTitle(PluginServices.getText(this, "field_manager")); |
|
314 | 315 |
} |
315 | 316 |
return viewInfo; |
316 | 317 |
} |
... | ... | |
318 | 319 |
/** |
319 | 320 |
* Convierte lo que hay en la tabla en una definici?n de campos adecuada |
320 | 321 |
* para crear un LayerDefinition |
321 |
*
|
|
322 |
* |
|
322 | 323 |
* @return |
323 | 324 |
*/ |
324 | 325 |
public FieldDescription[] getFieldsDescription() { |
... | ... | |
353 | 354 |
|
354 | 355 |
/** |
355 | 356 |
* This method initializes jScrollPane |
356 |
*
|
|
357 |
* |
|
357 | 358 |
* @return javax.swing.JScrollPane |
358 | 359 |
*/ |
359 | 360 |
private JScrollPane getJScrollPane() { |
... | ... | |
367 | 368 |
|
368 | 369 |
/** |
369 | 370 |
* This method initializes jTableFields |
370 |
*
|
|
371 |
* |
|
371 | 372 |
* @return javax.swing.JTable |
372 | 373 |
*/ |
373 | 374 |
private JTable getJTableFields() { |
... | ... | |
400 | 401 |
{ |
401 | 402 |
getJBtnRenameField().setEnabled(true); |
402 | 403 |
} |
403 |
|
|
404 |
|
|
404 | 405 |
} |
405 | 406 |
}); |
406 | 407 |
|
... | ... | |
410 | 411 |
|
411 | 412 |
/** |
412 | 413 |
* This method initializes jBtnNewField |
413 |
*
|
|
414 |
* |
|
414 | 415 |
* @return javax.swing.JButton |
415 | 416 |
*/ |
416 | 417 |
private JButton getJBtnNewField() { |
... | ... | |
419 | 420 |
jBtnNewField.setBounds(new java.awt.Rectangle(332,60,118,25)); |
420 | 421 |
jBtnNewField.setText(PluginServices.getText(this, "New Field")); |
421 | 422 |
jBtnNewField.addActionListener(new java.awt.event.ActionListener() { |
422 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
423 |
|
|
423 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
424 |
|
|
424 | 425 |
ActionListener okAction; |
425 | 426 |
okAction = new java.awt.event.ActionListener() { |
426 | 427 |
public void actionPerformed(java.awt.event.ActionEvent e){ |
... | ... | |
435 | 436 |
} |
436 | 437 |
edAdapter.addField(fld); |
437 | 438 |
jTableFields.revalidate(); |
438 |
PluginServices.getMDIManager().closeView(panelNewField);
|
|
439 |
PluginServices.getMDIManager().closeView(panelNewField); |
|
439 | 440 |
} catch (EditionException e1) { |
440 | 441 |
NotificationManager.addError(e1); |
441 | 442 |
} catch (ParseException e2) { |
... | ... | |
446 | 447 |
NotificationManager.addError(e3); |
447 | 448 |
} |
448 | 449 |
|
449 |
|
|
450 |
|
|
450 | 451 |
} |
451 | 452 |
}; |
452 | 453 |
panelNewField.setOkAction(okAction); |
... | ... | |
459 | 460 |
|
460 | 461 |
/** |
461 | 462 |
* This method initializes jButton |
462 |
*
|
|
463 |
* |
|
463 | 464 |
* @return javax.swing.JButton |
464 | 465 |
*/ |
465 | 466 |
private JButton getJButton() { |
466 | 467 |
if (jBtnDeleteField == null) { |
467 | 468 |
jBtnDeleteField = new JButton(); |
468 | 469 |
jBtnDeleteField.setBounds(new java.awt.Rectangle(332,90,118,25)); |
469 |
jBtnDeleteField.setText("Delete Field");
|
|
470 |
jBtnDeleteField.setText(PluginServices.getText(this, "delete_field"));
|
|
470 | 471 |
jBtnDeleteField |
471 | 472 |
.addActionListener(new java.awt.event.ActionListener() { |
472 | 473 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
473 | 474 |
int[] selecteds = jTableFields.getSelectedRows(); |
474 | 475 |
TableModel tm = jTableFields.getModel(); |
475 |
|
|
476 | 476 |
|
477 |
|
|
477 | 478 |
for (int i = selecteds.length - 1; i >= 0; i--) |
478 | 479 |
{ |
479 | 480 |
String fieldName = (String) tm.getValueAt(selecteds[i],0); |
... | ... | |
494 | 495 |
|
495 | 496 |
/** |
496 | 497 |
* This method initializes jBtnRenameField |
497 |
*
|
|
498 |
* |
|
498 | 499 |
* @return javax.swing.JButton |
499 | 500 |
*/ |
500 | 501 |
private JButton getJBtnRenameField() { |
... | ... | |
502 | 503 |
jBtnRenameField = new JButton(); |
503 | 504 |
jBtnRenameField |
504 | 505 |
.setBounds(new java.awt.Rectangle(332,120,118,25)); |
505 |
jBtnRenameField.setText("Rename Field...");
|
|
506 |
jBtnRenameField.setText(PluginServices.getText(this, "rename_field") +"...");
|
|
506 | 507 |
jBtnRenameField.addActionListener(new java.awt.event.ActionListener() { |
507 | 508 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
508 | 509 |
int[] selecteds = jTableFields.getSelectedRows(); |
509 | 510 |
TableModel tm = jTableFields.getModel(); |
510 |
|
|
511 | 511 |
|
512 |
|
|
512 | 513 |
for (int i = selecteds.length - 1; i >= 0; i--) |
513 | 514 |
{ |
514 | 515 |
String fieldName = (String) tm.getValueAt(selecteds[i],0); |
515 | 516 |
try { |
516 | 517 |
String newName = JOptionPane.showInputDialog( |
517 |
(Component) PluginServices.getMDIManager().getActiveView(),
|
|
518 |
(Component) PluginServices.getMDIManager().getActiveView(), |
|
518 | 519 |
PluginServices.getText(this, "please_insert_new_field_name"), |
519 | 520 |
fieldName |
520 | 521 |
); |
... | ... | |
526 | 527 |
PluginServices.getText(this, "field_already_exists")); |
527 | 528 |
return; |
528 | 529 |
} |
529 |
|
|
530 | 530 |
|
531 |
|
|
531 | 532 |
edAdapter.renameField(fieldName, newName); |
532 | 533 |
} catch (EditionException e1) { |
533 | 534 |
// TODO Auto-generated catch block |
... | ... | |
541 | 542 |
} |
542 | 543 |
} |
543 | 544 |
jTableFields.repaint(); |
544 |
|
|
545 |
|
|
545 | 546 |
} |
546 | 547 |
}); |
547 | 548 |
} |
... | ... | |
550 | 551 |
|
551 | 552 |
/** |
552 | 553 |
* This method initializes jBtnOK |
553 |
*
|
|
554 |
* |
|
554 | 555 |
* @return javax.swing.JButton |
555 | 556 |
*/ |
556 | 557 |
private JButton getJBtnOK() { |
557 | 558 |
if (jBtnOK == null) { |
558 | 559 |
jBtnOK = new JButton(); |
559 | 560 |
jBtnOK.setBounds(new java.awt.Rectangle(134,278,91,23)); |
560 |
jBtnOK.setText("Aceptar");
|
|
561 |
jBtnOK.setText(PluginServices.getText(this, "aceptar"));
|
|
561 | 562 |
jBtnOK.addActionListener(new java.awt.event.ActionListener() { |
562 | 563 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
563 | 564 |
PluginServices.getMDIManager().closeView(DlgFieldManager.this); |
... | ... | |
569 | 570 |
|
570 | 571 |
/** |
571 | 572 |
* This method initializes jButton |
572 |
*
|
|
573 |
* |
|
573 | 574 |
* @return javax.swing.JButton |
574 | 575 |
*/ |
575 | 576 |
private JButton getJButton2() { |
576 | 577 |
if (jBtnCancel == null) { |
577 | 578 |
jBtnCancel = new JButton(); |
578 | 579 |
jBtnCancel.setBounds(new java.awt.Rectangle(239,278,91,23)); |
579 |
jBtnCancel.setText("Cancelar");
|
|
580 |
jBtnCancel.setText(PluginServices.getText(this, "cancelar"));
|
|
580 | 581 |
jBtnCancel.addActionListener(new java.awt.event.ActionListener() { |
581 | 582 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
582 | 583 |
PluginServices.getMDIManager().closeView(DlgFieldManager.this); |
Also available in: Unified diff