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