KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ide > sunresources > wizards > MailPropertyPanel


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  * MailProperty.java
21  *
22  * Created on October 9, 2003, 1:44 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.ide.sunresources.wizards;
26
27 import java.awt.Component JavaDoc;
28 import java.util.Vector JavaDoc;
29 import org.openide.util.HelpCtx;
30
31 import org.netbeans.modules.j2ee.sun.ide.editors.NameValuePair;
32
33 import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldGroup;
34 import org.netbeans.modules.j2ee.sun.sunresources.beans.Wizard;
35 import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldGroupHelper;
36
37 /** A single panel descriptor for a wizard.
38  * You probably want to make a wizard iterator to hold it.
39  *
40  * @author nityad
41  */

42
43 public class MailPropertyPanel extends ResourceWizardPanel {
44     
45     /** The visual component that displays this panel.
46      * If you need to access the component from this class,
47      * just use getComponent().
48      */

49     private MailPropertyVisualPanel component;
50     private ResourceConfigHelper helper;
51     private Wizard wiz;
52     
53     /** Create the wizard panel descriptor. */
54     public MailPropertyPanel(ResourceConfigHelper helper, Wizard wiz) {
55         this.helper = helper;
56         this.wiz = wiz;
57     }
58     
59     // Get the visual component for the panel. In this template, the component
60
// is kept separate. This can be more efficient: if the wizard is created
61
// but never displayed, or not all panels are displayed, it is better to
62
// create only those which really need to be visible.
63
public Component JavaDoc getComponent() {
64         if (component == null) {
65             component = new MailPropertyVisualPanel(this);
66         }
67         return component;
68     }
69     
70     public void refreshFields(){
71         if(component != null){
72             component.refreshFields();
73             component.setInitialFocus();
74         }
75     }
76     
77      
78     public FieldGroup getFieldGroup(String JavaDoc groupName) {
79         return FieldGroupHelper.getFieldGroup(wiz, groupName);
80     }
81     
82     public HelpCtx getHelp() {
83         return new HelpCtx("AS_Wiz_Mail_props"); //NOI18N
84
}
85     
86     public boolean isValid() {
87         setErrorMsg(bundle.getString("Empty_String"));
88         ResourceConfigData data = helper.getData();
89         Vector JavaDoc vec = data.getProperties();
90         for (int i = 0; i < vec.size(); i++) {
91             NameValuePair pair = (NameValuePair)vec.elementAt(i);
92             if (pair.getParamName() == null || pair.getParamValue() == null ||
93                     pair.getParamName().length() == 0 || pair.getParamValue().length() == 0){
94                 setErrorMsg(bundle.getString("Err_InvalidNameValue"));
95                 return false;
96             }
97         }
98         return true;
99     }
100     
101     public ResourceConfigHelper getHelper() {
102         return helper;
103     }
104        
105     public boolean isFinishPanel() {
106         return true;
107     }
108     
109 }
110
Popular Tags