01: package org.apache.ojb.tools.mapping.reversedb2.propertyEditors;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import org.apache.ojb.tools.mapping.reversedb2.dbmetatreemodel.DBMetaSchemaNode;
19:
20: /**
21: * This is an implementation of a PropertyEditor for the DBMetaSchemaNode class.
22: *
23: * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a>
24: * @version $Id: JPnlPropertyEditorDBMetaSchema.java,v 1.1.2.1 2005/12/21 22:33:27 tomdz Exp $
25: */
26: public class JPnlPropertyEditorDBMetaSchema extends PropertyEditor {
27:
28: /** Creates new form JPnlPropertyEditorDBMetaCatalog */
29: public JPnlPropertyEditorDBMetaSchema() {
30: initComponents();
31: setPropertyChangeListener(new SchemaPropertyChangeListener());
32: }
33:
34: /** This method is called from within the constructor to
35: * initialize the form.
36: * WARNING: Do NOT modify this code. The content of this method is
37: * always regenerated by the Form Editor.
38: */
39: private void initComponents()//GEN-BEGIN:initComponents
40: {
41: java.awt.GridBagConstraints gridBagConstraints;
42:
43: lblSchemaName = new javax.swing.JLabel();
44: tfSchemaName = new javax.swing.JTextField();
45:
46: setLayout(new java.awt.GridBagLayout());
47:
48: lblSchemaName.setText("Schema Name:");
49: gridBagConstraints = new java.awt.GridBagConstraints();
50: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
51: add(lblSchemaName, gridBagConstraints);
52:
53: tfSchemaName.setEditable(false);
54: tfSchemaName.setText("jTextField1");
55: tfSchemaName.setBorder(null);
56: gridBagConstraints = new java.awt.GridBagConstraints();
57: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
58: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
59: gridBagConstraints.weightx = 1.0;
60: gridBagConstraints.weighty = 1.0;
61: add(tfSchemaName, gridBagConstraints);
62:
63: }//GEN-END:initComponents
64:
65: public void setEditorTarget(PropertyEditorTarget target) {
66: if (target instanceof DBMetaSchemaNode) {
67: super .setEditorTarget(target);
68: this .tfSchemaName.setText((String) target
69: .getAttribute(DBMetaSchemaNode.ATT_SCHEMA_NAME));
70: } else {
71: throw new UnsupportedOperationException(
72: "This editor can only edit DBSchemaCatalogNode objects");
73: }
74: }
75:
76: // Variables declaration - do not modify//GEN-BEGIN:variables
77: private javax.swing.JLabel lblSchemaName;
78: private javax.swing.JTextField tfSchemaName;
79:
80: // End of variables declaration//GEN-END:variables
81:
82: public class SchemaPropertyChangeListener implements
83: java.beans.PropertyChangeListener {
84: public void propertyChange(
85: java.beans.PropertyChangeEvent propertyChangeEvent) {
86: if (propertyChangeEvent.getPropertyName() == (DBMetaSchemaNode.ATT_SCHEMA_NAME)) {
87: tfSchemaName.setText((String) propertyChangeEvent
88: .getNewValue());
89: }
90: }
91: }
92:
93: }
|