1 package org.apache.ojb.tools.mapping.reversedb.gui; 2 3 17 18 23 public class DBCatalogPropertySheet extends javax.swing.JPanel 24 implements PropertySheetView 25 { 26 org.apache.ojb.tools.mapping.reversedb.DBCatalog aCatalog; 27 28 public DBCatalogPropertySheet () 29 { 30 initComponents (); 31 } 32 33 private void readValuesFromCatalog() 34 { 35 this.tfCatalogName.setText(aCatalog.getCatalogName()); 36 this.cbEnabled.setSelected(aCatalog.isEnabled()); 37 this.cbDisabledByParent.setSelected(!aCatalog.getDBMeta().isEnabled ()); 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 jLabel2 = new javax.swing.JLabel (); 55 jLabel1 = new javax.swing.JLabel (); 56 lblCatalogName = new javax.swing.JLabel (); 57 tfCatalogName = 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 (5, 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 lblDisabledByParent.setDisplayedMnemonic('e'); 100 jPanel1.add(lblDisabledByParent); 101 102 cbDisabledByParent.setMnemonic('e'); 103 cbDisabledByParent.setEnabled(false); 104 jPanel1.add(cbDisabledByParent); 105 106 jPanel1.add(jLabel2); 107 108 jPanel1.add(jLabel1); 109 110 lblCatalogName.setText("Catalog Name:"); 111 lblCatalogName.setLabelFor(tfCatalogName); 112 jPanel1.add(lblCatalogName); 113 114 tfCatalogName.setEditable(false); 115 tfCatalogName.setText("jTextField1"); 116 tfCatalogName.setBorder(null); 117 jPanel1.add(tfCatalogName); 118 119 gridBagConstraints = new java.awt.GridBagConstraints (); 120 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 121 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 122 gridBagConstraints.weightx = 1.0; 123 gridBagConstraints.weighty = 1.0; 124 add(jPanel1, gridBagConstraints); 125 126 } 128 private void cbEnabledActionPerformed (java.awt.event.ActionEvent evt) { this.aCatalog.setEnabled(cbEnabled.isSelected()); 132 } 134 private void formHierarchyChanged (java.awt.event.HierarchyEvent evt) { readValuesFromCatalog(); 138 } 140 private void formComponentHidden (java.awt.event.ComponentEvent evt) { } 145 private void formComponentShown (java.awt.event.ComponentEvent evt) { } 150 public void setModel (PropertySheetModel pm) 151 { 152 if (pm instanceof org.apache.ojb.tools.mapping.reversedb.DBCatalog) 153 { 154 this.aCatalog = (org.apache.ojb.tools.mapping.reversedb.DBCatalog)pm; 155 this.readValuesFromCatalog(); 156 } 157 else 158 throw new IllegalArgumentException (); 159 } 160 161 162 private javax.swing.JCheckBox cbDisabledByParent; 164 private javax.swing.JPanel jPanel1; 165 private javax.swing.JTextField tfCatalogName; 166 private javax.swing.JLabel lblCatalogName; 167 private javax.swing.JLabel lblEnabled; 168 private javax.swing.JCheckBox cbEnabled; 169 private javax.swing.JLabel lblDisabledByParent; 170 private javax.swing.JLabel jLabel2; 171 private javax.swing.JLabel jLabel1; 172 174 } 175 176 236 237 | Popular Tags |