1 19 20 package org.netbeans.modules.web.project.ui.customizer; 21 22 import java.util.List ; 23 24 import java.beans.PropertyChangeEvent ; 25 import java.beans.PropertyChangeListener ; 26 27 import javax.swing.JPanel ; 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 42 public class CustomizerWSServiceHost extends javax.swing.JPanel implements PropertyChangeListener , HelpCtx.Provider { 43 44 private WebProjectProperties webProperties; 45 private WsCompileEditorSupport.Panel wsCompileEditor; 46 47 private List serviceSettings; 48 49 public CustomizerWSServiceHost(WebProjectProperties webProperties, List 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 66 private void initComponents() { 68 setLayout(new java.awt.BorderLayout ()); 69 70 } 72 73 76 public void addNotify() { 77 super.addNotify(); 78 79 JPanel component = wsCompileEditor.getComponent(); 81 82 removeAll(); add(component); 84 85 component.addPropertyChangeListener(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this); 86 } 87 88 public void removeNotify() { 89 super.removeNotify(); 90 91 JPanel component = wsCompileEditor.getComponent(); 93 component.removePropertyChangeListener(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this); 94 } 95 96 private void initValues() { 97 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 113 public void propertyChange(PropertyChangeEvent evt) { 114 116 WsCompileEditorSupport.FeatureDescriptor newFeatureDesc = (WsCompileEditorSupport.FeatureDescriptor) evt.getNewValue(); 117 String 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 |