KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > tools > mapping > reversedb > gui > DBSchemaPropertySheet


1 package org.apache.ojb.tools.mapping.reversedb.gui;
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 /**
19  *
20  * @author <a HREF="mailto:bfl@florianbruckner.com">Florian Bruckner</a>
21  * @version $Id: DBSchemaPropertySheet.java,v 1.1.2.1 2005/12/21 22:32:02 tomdz Exp $
22  */

23 public class DBSchemaPropertySheet extends javax.swing.JPanel JavaDoc
24   implements PropertySheetView
25 {
26     org.apache.ojb.tools.mapping.reversedb.DBSchema aSchema;
27   /** Creates new form DBCatalogPropertySheet */
28   public DBSchemaPropertySheet ()
29   {
30     initComponents ();
31   }
32   
33   private void readValuesFromSchema()
34   {
35     this.tfSchemaName.setText(aSchema.getSchemaName());
36     this.cbEnabled.setSelected(aSchema.isEnabled());
37     this.cbDisabledByParent.setSelected(!aSchema.getDBCatalog().isTreeEnabled ());
38   }
39   
40   /** This method is called from within the constructor to
41    * initialize the form.
42    * WARNING: Do NOT modify this code. The content of this method is
43    * always regenerated by the Form Editor.
44    */

45     private void initComponents()//GEN-BEGIN:initComponents
46
{
47         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
48
49         jPanel1 = new javax.swing.JPanel JavaDoc();
50         lblEnabled = new javax.swing.JLabel JavaDoc();
51         cbEnabled = new javax.swing.JCheckBox JavaDoc();
52         lblDisabledByParent = new javax.swing.JLabel JavaDoc();
53         cbDisabledByParent = new javax.swing.JCheckBox JavaDoc();
54         jLabel4 = new javax.swing.JLabel JavaDoc();
55         jLabel3 = new javax.swing.JLabel JavaDoc();
56         lblSchemaName = new javax.swing.JLabel JavaDoc();
57         tfSchemaName = new javax.swing.JTextField JavaDoc();
58
59         setLayout(new java.awt.GridBagLayout JavaDoc());
60
61         addComponentListener(new java.awt.event.ComponentAdapter JavaDoc()
62         {
63             public void componentShown(java.awt.event.ComponentEvent JavaDoc evt)
64             {
65                 formComponentShown(evt);
66             }
67             public void componentHidden(java.awt.event.ComponentEvent JavaDoc evt)
68             {
69                 formComponentHidden(evt);
70             }
71         });
72
73         addHierarchyListener(new java.awt.event.HierarchyListener JavaDoc()
74         {
75             public void hierarchyChanged(java.awt.event.HierarchyEvent JavaDoc evt)
76             {
77                 formHierarchyChanged(evt);
78             }
79         });
80
81         jPanel1.setLayout(new java.awt.GridLayout JavaDoc(4, 2));
82
83         lblEnabled.setText("enabled");
84         lblEnabled.setDisplayedMnemonic('e');
85         jPanel1.add(lblEnabled);
86
87         cbEnabled.setMnemonic('e');
88         cbEnabled.addActionListener(new java.awt.event.ActionListener JavaDoc()
89         {
90             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
91             {
92                 cbEnabledActionPerformed(evt);
93             }
94         });
95
96         jPanel1.add(cbEnabled);
97
98         lblDisabledByParent.setText("disabled by Parent:");
99         jPanel1.add(lblDisabledByParent);
100
101         cbDisabledByParent.setEnabled(false);
102         cbDisabledByParent.addActionListener(new java.awt.event.ActionListener JavaDoc()
103         {
104             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
105             {
106                 cbDisabledByParentActionPerformed(evt);
107             }
108         });
109
110         jPanel1.add(cbDisabledByParent);
111
112         jPanel1.add(jLabel4);
113
114         jPanel1.add(jLabel3);
115
116         lblSchemaName.setText("Schema Name:");
117         lblSchemaName.setLabelFor(tfSchemaName);
118         jPanel1.add(lblSchemaName);
119
120         tfSchemaName.setEditable(false);
121         tfSchemaName.setText("jTextField1");
122         tfSchemaName.setBorder(null);
123         jPanel1.add(tfSchemaName);
124
125         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
126         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
127         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
128         gridBagConstraints.weightx = 1.0;
129         gridBagConstraints.weighty = 1.0;
130         add(jPanel1, gridBagConstraints);
131
132     }//GEN-END:initComponents
133

134   private void cbEnabledActionPerformed (java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_cbEnabledActionPerformed
135
{//GEN-HEADEREND:event_cbEnabledActionPerformed
136
// Add your handling code here:
137
this.aSchema.setEnabled(cbEnabled.isSelected());
138   }//GEN-LAST:event_cbEnabledActionPerformed
139

140   private void cbDisabledByParentActionPerformed (java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_cbDisabledByParentActionPerformed
141
{//GEN-HEADEREND:event_cbDisabledByParentActionPerformed
142
// Add your handling code here:
143
}//GEN-LAST:event_cbDisabledByParentActionPerformed
144

145   private void formHierarchyChanged (java.awt.event.HierarchyEvent JavaDoc evt)//GEN-FIRST:event_formHierarchyChanged
146
{//GEN-HEADEREND:event_formHierarchyChanged
147
// Add your handling code here:
148
readValuesFromSchema();
149   }//GEN-LAST:event_formHierarchyChanged
150

151   private void formComponentHidden (java.awt.event.ComponentEvent JavaDoc evt)//GEN-FIRST:event_formComponentHidden
152
{//GEN-HEADEREND:event_formComponentHidden
153
// Add your handling code here:
154
}//GEN-LAST:event_formComponentHidden
155

156   private void formComponentShown (java.awt.event.ComponentEvent JavaDoc evt)//GEN-FIRST:event_formComponentShown
157
{//GEN-HEADEREND:event_formComponentShown
158
// Add your handling code here:
159
}//GEN-LAST:event_formComponentShown
160

161   public void setModel (PropertySheetModel pm)
162   {
163     if (pm instanceof org.apache.ojb.tools.mapping.reversedb.DBSchema)
164     {
165       this.aSchema = (org.apache.ojb.tools.mapping.reversedb.DBSchema)pm;
166       this.readValuesFromSchema();
167     }
168     else
169       throw new IllegalArgumentException JavaDoc();
170     
171   }
172   
173   
174     // Variables declaration - do not modify//GEN-BEGIN:variables
175
private javax.swing.JCheckBox JavaDoc cbDisabledByParent;
176     private javax.swing.JPanel JavaDoc jPanel1;
177     private javax.swing.JLabel JavaDoc lblEnabled;
178     private javax.swing.JLabel JavaDoc lblSchemaName;
179     private javax.swing.JCheckBox JavaDoc cbEnabled;
180     private javax.swing.JTextField JavaDoc tfSchemaName;
181     private javax.swing.JLabel JavaDoc lblDisabledByParent;
182     private javax.swing.JLabel JavaDoc jLabel4;
183     private javax.swing.JLabel JavaDoc jLabel3;
184     // End of variables declaration//GEN-END:variables
185

186 }
187
188 /***************************** changelog *****************************
189 // $log$
190 /***************************** changelog *****************************/

191
Popular Tags