KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > project > 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.web.project.ui.customizer;
21
22 import java.util.List JavaDoc;
23
24 import java.beans.PropertyChangeEvent JavaDoc;
25 import java.beans.PropertyChangeListener JavaDoc;
26
27 import javax.swing.JPanel JavaDoc;
28
29 import org.openide.util.HelpCtx;
30 import org.openide.util.Lookup;
31
32 import org.netbeans.modules.websvc.api.webservices.WsCompileEditorSupport;
33
34
35 /** Host for WsCompile features editor for editing the features enabled for
36  * running WsCompile on a web service or a web service client.
37  *
38  * property format: 'webservice.client.[servicename].features=xxx,yyy,zzz
39  *
40  * @author Peter Williams
41  */

42 public class CustomizerWSServiceHost extends javax.swing.JPanel JavaDoc implements /*WebCustomizer.Panel, WebCustomizer.ValidatingPanel,*/ PropertyChangeListener JavaDoc, HelpCtx.Provider {
43     
44     private WebProjectProperties webProperties;
45     private WsCompileEditorSupport.Panel wsCompileEditor;
46
47     private List JavaDoc serviceSettings;
48     
49     public CustomizerWSServiceHost(WebProjectProperties webProperties, List JavaDoc serviceSettings) {
50         assert serviceSettings != null;
51         initComponents();
52
53         this.webProperties = webProperties;
54         this.wsCompileEditor = null;
55         this.serviceSettings = serviceSettings;
56
57         if (serviceSettings.size() > 0)
58             initValues();
59     }
60     
61     /** This method is called from within the constructor to
62      * initialize the form.
63      * WARNING: Do NOT modify this code. The content of this method is
64      * always regenerated by the Form Editor.
65      */

66     private void initComponents() {//GEN-BEGIN:initComponents
67

68         setLayout(new java.awt.BorderLayout JavaDoc());
69
70     }//GEN-END:initComponents
71

72     
73     // Variables declaration - do not modify//GEN-BEGIN:variables
74
// End of variables declaration//GEN-END:variables
75

76     public void addNotify() {
77         super.addNotify();
78         
79 // System.out.println("WSClientCustomizer: addNotify (" + this.getComponentCount() + " subcomponents)");
80
JPanel JavaDoc component = wsCompileEditor.getComponent();
81
82         removeAll(); // !PW is this necessary?
83
add(component);
84         
85         component.addPropertyChangeListener(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this);
86     }
87     
88     public void removeNotify() {
89         super.removeNotify();
90         
91 // System.out.println("WSClientCustomizer: removeNotify");
92
JPanel JavaDoc component = wsCompileEditor.getComponent();
93         component.removePropertyChangeListener(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this);
94     }
95    
96     private void initValues() {
97 // System.out.println("WSClientCustomizer: initValues");
98
if(wsCompileEditor == null) {
99             WsCompileEditorSupport editorSupport = (WsCompileEditorSupport) Lookup.getDefault().lookup(WsCompileEditorSupport.class);
100             wsCompileEditor = editorSupport.getWsCompileSupport();
101         }
102         
103         wsCompileEditor.initValues(serviceSettings);
104     }
105     
106 // public void validatePanel() throws WizardValidationException {
107
// System.out.println("WSClientCustomizer: validatePanel ");
108
// if(wsCompileEditor != null) {
109
// wsCompileEditor.validatePanel();
110
// }
111
// }
112

113     public void propertyChange(PropertyChangeEvent JavaDoc evt) {
114 // System.out.println("WSClientCustomizer: propertyChange - " + evt.getPropertyName());
115

116         WsCompileEditorSupport.FeatureDescriptor newFeatureDesc = (WsCompileEditorSupport.FeatureDescriptor) evt.getNewValue();
117         String JavaDoc propertyName = "wscompile.service." + newFeatureDesc.getServiceName() + ".features";
118         webProperties.putAdditionalProperty(propertyName, newFeatureDesc.getFeatures());
119     }
120     
121     public HelpCtx getHelpCtx() {
122         return new HelpCtx(CustomizerWSServiceHost.class);
123     }
124 }
125
Popular Tags