KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > wsdl > wizard > WsdlPanel


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 package org.netbeans.modules.websvc.wsdl.wizard;
21
22 import java.awt.Component JavaDoc;
23 import java.util.ArrayList JavaDoc;
24 import java.util.Iterator JavaDoc;
25 import java.util.List JavaDoc;
26 import javax.swing.JTextField JavaDoc;
27 import javax.swing.event.ChangeEvent JavaDoc;
28 import javax.swing.event.ChangeListener JavaDoc;
29 import org.netbeans.api.project.Project;
30 import org.netbeans.api.project.SourceGroup;
31 import org.openide.WizardDescriptor;
32 import org.openide.loaders.TemplateWizard;
33 import org.openide.util.HelpCtx;
34
35 /**
36  *
37  * @author Milan Kuchtiak
38  */

39 final class WsdlPanel implements WizardDescriptor.Panel {
40
41     private final List JavaDoc<ChangeListener JavaDoc> listeners = new ArrayList JavaDoc<ChangeListener JavaDoc>();
42     private WsdlUIPanel gui;
43
44     private Project project;
45     private TemplateWizard templateWizard;
46     
47     WsdlPanel(Project project, SourceGroup[] folders) {
48         this.project = project;
49     }
50     
51     TemplateWizard getTemplateWizard() {
52         return templateWizard;
53     }
54     
55     void setNameTF(JTextField JavaDoc nameTF) {
56         gui.attachFileNameListener(nameTF);
57     }
58
59     public Component JavaDoc getComponent() {
60         if (gui == null) {
61             gui=new WsdlUIPanel(this);
62         }
63         return gui;
64     }
65  
66     public Project getProject(){
67         return project;
68     }
69     
70     public HelpCtx getHelp() {
71         return new HelpCtx(WsdlPanel.class);
72     }
73
74     public boolean isValid() {
75         return true;
76     }
77
78     public void addChangeListener(ChangeListener JavaDoc l) {
79         listeners.add(l);
80     }
81
82     public void removeChangeListener(ChangeListener JavaDoc l) {
83         listeners.remove(l);
84     }
85
86     protected void fireChange() {
87         ChangeEvent JavaDoc e = new ChangeEvent JavaDoc(this);
88         Iterator JavaDoc<ChangeListener JavaDoc> it = listeners.iterator();
89         while (it.hasNext()) {
90             it.next().stateChanged(e);
91         }
92     }
93
94     public void readSettings( Object JavaDoc settings ) {
95         templateWizard = (TemplateWizard)settings;
96     }
97
98     public void storeSettings(Object JavaDoc settings) {
99         if ( WizardDescriptor.PREVIOUS_OPTION.equals( ((WizardDescriptor)settings).getValue() ) ) {
100             return;
101         }
102         if ( WizardDescriptor.CANCEL_OPTION.equals( ((WizardDescriptor)settings).getValue() ) ) {
103             return;
104         }
105         ((WizardDescriptor)settings).putProperty ("NewFileWizard_Title", null); // NOI18N
106
}
107     
108     String JavaDoc getNS() {
109         return gui.getNS();
110     }
111     
112     String JavaDoc getWsName() {
113         return gui.getWsName();
114     }
115     
116     WsdlUIPanel.SchemaInfo[] getSchemas() {
117         return gui.getSchemas();
118     }
119     
120     boolean isImport() {
121         return gui.isImport();
122     }
123
124 }
125
Popular Tags