KickJava   Java API By Example, From Geeks To Geeks.

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


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.DBMetaCatalogNode;
19
20 /**
21  * This is an implementation of a PropertyEditor for the DBMetaCatalogNode.
22  *
23  * @author <a HREF="mailto:bfl@florianbruckner.com">Florian Bruckner</a>
24  * @version $Id: JPnlPropertyEditorDBMetaCatalog.java,v 1.1.2.1 2005/12/21 22:33:27 tomdz Exp $
25  */

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

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

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

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