1 package org.apache.ojb.tools.mapping.reversedb2.propertyEditors; 2 3 17 18 import org.apache.ojb.tools.mapping.reversedb2.dbmetatreemodel.DBMetaTableNode; 19 20 26 public class JPnlPropertyEditorDBMetaTable extends PropertyEditor 27 { 28 29 30 public JPnlPropertyEditorDBMetaTable () 31 { 32 initComponents (); 33 } 34 35 40 private void initComponents() { 42 java.awt.GridBagConstraints gridBagConstraints; 43 44 lblTableName = new javax.swing.JLabel (); 45 tfTableName = new javax.swing.JTextField (); 46 47 setLayout(new java.awt.GridBagLayout ()); 48 49 lblTableName.setText("Table Name:"); 50 gridBagConstraints = new java.awt.GridBagConstraints (); 51 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 52 add(lblTableName, gridBagConstraints); 53 54 tfTableName.setEditable(false); 55 tfTableName.setText("jTextField1"); 56 tfTableName.setBorder(null); 57 gridBagConstraints = new java.awt.GridBagConstraints (); 58 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 59 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 60 gridBagConstraints.weightx = 1.0; 61 gridBagConstraints.weighty = 1.0; 62 add(tfTableName, gridBagConstraints); 63 64 } 66 public void setEditorTarget (PropertyEditorTarget target) 67 { 68 if (target instanceof DBMetaTableNode) 69 { 70 super.setEditorTarget(target); 71 this.tfTableName.setText((String )target.getAttribute(DBMetaTableNode.ATT_TABLE_NAME)); 72 } 73 else 74 { 75 throw new UnsupportedOperationException ("This editor can only edit DBMetaTableNode objects"); 76 } 77 } 78 79 80 private javax.swing.JTextField tfTableName; 82 private javax.swing.JLabel lblTableName; 83 85 public class CatalogPropertyChangeListener implements java.beans.PropertyChangeListener 86 { 87 public void propertyChange (java.beans.PropertyChangeEvent propertyChangeEvent) 88 { 89 if (propertyChangeEvent.getPropertyName() == (DBMetaTableNode.ATT_TABLE_NAME)) 90 { 91 tfTableName.setText((String )propertyChangeEvent.getNewValue()); 92 } 93 } 94 } 95 96 } 97 | Popular Tags |