KickJava   Java API By Example, From Geeks To Geeks.

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


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

23
24 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.ejbmodule;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.Collection JavaDoc;
28 import java.util.ResourceBundle JavaDoc;
29
30 import javax.swing.JPanel JavaDoc;
31
32 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.BeanInputDialog;
33
34 /**
35  *
36  * @author Rajeshwar Patil
37  * @version %I%, %G%
38  */

39 public class OneOneFinderDialog extends BeanInputDialog{
40     /* A class implementation comment can go here. */
41
42     String JavaDoc methodName;
43     String JavaDoc queryParams;
44     String JavaDoc queryFilter;
45     String JavaDoc queryVariables;
46     String JavaDoc queryOrdering;
47     OneOneFinderDialogPanel finderDlgPanel;
48
49     static final ResourceBundle JavaDoc bundle =
50         ResourceBundle.getBundle(
51             "org.netbeans.modules.j2ee.sun.share.configbean.customizers.ejbmodule.Bundle"); // NOI18N
52

53
54     /** Creates a new instance of OneOneFinderDialog */
55     public OneOneFinderDialog(OneOneFinderPanel parent, String JavaDoc title,
56             Object JavaDoc[] values){
57         super(parent, title, true, values);
58         methodName = (String JavaDoc)values[0];
59         queryParams = (String JavaDoc)values[1];
60         queryFilter = (String JavaDoc)values[2];
61         queryVariables = (String JavaDoc)values[3];
62         queryOrdering = (String JavaDoc)values[4];
63     }
64
65
66     public OneOneFinderDialog(OneOneFinderPanel parent, String JavaDoc title){
67         super(parent, title, true);
68     }
69
70
71     public String JavaDoc getHelpId() {
72         return "AS_CFG_OneOneFinder"; //NOI18N
73
}
74
75
76     protected JPanel JavaDoc getDialogPanel(Object JavaDoc[] values){
77         //called in case of EDIT operation
78
//create panel
79
//initialize all the components in the panel
80
//porvide handlers for all the components; these handlers will
81
//update methodName, queryParams, queryFilter, queryVariables and
82
//queryOrdering.
83
finderDlgPanel = new OneOneFinderDialogPanel(values);
84         return finderDlgPanel;
85     }
86
87
88     protected JPanel JavaDoc getDialogPanel(){
89         //called in case of ADD operation
90
//create panel
91
//initialize all the components in the panel
92
//porvide handlers for all the components; these handlers will
93
//update methodName, queryParams, queryFilter, queryVariables and
94
//queryOrdering.
95
finderDlgPanel = new OneOneFinderDialogPanel();
96         return finderDlgPanel;
97     }
98
99
100     protected Object JavaDoc[] getValues(){
101         Object JavaDoc[] values = new Object JavaDoc[5];
102         values[0] = (Object JavaDoc)finderDlgPanel.getMethodName();
103         values[1] = (Object JavaDoc)finderDlgPanel.getQueryParams();
104         values[2] = (Object JavaDoc)finderDlgPanel.getQueryFilter();
105         values[3] = (Object JavaDoc)finderDlgPanel.getQueryVariables();
106         values[4] = (Object JavaDoc)finderDlgPanel.getQueryOrdering();
107         return values;
108     }
109
110
111     protected Collection JavaDoc getErrors(){
112         ArrayList JavaDoc errors = new ArrayList JavaDoc();
113         //perform validation for methodName, queryParams, queryFilter,
114
//queryVariables and queryOrdering.
115
if(validationSupport == null) assert(false);
116
117         String JavaDoc property = finderDlgPanel.getMethodName();
118         errors.addAll(validationSupport.validate(property,
119             "/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/method-name", //NOI18N
120
bundle.getString("LBL_Method_Name"))); //NOI18N
121

122         property = finderDlgPanel.getQueryParams();
123         errors.addAll(validationSupport.validate(property,
124             "/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/query-params", //NOI18N
125
bundle.getString("LBL_Query_Params"))); //NOI18N
126

127         property = finderDlgPanel.getQueryFilter();
128         errors.addAll(validationSupport.validate(property,
129             "/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/query-filter", //NOI18N
130
bundle.getString("LBL_Query_Filter"))); //NOI18N
131

132         property = finderDlgPanel.getQueryVariables();
133         errors.addAll(validationSupport.validate(property,
134             "/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/query-variables", //NOI18N
135
bundle.getString("LBL_Query_Variables"))); //NOI18N
136

137         property = finderDlgPanel.getQueryOrdering();
138         errors.addAll(validationSupport.validate(property,
139             "/sun-ejb-jar/enterprise-beans/ejb/cmp/one-one-finders/finder/query-ordering", //NOI18N
140
bundle.getString("LBL_Query_Ordering"))); //NOI18N
141

142         return errors;
143     }
144
145
146     // returns number of elements in this dialog
147
protected int getNOofFields() {
148         return 5;
149     }
150 }
151
Popular Tags