KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > customizers > ejbmodule > EntityEjbPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * EntityEjbPanel.java October 23, 2003, 3:31 PM
21  *
22  */

23
24 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.ejbmodule;
25
26 /**
27  *
28  * @author Rajeshwar Patil
29  * @version %I%, %G%
30  */

31 public class EntityEjbPanel extends javax.swing.JPanel JavaDoc {
32
33     private EntityEjbCustomizer entityEjbCutomizer;
34
35
36     /** Creates new form EntityEjbPanel */
37     public EntityEjbPanel(EntityEjbCustomizer customizer) {
38         initComponents();
39         this.entityEjbCutomizer = customizer;
40     }
41
42
43     public void setIsreadOnlyBean(String JavaDoc isReadOnlyBean){
44         if(isReadOnlyBean != null){
45             isReadOnlyBeanComboBox.setSelectedItem(isReadOnlyBean);
46         }
47     }
48
49
50     public void setRefreshPeriodInSeconds(String JavaDoc refPeriodInSecs){
51         if(refPeriodInSecs != null){
52             refreshPeriodInSecondsTextField.setText(refPeriodInSecs);
53         }
54     }
55
56
57     public void setCommitOption(String JavaDoc commitOption){
58         if(commitOption != null){
59             commitOptionComboBox.setSelectedItem(commitOption);
60         }
61     }
62
63     
64     public String JavaDoc getIsreadOnlyBean(){
65         return (String JavaDoc)isReadOnlyBeanComboBox.getSelectedItem();
66     }
67
68
69     public String JavaDoc getRefreshPeriodInSeconds(){
70         return refreshPeriodInSecondsTextField.getText();
71     }
72
73
74     public String JavaDoc getCommitOption(){
75         return (String JavaDoc)commitOptionComboBox.getSelectedItem();
76     }
77
78
79     /** This method is called from within the constructor to
80      * initialize the form.
81      * WARNING: Do NOT modify this code. The content of this method is
82      * always regenerated by the Form Editor.
83      */

84     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
85
private void initComponents() {
86         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
87
88         isReadOnlyBeanLabel = new javax.swing.JLabel JavaDoc();
89         isReadOnlyBeanComboBox = new javax.swing.JComboBox JavaDoc();
90         refreshPeriodInSecondsLabel = new javax.swing.JLabel JavaDoc();
91         refreshPeriodInSecondsTextField = new javax.swing.JTextField JavaDoc();
92         commitOptionLabel = new javax.swing.JLabel JavaDoc();
93         commitOptionComboBox = new javax.swing.JComboBox JavaDoc();
94
95         setLayout(new java.awt.GridBagLayout JavaDoc());
96
97         isReadOnlyBeanLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Is_Read_Only_Bean").charAt(0));
98         isReadOnlyBeanLabel.setLabelFor(isReadOnlyBeanComboBox);
99         isReadOnlyBeanLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Is_Read_Only_Bean_1"));
100         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
101         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
102         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
103         add(isReadOnlyBeanLabel, gridBagConstraints);
104         isReadOnlyBeanLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Is_Read_Only_Bean_Acsbl_Name"));
105         isReadOnlyBeanLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Is_Read_Only_Bean_Acsbl_Desc"));
106
107         isReadOnlyBeanComboBox.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "", "true", "false" }));
108         isReadOnlyBeanComboBox.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Is_Read_Only_Bean_Tool_Tip"));
109         isReadOnlyBeanComboBox.addItemListener(new java.awt.event.ItemListener JavaDoc() {
110             public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
111                 isReadOnlyBeanItemStateChanged(evt);
112             }
113         });
114
115         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
116         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
117         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
118         gridBagConstraints.weightx = 1.0;
119         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 5);
120         add(isReadOnlyBeanComboBox, gridBagConstraints);
121         isReadOnlyBeanComboBox.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Is_Read_Only_Bean_Acsbl_Name"));
122         isReadOnlyBeanComboBox.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Is_Read_Only_Bean_Acsbl_Desc"));
123
124         refreshPeriodInSecondsLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Refresh_Period_In_Seconds").charAt(0));
125         refreshPeriodInSecondsLabel.setLabelFor(refreshPeriodInSecondsTextField);
126         refreshPeriodInSecondsLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Refresh_Period_In_Seconds_1"));
127         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
128         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
129         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
130         add(refreshPeriodInSecondsLabel, gridBagConstraints);
131         refreshPeriodInSecondsLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Refresh_Period_In_Seconds_Acsbl_Name"));
132         refreshPeriodInSecondsLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Refresh_Period_In_Seconds_Acsbl_Desc"));
133
134         refreshPeriodInSecondsTextField.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Refresh_Period_In_Seconds_Tool_Tip"));
135         refreshPeriodInSecondsTextField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
136             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
137                 refreshPeriodInSecondsActionPerformed(evt);
138             }
139         });
140         refreshPeriodInSecondsTextField.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
141             public void focusGained(java.awt.event.FocusEvent JavaDoc evt) {
142                 refreshPeriodInSecondsFocusGained(evt);
143             }
144         });
145         refreshPeriodInSecondsTextField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
146             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
147                 refreshPeriodInSecondsKeyReleased(evt);
148             }
149         });
150
151         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
152         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
153         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
154         gridBagConstraints.weightx = 1.0;
155         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 5);
156         add(refreshPeriodInSecondsTextField, gridBagConstraints);
157         refreshPeriodInSecondsTextField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Refresh_Period_In_Seconds_Acsbl_Name"));
158         refreshPeriodInSecondsTextField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Refresh_Period_In_Seconds_Acsbl_Desc"));
159
160         commitOptionLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Commit_Option").charAt(0));
161         commitOptionLabel.setLabelFor(commitOptionComboBox);
162         commitOptionLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Commit_Option_1"));
163         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
164         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
165         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 5, 0);
166         add(commitOptionLabel, gridBagConstraints);
167         commitOptionLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Commit_Option_Acsbl_Name"));
168         commitOptionLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Commit_Option_Acsbl_Desc"));
169
170         commitOptionComboBox.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "", "B", "C" }));
171         commitOptionComboBox.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Commit_Option_Tool_Tip"));
172         commitOptionComboBox.addItemListener(new java.awt.event.ItemListener JavaDoc() {
173             public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
174                 commitOptionItemStateChanged(evt);
175             }
176         });
177
178         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
179         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
180         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
181         gridBagConstraints.weightx = 1.0;
182         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 5, 5);
183         add(commitOptionComboBox, gridBagConstraints);
184         commitOptionComboBox.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Commit_Option_Acsbl_Name"));
185         commitOptionComboBox.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Commit_Option_Acsbl_Desc"));
186
187     }// </editor-fold>//GEN-END:initComponents
188

189     private void refreshPeriodInSecondsActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_refreshPeriodInSecondsActionPerformed
190
// Add your handling code here:
191
entityEjbCutomizer.validateEntries();
192     }//GEN-LAST:event_refreshPeriodInSecondsActionPerformed
193

194     private void refreshPeriodInSecondsFocusGained(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_refreshPeriodInSecondsFocusGained
195
// Add your handling code here:
196
entityEjbCutomizer.validateEntries();
197     }//GEN-LAST:event_refreshPeriodInSecondsFocusGained
198

199     private void commitOptionItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_commitOptionItemStateChanged
200
// Add your handling code here:
201
String JavaDoc item = (String JavaDoc)commitOptionComboBox.getSelectedItem();
202         entityEjbCutomizer.updateSetCommitOption(item);
203         entityEjbCutomizer.validateEntries();
204     }//GEN-LAST:event_commitOptionItemStateChanged
205

206     private void refreshPeriodInSecondsKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_refreshPeriodInSecondsKeyReleased
207
// Add your handling code here:
208
String JavaDoc item = refreshPeriodInSecondsTextField.getText();
209         entityEjbCutomizer.updateRefreshPeriodInSeconds(item);
210         entityEjbCutomizer.validateEntries();
211     }//GEN-LAST:event_refreshPeriodInSecondsKeyReleased
212

213     private void isReadOnlyBeanItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_isReadOnlyBeanItemStateChanged
214
// Add your handling code here:
215
String JavaDoc item = (String JavaDoc)isReadOnlyBeanComboBox.getSelectedItem();
216         entityEjbCutomizer.updateIsReadOnlyBean(item);
217         entityEjbCutomizer.validateEntries();
218     }//GEN-LAST:event_isReadOnlyBeanItemStateChanged
219

220
221     // Variables declaration - do not modify//GEN-BEGIN:variables
222
private javax.swing.JComboBox JavaDoc commitOptionComboBox;
223     private javax.swing.JLabel JavaDoc commitOptionLabel;
224     private javax.swing.JComboBox JavaDoc isReadOnlyBeanComboBox;
225     private javax.swing.JLabel JavaDoc isReadOnlyBeanLabel;
226     private javax.swing.JLabel JavaDoc refreshPeriodInSecondsLabel;
227     private javax.swing.JTextField JavaDoc refreshPeriodInSecondsTextField;
228     // End of variables declaration//GEN-END:variables
229

230 }
231
Popular Tags