KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > tools > mapping > reversedb2 > propertyEditors > JPnlPropertyEditorDBMetaTable


1 package org.apache.ojb.tools.mapping.reversedb2.propertyEditors;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * 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.DBMetaTableNode;
19
20 /**
21  * This is an implementation of a PropertyEditor for the DBMetaTableNode.
22  *
23  * @author <a HREF="mailto:bfl@florianbruckner.com">Florian Bruckner</a>
24  * @version $Id: JPnlPropertyEditorDBMetaTable.java,v 1.1.2.1 2005/12/21 22:33:27 tomdz Exp $
25  */

26 public class JPnlPropertyEditorDBMetaTable extends PropertyEditor
27 {
28     
29     /** Creates new form JPnlPropertyEditorDBMetaCatalog */
30     public JPnlPropertyEditorDBMetaTable ()
31     {
32         initComponents ();
33     }
34     
35     /** This method is called from within the constructor to
36      * initialize the form.
37      * WARNING: Do NOT modify this code. The content of this method is
38      * always regenerated by the Form Editor.
39      */

40     private void initComponents()//GEN-BEGIN:initComponents
41
{
42         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
43
44         lblTableName = new javax.swing.JLabel JavaDoc();
45         tfTableName = new javax.swing.JTextField JavaDoc();
46
47         setLayout(new java.awt.GridBagLayout JavaDoc());
48
49         lblTableName.setText("Table Name:");
50         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc();
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     }//GEN-END:initComponents
65

66     public void setEditorTarget (PropertyEditorTarget target)
67     {
68         if (target instanceof DBMetaTableNode)
69         {
70             super.setEditorTarget(target);
71             this.tfTableName.setText((String JavaDoc)target.getAttribute(DBMetaTableNode.ATT_TABLE_NAME));
72         }
73         else
74         {
75             throw new UnsupportedOperationException JavaDoc("This editor can only edit DBMetaTableNode objects");
76         }
77     }
78     
79     
80     // Variables declaration - do not modify//GEN-BEGIN:variables
81
private javax.swing.JTextField JavaDoc tfTableName;
82     private javax.swing.JLabel JavaDoc lblTableName;
83     // End of variables declaration//GEN-END:variables
84

85     public class CatalogPropertyChangeListener implements java.beans.PropertyChangeListener JavaDoc
86     {
87         public void propertyChange (java.beans.PropertyChangeEvent JavaDoc propertyChangeEvent)
88         {
89             if (propertyChangeEvent.getPropertyName() == (DBMetaTableNode.ATT_TABLE_NAME))
90             {
91                 tfTableName.setText((String JavaDoc)propertyChangeEvent.getNewValue());
92             }
93         }
94     }
95     
96 }
97
Popular Tags