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