KickJava   Java API By Example, From Geeks To Geeks.

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


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  * PropertyDialogPanel.java
21  *
22  * Created on October 13, 2003, 12:14 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.ejbmodule;
26
27 import java.util.ResourceBundle JavaDoc;
28
29 //AWT
30
import java.awt.event.KeyEvent JavaDoc;
31 import java.awt.event.KeyListener JavaDoc;
32
33 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.ValidationSupport;
34 import org.netbeans.modules.j2ee.sun.share.Constants;
35
36 /**
37  *
38  * @author Rajeshwar Patil
39  */

40 public class PropertyDialogPanel extends javax.swing.JPanel JavaDoc{
41
42     String JavaDoc name;
43     String JavaDoc value;
44
45
46     // Validation support
47
ValidationSupport validationSupport;
48
49     /** Creates new form PropertyDialogPanel */
50     public PropertyDialogPanel() {
51         initComponents();
52
53         validationSupport = new ValidationSupport();
54         ///markRequiredFields();
55
}
56
57
58     public PropertyDialogPanel(Object JavaDoc[] values) {
59         initComponents();
60
61         validationSupport = new ValidationSupport();
62         ///markRequiredFields();
63

64         name = (String JavaDoc)values[0];
65         value = (String JavaDoc)values[1];
66         
67         setComponentValues();
68     }
69
70
71     private void setComponentValues(){
72         nameTextField.setText(name);
73         valueTextField.setText(value);
74     }
75
76
77     public String JavaDoc getName(){
78         return name;
79     }
80
81
82     public String JavaDoc getValue(){
83         return value;
84     }
85
86
87     /** This method is called from within the constructor to
88      * initialize the form.
89      * WARNING: Do NOT modify this code. The content of this method is
90      * always regenerated by the Form Editor.
91      */

92     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
93
private void initComponents() {
94         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
95
96         nameReqFlag = new javax.swing.JLabel JavaDoc();
97         nameLabel = new javax.swing.JLabel JavaDoc();
98         nameTextField = new javax.swing.JTextField JavaDoc();
99         valueReqFlag = new javax.swing.JLabel JavaDoc();
100         valueLabel = new javax.swing.JLabel JavaDoc();
101         valueTextField = new javax.swing.JTextField JavaDoc();
102
103         setLayout(new java.awt.GridBagLayout JavaDoc());
104
105         nameReqFlag.setLabelFor(nameTextField);
106         nameReqFlag.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/common/Bundle").getString("LBL_RequiredMark"));
107         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
108         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
109         add(nameReqFlag, gridBagConstraints);
110
111         nameLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Name").charAt(0));
112         nameLabel.setLabelFor(nameTextField);
113         nameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Name_1"));
114         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
115         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
116         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
117         add(nameLabel, gridBagConstraints);
118         nameLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Name_Acsbl_Name"));
119         nameLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Property_Name_Acsbl_Desc"));
120
121         nameTextField.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Property_Name_Tool_Tip"));
122         nameTextField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
123             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
124                 msgDstnNameKeyReleased(evt);
125             }
126         });
127
128         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
129         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
130         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
131         gridBagConstraints.weightx = 1.0;
132         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 5);
133         add(nameTextField, gridBagConstraints);
134         nameTextField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Name_Acsbl_Name"));
135         nameTextField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Property_Name_Acsbl_Desc"));
136
137         valueReqFlag.setLabelFor(valueTextField);
138         valueReqFlag.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/common/Bundle").getString("LBL_RequiredMark"));
139         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
140         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 5, 0);
141         add(valueReqFlag, gridBagConstraints);
142
143         valueLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Value").charAt(0));
144         valueLabel.setLabelFor(valueTextField);
145         valueLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Value_1"));
146         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
147         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
148         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 5, 0);
149         add(valueLabel, gridBagConstraints);
150         valueLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Value_Acsbl_Name"));
151         valueLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Property_Value_Acsbl_Desc"));
152
153         valueTextField.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Property_Value_Tool_Tip"));
154         valueTextField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
155             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
156                 jndiNameKeyReleased(evt);
157             }
158         });
159
160         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
161         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
162         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
163         gridBagConstraints.ipadx = 72;
164         gridBagConstraints.weightx = 1.0;
165         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 5, 5);
166         add(valueTextField, gridBagConstraints);
167         valueTextField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Value_Acsbl_Name"));
168         valueTextField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Property_Value_Acsbl_Desc"));
169
170     }// </editor-fold>//GEN-END:initComponents
171

172     private void jndiNameKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_jndiNameKeyReleased
173
// Add your handling code here:
174
// get the text from the field
175
value = valueTextField.getText();
176         firePropertyChange(Constants.USER_DATA_CHANGED, null, null);
177     }//GEN-LAST:event_jndiNameKeyReleased
178

179     private void msgDstnNameKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_msgDstnNameKeyReleased
180
// Add your handling code here:
181
// get the text from the field
182
name = nameTextField.getText();
183         firePropertyChange(Constants.USER_DATA_CHANGED, null, null);
184     }//GEN-LAST:event_msgDstnNameKeyReleased
185

186     //This method appends "* " to the label of the field, if it is a mandatory field.
187
private void markRequiredFields(){
188         if(validationSupport.isRequiredProperty("/sun-ejb-jar/enterprise-beans/cmp-resource/property/name")){ //NOI18N
189
nameLabel.setText(validationSupport.getMarkedLabel(nameLabel.getText()));
190         }
191
192         if(validationSupport.isRequiredProperty("/sun-ejb-jar/enterprise-beans/cmp-resource/property/value")){ //NOI18N
193
valueLabel.setText(validationSupport.getMarkedLabel(valueLabel.getText()));
194         }
195     }
196     
197     // Variables declaration - do not modify//GEN-BEGIN:variables
198
private javax.swing.JLabel JavaDoc nameLabel;
199     private javax.swing.JLabel JavaDoc nameReqFlag;
200     private javax.swing.JTextField JavaDoc nameTextField;
201     private javax.swing.JLabel JavaDoc valueLabel;
202     private javax.swing.JLabel JavaDoc valueReqFlag;
203     private javax.swing.JTextField JavaDoc valueTextField;
204     // End of variables declaration//GEN-END:variables
205
}
206
Popular Tags