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