KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbjarproject > ui > customizer > CustomizerWSServiceHost


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.j2ee.ejbjarproject.ui.customizer;
21
22 import java.util.Collections JavaDoc;
23 import java.util.List JavaDoc;
24
25 import java.beans.PropertyChangeEvent JavaDoc;
26 import java.beans.PropertyChangeListener JavaDoc;
27
28 import javax.swing.JPanel JavaDoc;
29 import javax.swing.JLabel JavaDoc;
30
31 import org.w3c.dom.Document JavaDoc;
32 import org.w3c.dom.Element JavaDoc;
33 import org.w3c.dom.NodeList JavaDoc;
34
35 import org.openide.WizardValidationException;
36 import org.openide.util.HelpCtx;
37 import org.openide.util.Lookup;
38 import org.openide.filesystems.FileObject;
39
40 import org.netbeans.spi.project.support.ant.AntProjectHelper;
41 import org.netbeans.modules.j2ee.ejbjarproject.EjbJarProvider;
42 import org.netbeans.modules.j2ee.ejbjarproject.EjbJarProjectType;
43
44 import org.netbeans.modules.websvc.spi.webservices.WebServicesConstants;
45 import org.netbeans.modules.websvc.api.webservices.WsCompileEditorSupport;
46
47
48 /** Host for WsCompile features editor for editing the features enabled for
49  * running WsCompile on a web service or a web service client.
50  *
51  * property format: 'webservice.client.[servicename].features=xxx,yyy,zzz
52  *
53  * @author Peter Williams
54  */

55 public class CustomizerWSServiceHost extends javax.swing.JPanel JavaDoc implements PropertyChangeListener JavaDoc, HelpCtx.Provider {
56     
57     private EjbJarProjectProperties ejbJarProperties;
58     private WsCompileEditorSupport.Panel wsCompileEditor;
59
60     private List JavaDoc serviceSettings;
61     
62     public CustomizerWSServiceHost(EjbJarProjectProperties ejbJarProperties, List JavaDoc serviceSettings) {
63         assert serviceSettings != null && serviceSettings.size() > 0;
64         initComponents();
65
66         this.ejbJarProperties = ejbJarProperties;
67         this.wsCompileEditor = null;
68         this.serviceSettings = serviceSettings;
69         
70         initValues();
71     }
72     
73     /** This method is called from within the constructor to
74      * initialize the form.
75      * WARNING: Do NOT modify this code. The content of this method is
76      * always regenerated by the Form Editor.
77      */

78     private void initComponents() {//GEN-BEGIN:initComponents
79

80         setLayout(new java.awt.BorderLayout JavaDoc());
81
82     }//GEN-END:initComponents
83

84     
85     // Variables declaration - do not modify//GEN-BEGIN:variables
86
// End of variables declaration//GEN-END:variables
87

88     public void addNotify() {
89         super.addNotify();
90
91         JPanel JavaDoc component = wsCompileEditor.getComponent();
92
93         removeAll(); // !PW is this necessary?
94
add(component);
95
96         component.addPropertyChangeListener(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this);
97     }
98
99     public void removeNotify() {
100         super.removeNotify();
101
102         JPanel JavaDoc component = wsCompileEditor.getComponent();
103         component.removePropertyChangeListener(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this);
104     }
105
106     public void initValues() {
107         if(wsCompileEditor == null) {
108             WsCompileEditorSupport editorSupport = (WsCompileEditorSupport) Lookup.getDefault().lookup(WsCompileEditorSupport.class);
109             wsCompileEditor = editorSupport.getWsCompileSupport();
110         }
111
112         wsCompileEditor.initValues(serviceSettings);
113     }
114
115     /*public void validatePanel() throws WizardValidationException {
116         if(wsCompileEditor != null) {
117             wsCompileEditor.validatePanel();
118         }
119     }*/

120
121     public void propertyChange(PropertyChangeEvent JavaDoc evt) {
122         WsCompileEditorSupport.FeatureDescriptor newFeatureDesc = (WsCompileEditorSupport.FeatureDescriptor) evt.getNewValue();
123         String JavaDoc propertyName = "wscompile.service." + newFeatureDesc.getServiceName() + ".features";
124         ejbJarProperties.putAdditionalProperty(propertyName, newFeatureDesc.getFeatures());
125     }
126     
127     public HelpCtx getHelpCtx() {
128         return new HelpCtx(CustomizerWSServiceHost.class);
129     }
130 }
131
Popular Tags