KickJava   Java API By Example, From Geeks To Geeks.

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


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  * OneOneFinderDialogPanel.java November 3, 2003, 1:58 PM
21  *
22  */

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

41 public class OneOneFinderDialogPanel extends javax.swing.JPanel JavaDoc {
42
43     String JavaDoc methodName;
44     String JavaDoc queryParams;
45     String JavaDoc queryFilter;
46     String JavaDoc queryVariables;
47     String JavaDoc queryOrdering;
48     
49   
50     // Validation support
51
ValidationSupport validationSupport;
52
53     /** Creates new form OneOneFinderDialogPanel */
54     public OneOneFinderDialogPanel() {
55         initComponents();
56
57         validationSupport = new ValidationSupport();
58         ///markRequiredFields();
59
}
60
61
62     public OneOneFinderDialogPanel(Object JavaDoc[] values) {
63         initComponents();
64
65         validationSupport = new ValidationSupport();
66         ///markRequiredFields();
67

68         methodName = (String JavaDoc)values[0];
69         queryParams = (String JavaDoc)values[1];
70         queryFilter = (String JavaDoc)values[2];
71         queryVariables = (String JavaDoc)values[3];
72         queryOrdering = (String JavaDoc)values[4];
73         setComponentValues();
74     }
75
76
77     private void setComponentValues(){
78         methodNameTextField.setText(methodName);
79         queryParamsTextField.setText(queryParams);
80         queryFilterTextField.setText(queryFilter);
81         queryVariablesTextField.setText(queryVariables);
82         queryOrderingTextField.setText(queryOrdering);
83     }
84
85
86     public String JavaDoc getMethodName(){
87         return methodName;
88     }
89
90
91     public String JavaDoc getQueryParams(){
92         return queryParams;
93     }
94
95
96     public String JavaDoc getQueryFilter(){
97         return queryFilter;
98     }
99
100
101     public String JavaDoc getQueryVariables(){
102         return queryVariables;
103     }
104
105
106     public String JavaDoc getQueryOrdering(){
107         return queryOrdering;
108     }
109
110
111     /** This method is called from within the constructor to
112      * initialize the form.
113      * WARNING: Do NOT modify this code. The content of this method is
114      * always regenerated by the Form Editor.
115      */

116     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
117
private void initComponents() {
118         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
119
120         methodNameReqFlag = new javax.swing.JLabel JavaDoc();
121         methodNameLabel = new javax.swing.JLabel JavaDoc();
122         methodNameTextField = new javax.swing.JTextField JavaDoc();
123         queryParamsLabel = new javax.swing.JLabel JavaDoc();
124         queryParamsTextField = new javax.swing.JTextField JavaDoc();
125         queryFilterLabel = new javax.swing.JLabel JavaDoc();
126         queryFilterTextField = new javax.swing.JTextField JavaDoc();
127         queryVariablesLabel = new javax.swing.JLabel JavaDoc();
128         queryVariablesTextField = new javax.swing.JTextField JavaDoc();
129         queryOrderingLabel = new javax.swing.JLabel JavaDoc();
130         queryOrderingTextField = new javax.swing.JTextField JavaDoc();
131
132         setLayout(new java.awt.GridBagLayout JavaDoc());
133
134         methodNameReqFlag.setLabelFor(methodNameTextField);
135         methodNameReqFlag.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/common/Bundle").getString("LBL_RequiredMark"));
136         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
137         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
138         add(methodNameReqFlag, gridBagConstraints);
139
140         methodNameLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Method_Name").charAt(0));
141         methodNameLabel.setLabelFor(methodNameTextField);
142         methodNameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Method_Name_1"));
143         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
144         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
145         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
146         add(methodNameLabel, gridBagConstraints);
147         methodNameLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Method_Name_Acsbl_Name"));
148         methodNameLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Method_Name_Acsbl_Desc"));
149
150         methodNameTextField.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Method_Name_Tool_Tip"));
151         methodNameTextField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
152             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
153                 methodNameKeyReleased(evt);
154             }
155         });
156
157         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
158         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
159         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
160         gridBagConstraints.weightx = 1.0;
161         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 5);
162         add(methodNameTextField, gridBagConstraints);
163         methodNameTextField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Method_Name_Acsbl_Name"));
164         methodNameTextField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Method_Name_Acsbl_Desc"));
165
166         queryParamsLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Query_Params").charAt(0));
167         queryParamsLabel.setLabelFor(queryParamsTextField);
168         queryParamsLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Query_Params_1"));
169         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
170         gridBagConstraints.gridx = 1;
171         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
172         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
173         add(queryParamsLabel, gridBagConstraints);
174         queryParamsLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Params_Acsbl_Name"));
175         queryParamsLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Params_Acsbl_Desc"));
176
177         queryParamsTextField.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Params_Tool_Tip"));
178         queryParamsTextField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
179             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
180                 queryParamsKeyReleased(evt);
181             }
182         });
183
184         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
185         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
186         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
187         gridBagConstraints.ipadx = 72;
188         gridBagConstraints.weightx = 1.0;
189         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 5);
190         add(queryParamsTextField, gridBagConstraints);
191         queryParamsTextField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Params_Acsbl_Name"));
192         queryParamsTextField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Params_Acsbl_Desc"));
193
194         queryFilterLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Query_Filter").charAt(0));
195         queryFilterLabel.setLabelFor(queryFilterTextField);
196         queryFilterLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Query_Filter_1"));
197         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
198         gridBagConstraints.gridx = 1;
199         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
200         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
201         add(queryFilterLabel, gridBagConstraints);
202         queryFilterLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Filter_Acsbl_Name"));
203         queryFilterLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Filter_Acsbl_Desc"));
204
205         queryFilterTextField.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Filter_Tool_Tip"));
206         queryFilterTextField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
207             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
208                 queryFilterKeyReleased(evt);
209             }
210         });
211
212         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
213         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
214         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
215         gridBagConstraints.ipadx = 72;
216         gridBagConstraints.weightx = 1.0;
217         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 5);
218         add(queryFilterTextField, gridBagConstraints);
219         queryFilterTextField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Filter_Acsbl_Name"));
220         queryFilterTextField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Filter_Acsbl_Desc"));
221
222         queryVariablesLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Query_Variables").charAt(0));
223         queryVariablesLabel.setLabelFor(queryVariablesTextField);
224         queryVariablesLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Query_Variables_1"));
225         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
226         gridBagConstraints.gridx = 1;
227         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
228         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
229         add(queryVariablesLabel, gridBagConstraints);
230         queryVariablesLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Variables_Acsbl_Name"));
231         queryVariablesLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Variables_Acsbl_Desc"));
232
233         queryVariablesTextField.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Variables_Tool_Tip"));
234         queryVariablesTextField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
235             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
236                 queryVariablesKeyReleased(evt);
237             }
238         });
239
240         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
241         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
242         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
243         gridBagConstraints.ipadx = 72;
244         gridBagConstraints.weightx = 1.0;
245         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 5);
246         add(queryVariablesTextField, gridBagConstraints);
247         queryVariablesTextField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Variables_Acsbl_Name"));
248         queryVariablesTextField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Variables_Acsbl_Desc"));
249
250         queryOrderingLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("MNC_Query_Ordering").charAt(0));
251         queryOrderingLabel.setLabelFor(queryOrderingTextField);
252         queryOrderingLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("LBL_Query_Ordering_1"));
253         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
254         gridBagConstraints.gridx = 1;
255         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
256         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 5, 0);
257         add(queryOrderingLabel, gridBagConstraints);
258         queryOrderingLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Ordering_Acsbl_Name"));
259         queryOrderingLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Ordering_Acsbl_Desc"));
260
261         queryOrderingTextField.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Ordering_Tool_Tip"));
262         queryOrderingTextField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
263             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
264                 queryOrderingKeyReleased(evt);
265             }
266         });
267
268         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
269         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
270         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
271         gridBagConstraints.ipadx = 72;
272         gridBagConstraints.weightx = 1.0;
273         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 5, 5);
274         add(queryOrderingTextField, gridBagConstraints);
275         queryOrderingTextField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Ordering_Acsbl_Name"));
276         queryOrderingTextField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/share/configbean/customizers/ejbmodule/Bundle").getString("Query_Ordering_Acsbl_Desc"));
277
278     }// </editor-fold>//GEN-END:initComponents
279

280     private void queryOrderingKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_queryOrderingKeyReleased
281
// Add your handling code here:
282
// get the text from the field
283
queryOrdering = queryOrderingTextField.getText();
284         firePropertyChange(Constants.USER_DATA_CHANGED, null, null);
285     }//GEN-LAST:event_queryOrderingKeyReleased
286

287     private void queryVariablesKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_queryVariablesKeyReleased
288
// Add your handling code here:
289
// get the text from the field
290
queryVariables = queryVariablesTextField.getText();
291         firePropertyChange(Constants.USER_DATA_CHANGED, null, null);
292     }//GEN-LAST:event_queryVariablesKeyReleased
293

294     private void queryFilterKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_queryFilterKeyReleased
295
// Add your handling code here:
296
// get the text from the field
297
queryFilter = queryFilterTextField.getText();
298         firePropertyChange(Constants.USER_DATA_CHANGED, null, null);
299     }//GEN-LAST:event_queryFilterKeyReleased
300

301     private void queryParamsKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_queryParamsKeyReleased
302
// Add your handling code here:
303
// get the text from the field
304
queryParams = queryParamsTextField.getText();
305         firePropertyChange(Constants.USER_DATA_CHANGED, null, null);
306     }//GEN-LAST:event_queryParamsKeyReleased
307

308     private void methodNameKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_methodNameKeyReleased
309
// Add your handling code here:
310
// get the text from the field
311
methodName = methodNameTextField.getText();
312         firePropertyChange(Constants.USER_DATA_CHANGED, null, null);
313     }//GEN-LAST:event_methodNameKeyReleased
314

315     //This method appends "* " to the label of the field, if it is a mandatory field.
316
private void markRequiredFields(){
317         if(validationSupport.isRequiredProperty("/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/method-name")){ //NOI18N
318
methodNameLabel.setText(validationSupport.getMarkedLabel(methodNameLabel.getText()));
319         }
320
321         if(validationSupport.isRequiredProperty("/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/query-params")){ //NOI18N
322
queryParamsLabel.setText(validationSupport.getMarkedLabel(queryParamsLabel.getText()));
323         }
324
325         if(validationSupport.isRequiredProperty("/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/query-filter")){ //NOI18N
326
queryFilterLabel.setText(validationSupport.getMarkedLabel(queryFilterLabel.getText()));
327         }
328
329         if(validationSupport.isRequiredProperty("/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/query-variables")){ //NOI18N
330
queryVariablesLabel.setText(validationSupport.getMarkedLabel(queryVariablesLabel.getText()));
331         }
332
333         if(validationSupport.isRequiredProperty("/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/query-ordering")){ //NOI18N
334
queryOrderingLabel.setText(validationSupport.getMarkedLabel(queryOrderingLabel.getText()));
335         }
336     }
337    
338     // Variables declaration - do not modify//GEN-BEGIN:variables
339
private javax.swing.JLabel JavaDoc methodNameLabel;
340     private javax.swing.JLabel JavaDoc methodNameReqFlag;
341     private javax.swing.JTextField JavaDoc methodNameTextField;
342     private javax.swing.JLabel JavaDoc queryFilterLabel;
343     private javax.swing.JTextField JavaDoc queryFilterTextField;
344     private javax.swing.JLabel JavaDoc queryOrderingLabel;
345     private javax.swing.JTextField JavaDoc queryOrderingTextField;
346     private javax.swing.JLabel JavaDoc queryParamsLabel;
347     private javax.swing.JTextField JavaDoc queryParamsTextField;
348     private javax.swing.JLabel JavaDoc queryVariablesLabel;
349     private javax.swing.JTextField JavaDoc queryVariablesTextField;
350     // End of variables declaration//GEN-END:variables
351

352 }
353
Popular Tags