001: package org.apache.ojb.tools.mapping.reversedb.gui;
002:
003: /* Copyright 2002-2005 The Apache Software Foundation
004: *
005: * Licensed under the Apache License, Version 2.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /**
019: *
020: * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a>
021: * @version $Id: DBSchemaPropertySheet.java,v 1.1.2.1 2005/12/21 22:32:02 tomdz Exp $
022: */
023: public class DBSchemaPropertySheet extends javax.swing.JPanel implements
024: PropertySheetView {
025: org.apache.ojb.tools.mapping.reversedb.DBSchema aSchema;
026:
027: /** Creates new form DBCatalogPropertySheet */
028: public DBSchemaPropertySheet() {
029: initComponents();
030: }
031:
032: private void readValuesFromSchema() {
033: this .tfSchemaName.setText(aSchema.getSchemaName());
034: this .cbEnabled.setSelected(aSchema.isEnabled());
035: this .cbDisabledByParent.setSelected(!aSchema.getDBCatalog()
036: .isTreeEnabled());
037: }
038:
039: /** This method is called from within the constructor to
040: * initialize the form.
041: * WARNING: Do NOT modify this code. The content of this method is
042: * always regenerated by the Form Editor.
043: */
044: private void initComponents()//GEN-BEGIN:initComponents
045: {
046: java.awt.GridBagConstraints gridBagConstraints;
047:
048: jPanel1 = new javax.swing.JPanel();
049: lblEnabled = new javax.swing.JLabel();
050: cbEnabled = new javax.swing.JCheckBox();
051: lblDisabledByParent = new javax.swing.JLabel();
052: cbDisabledByParent = new javax.swing.JCheckBox();
053: jLabel4 = new javax.swing.JLabel();
054: jLabel3 = new javax.swing.JLabel();
055: lblSchemaName = new javax.swing.JLabel();
056: tfSchemaName = new javax.swing.JTextField();
057:
058: setLayout(new java.awt.GridBagLayout());
059:
060: addComponentListener(new java.awt.event.ComponentAdapter() {
061: public void componentShown(java.awt.event.ComponentEvent evt) {
062: formComponentShown(evt);
063: }
064:
065: public void componentHidden(
066: java.awt.event.ComponentEvent evt) {
067: formComponentHidden(evt);
068: }
069: });
070:
071: addHierarchyListener(new java.awt.event.HierarchyListener() {
072: public void hierarchyChanged(
073: java.awt.event.HierarchyEvent evt) {
074: formHierarchyChanged(evt);
075: }
076: });
077:
078: jPanel1.setLayout(new java.awt.GridLayout(4, 2));
079:
080: lblEnabled.setText("enabled");
081: lblEnabled.setDisplayedMnemonic('e');
082: jPanel1.add(lblEnabled);
083:
084: cbEnabled.setMnemonic('e');
085: cbEnabled
086: .addActionListener(new java.awt.event.ActionListener() {
087: public void actionPerformed(
088: java.awt.event.ActionEvent evt) {
089: cbEnabledActionPerformed(evt);
090: }
091: });
092:
093: jPanel1.add(cbEnabled);
094:
095: lblDisabledByParent.setText("disabled by Parent:");
096: jPanel1.add(lblDisabledByParent);
097:
098: cbDisabledByParent.setEnabled(false);
099: cbDisabledByParent
100: .addActionListener(new java.awt.event.ActionListener() {
101: public void actionPerformed(
102: java.awt.event.ActionEvent evt) {
103: cbDisabledByParentActionPerformed(evt);
104: }
105: });
106:
107: jPanel1.add(cbDisabledByParent);
108:
109: jPanel1.add(jLabel4);
110:
111: jPanel1.add(jLabel3);
112:
113: lblSchemaName.setText("Schema Name:");
114: lblSchemaName.setLabelFor(tfSchemaName);
115: jPanel1.add(lblSchemaName);
116:
117: tfSchemaName.setEditable(false);
118: tfSchemaName.setText("jTextField1");
119: tfSchemaName.setBorder(null);
120: jPanel1.add(tfSchemaName);
121:
122: gridBagConstraints = new java.awt.GridBagConstraints();
123: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
124: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
125: gridBagConstraints.weightx = 1.0;
126: gridBagConstraints.weighty = 1.0;
127: add(jPanel1, gridBagConstraints);
128:
129: }//GEN-END:initComponents
130:
131: private void cbEnabledActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cbEnabledActionPerformed
132: {//GEN-HEADEREND:event_cbEnabledActionPerformed
133: // Add your handling code here:
134: this .aSchema.setEnabled(cbEnabled.isSelected());
135: }//GEN-LAST:event_cbEnabledActionPerformed
136:
137: private void cbDisabledByParentActionPerformed(
138: java.awt.event.ActionEvent evt)//GEN-FIRST:event_cbDisabledByParentActionPerformed
139: {//GEN-HEADEREND:event_cbDisabledByParentActionPerformed
140: // Add your handling code here:
141: }//GEN-LAST:event_cbDisabledByParentActionPerformed
142:
143: private void formHierarchyChanged(java.awt.event.HierarchyEvent evt)//GEN-FIRST:event_formHierarchyChanged
144: {//GEN-HEADEREND:event_formHierarchyChanged
145: // Add your handling code here:
146: readValuesFromSchema();
147: }//GEN-LAST:event_formHierarchyChanged
148:
149: private void formComponentHidden(java.awt.event.ComponentEvent evt)//GEN-FIRST:event_formComponentHidden
150: {//GEN-HEADEREND:event_formComponentHidden
151: // Add your handling code here:
152: }//GEN-LAST:event_formComponentHidden
153:
154: private void formComponentShown(java.awt.event.ComponentEvent evt)//GEN-FIRST:event_formComponentShown
155: {//GEN-HEADEREND:event_formComponentShown
156: // Add your handling code here:
157: }//GEN-LAST:event_formComponentShown
158:
159: public void setModel(PropertySheetModel pm) {
160: if (pm instanceof org.apache.ojb.tools.mapping.reversedb.DBSchema) {
161: this .aSchema = (org.apache.ojb.tools.mapping.reversedb.DBSchema) pm;
162: this .readValuesFromSchema();
163: } else
164: throw new IllegalArgumentException();
165:
166: }
167:
168: // Variables declaration - do not modify//GEN-BEGIN:variables
169: private javax.swing.JCheckBox cbDisabledByParent;
170: private javax.swing.JPanel jPanel1;
171: private javax.swing.JLabel lblEnabled;
172: private javax.swing.JLabel lblSchemaName;
173: private javax.swing.JCheckBox cbEnabled;
174: private javax.swing.JTextField tfSchemaName;
175: private javax.swing.JLabel lblDisabledByParent;
176: private javax.swing.JLabel jLabel4;
177: private javax.swing.JLabel jLabel3;
178: // End of variables declaration//GEN-END:variables
179:
180: }
181:
182: /***************************** changelog *****************************
183: // $log$
184: /***************************** changelog *****************************/
|