1 package org.apache.ojb.tools.mapping.reversedb.gui; 2 3 17 18 23 public class DBSchemaPropertySheet extends javax.swing.JPanel 24 implements PropertySheetView 25 { 26 org.apache.ojb.tools.mapping.reversedb.DBSchema aSchema; 27 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 45 private void initComponents() { 47 java.awt.GridBagConstraints gridBagConstraints; 48 49 jPanel1 = new javax.swing.JPanel (); 50 lblEnabled = new javax.swing.JLabel (); 51 cbEnabled = new javax.swing.JCheckBox (); 52 lblDisabledByParent = new javax.swing.JLabel (); 53 cbDisabledByParent = new javax.swing.JCheckBox (); 54 jLabel4 = new javax.swing.JLabel (); 55 jLabel3 = new javax.swing.JLabel (); 56 lblSchemaName = new javax.swing.JLabel (); 57 tfSchemaName = new javax.swing.JTextField (); 58 59 setLayout(new java.awt.GridBagLayout ()); 60 61 addComponentListener(new java.awt.event.ComponentAdapter () 62 { 63 public void componentShown(java.awt.event.ComponentEvent evt) 64 { 65 formComponentShown(evt); 66 } 67 public void componentHidden(java.awt.event.ComponentEvent evt) 68 { 69 formComponentHidden(evt); 70 } 71 }); 72 73 addHierarchyListener(new java.awt.event.HierarchyListener () 74 { 75 public void hierarchyChanged(java.awt.event.HierarchyEvent evt) 76 { 77 formHierarchyChanged(evt); 78 } 79 }); 80 81 jPanel1.setLayout(new java.awt.GridLayout (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 () 89 { 90 public void actionPerformed(java.awt.event.ActionEvent 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 () 103 { 104 public void actionPerformed(java.awt.event.ActionEvent 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 (); 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 } 134 private void cbEnabledActionPerformed (java.awt.event.ActionEvent evt) { this.aSchema.setEnabled(cbEnabled.isSelected()); 138 } 140 private void cbDisabledByParentActionPerformed (java.awt.event.ActionEvent evt) { } 145 private void formHierarchyChanged (java.awt.event.HierarchyEvent evt) { readValuesFromSchema(); 149 } 151 private void formComponentHidden (java.awt.event.ComponentEvent evt) { } 156 private void formComponentShown (java.awt.event.ComponentEvent evt) { } 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 (); 170 171 } 172 173 174 private javax.swing.JCheckBox cbDisabledByParent; 176 private javax.swing.JPanel jPanel1; 177 private javax.swing.JLabel lblEnabled; 178 private javax.swing.JLabel lblSchemaName; 179 private javax.swing.JCheckBox cbEnabled; 180 private javax.swing.JTextField tfSchemaName; 181 private javax.swing.JLabel lblDisabledByParent; 182 private javax.swing.JLabel jLabel4; 183 private javax.swing.JLabel jLabel3; 184 186 } 187 188 191 | Popular Tags |