1 19 package org.netbeans.modules.websvc.dev.wizard.nodes; 20 21 25 import java.util.ArrayList ; 26 import java.util.Collections ; 27 import java.util.List ; 28 import org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlPort; 29 import org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlService; 30 import org.openide.nodes.Children; 31 import org.openide.nodes.Node; 32 33 public class ServiceChildren extends Children.Keys { 34 WsdlService wsdlService; 35 36 public ServiceChildren(WsdlService wsdlService) { 37 this.wsdlService=wsdlService; 38 } 39 40 protected void addNotify() { 41 super.addNotify(); 42 updateKeys(); 43 } 44 45 protected void removeNotify() { 46 setKeys(Collections.EMPTY_SET); 47 super.removeNotify(); 48 } 49 50 private void updateKeys() { 51 List keys = wsdlService.getPorts(); 52 setKeys(keys==null?new ArrayList ():keys); 53 } 54 55 protected Node[] createNodes(Object key) { 56 if(key instanceof WsdlPort) { 57 return new Node[] {new PortNode((WsdlPort)key)}; 58 } 59 return new Node[0]; 60 } 61 62 } 63 | Popular Tags |