1 19 20 28 29 package org.netbeans.modules.websvc.customization.multiview; 30 31 import java.util.Collection ; 32 import java.util.HashMap ; 33 import java.util.Map ; 34 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; 35 import org.netbeans.modules.websvc.customization.multiview.WSCustomizationView.BindingKey; 36 import org.netbeans.modules.xml.multiview.ui.InnerPanelFactory; 37 import org.netbeans.modules.xml.multiview.ui.SectionInnerPanel; 38 import org.netbeans.modules.xml.multiview.ui.SectionView; 39 import org.netbeans.modules.xml.multiview.ui.ToolBarDesignEditor; 40 import org.netbeans.modules.xml.wsdl.model.Binding; 41 import org.netbeans.modules.xml.wsdl.model.BindingOperation; 42 import org.netbeans.modules.xml.wsdl.model.Definitions; 43 import org.netbeans.modules.xml.wsdl.model.Fault; 44 import org.netbeans.modules.xml.wsdl.model.Operation; 45 import org.netbeans.modules.xml.wsdl.model.Port; 46 import org.netbeans.modules.xml.wsdl.model.PortType; 47 import org.netbeans.modules.xml.wsdl.model.Service; 48 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 49 import org.openide.nodes.Node; 50 51 55 public class WSPanelFactory implements InnerPanelFactory { 56 private ToolBarDesignEditor editor; 57 private Node node; 58 private JaxWsModel jmodel; 59 60 private Map <Object , SaveableSectionInnerPanel> panels; 61 62 private DefinitionsPanel definitionsPanel; 64 private PortTypePanel portTypePanel; 65 private PortTypeOperationPanel portTypeOperationPanel; 66 private PortTypeOperationFaultPanel portTypeOperationFaultPanel; 67 private BindingPanel bindingPanel; 68 private BindingOperationPanel bindingOperationPanel; 69 private ServicePanel servicePanel; 70 private PortPanel portPanel; 71 private ExternalBindingPanel externalBindingPanel; 72 private Definitions primaryDefinitions; 73 76 public WSPanelFactory(ToolBarDesignEditor editor, 77 Node node, Definitions primaryDefinitions, JaxWsModel jmodel) { 78 this.editor = editor; 79 this.node = node; 80 this.primaryDefinitions = primaryDefinitions; 81 this.jmodel = jmodel; 82 83 panels = new HashMap <Object , SaveableSectionInnerPanel>(); 84 } 85 86 public Collection <SaveableSectionInnerPanel> getPanels(){ 87 return panels.values(); 88 } 89 90 public SectionInnerPanel createInnerPanel(Object key) { 91 if(key instanceof Definitions){ 92 Definitions definitions = (Definitions)key; 93 definitionsPanel = (DefinitionsPanel)panels.get(definitions); 94 if(definitionsPanel == null){ 95 definitionsPanel = new DefinitionsPanel((SectionView) editor.getContentView(), 96 definitions, node); 97 panels.put(definitions, definitionsPanel); 98 } 99 return definitionsPanel; 100 } else if (key instanceof PortType){ 101 PortType portType = (PortType)key; 102 portTypePanel = (PortTypePanel)panels.get(portType); 103 if(portTypePanel == null){ 104 portTypePanel = new PortTypePanel((SectionView) editor.getContentView(), 105 portType, node, primaryDefinitions); 106 panels.put(portType, portTypePanel); 107 } 108 return portTypePanel; 109 } else if (key instanceof Operation){ 110 Operation operation = (Operation)key; 111 portTypeOperationPanel = (PortTypeOperationPanel)panels.get(operation); 112 if(portTypeOperationPanel == null){ 113 portTypeOperationPanel = new PortTypeOperationPanel((SectionView) editor.getContentView(), 114 operation, node, primaryDefinitions); 115 panels.put(operation, portTypeOperationPanel); 116 } 117 return portTypeOperationPanel; 118 } else if (key instanceof Fault){ 119 Fault fault = (Fault)key; 120 portTypeOperationFaultPanel = (PortTypeOperationFaultPanel)panels.get(fault); 121 if(portTypeOperationFaultPanel == null){ 122 portTypeOperationFaultPanel = new PortTypeOperationFaultPanel((SectionView) editor.getContentView(), 123 fault); 124 panels.put(fault, portTypeOperationFaultPanel); 125 } 126 return portTypeOperationFaultPanel; 127 } else if (key instanceof Binding){ 128 Binding binding = (Binding)key; 129 bindingPanel = (BindingPanel)panels.get(binding); 130 if(bindingPanel == null){ 131 bindingPanel = new BindingPanel((SectionView) editor.getContentView(), 132 binding, primaryDefinitions); 133 panels.put(binding, bindingPanel); 134 } 135 return bindingPanel; 136 137 } else if (key instanceof BindingOperation){ 138 BindingOperation bindingOperation = (BindingOperation)key; 139 bindingOperationPanel = (BindingOperationPanel)panels.get(bindingOperation); 140 if(bindingOperationPanel == null){ 141 bindingOperationPanel = new BindingOperationPanel((SectionView) editor.getContentView(), 142 bindingOperation, primaryDefinitions); 143 panels.put(bindingOperation, bindingOperationPanel); 144 } 145 return bindingOperationPanel; 146 } else if (key instanceof Service){ 147 Service service = (Service)key; 148 servicePanel = (ServicePanel)panels.get(service); 149 if(servicePanel == null){ 150 servicePanel = new ServicePanel((SectionView) editor.getContentView(), 151 service); 152 panels.put(service, servicePanel); 153 } 154 return servicePanel; 155 } else if (key instanceof Port){ 156 Port port = (Port)key; 157 portPanel = (PortPanel)panels.get(port); 158 if(portPanel == null){ 159 portPanel = new PortPanel((SectionView) editor.getContentView(), 160 port, node); 161 panels.put(port, portPanel); 162 } 163 return portPanel; 164 } else if(key instanceof BindingKey){ 165 BindingKey bindingKey = (BindingKey)key; 166 externalBindingPanel = (ExternalBindingPanel)panels.get(bindingKey); 167 if(externalBindingPanel == null){ 168 externalBindingPanel = new ExternalBindingPanel((SectionView) editor.getContentView(), 169 node, jmodel); 170 panels.put(bindingKey,externalBindingPanel); 171 } 172 return externalBindingPanel; 173 } 174 return null; 175 } 176 } 177 | Popular Tags |