Source Code Cross Referenced for WSDLEndpointNode.java in  » IDE-Netbeans » compapp » org » netbeans » modules » compapp » casaeditor » nodes » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » compapp » org.netbeans.modules.compapp.casaeditor.nodes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.compapp.casaeditor.nodes;
043:
044:        import java.awt.Image;
045:        import java.util.ArrayList;
046:        import java.util.List;
047:        import org.netbeans.modules.compapp.casaeditor.Constants;
048:        import org.netbeans.modules.compapp.casaeditor.nodes.actions.WSDLEndpointAction;
049:        import org.netbeans.modules.compapp.casaeditor.nodes.actions.LoadWSDLPortsAction;
050:        import org.netbeans.modules.compapp.casaeditor.nodes.actions.CloneWSDLPortAction;
051:        import org.netbeans.modules.compapp.casaeditor.model.casa.CasaWrapperModel;
052:        import org.netbeans.modules.compapp.casaeditor.model.casa.CasaPort;
053:        import org.netbeans.modules.compapp.casaeditor.properties.PropertyUtils;
054:        import org.netbeans.modules.xml.wsdl.model.Port;
055:        import org.netbeans.modules.xml.wsdl.model.Binding;
056:        import org.netbeans.modules.xml.wsdl.ui.view.treeeditor.NodesFactory;
057:        import org.openide.nodes.Node;
058:        import org.openide.nodes.PropertySupport;
059:        import org.openide.nodes.Sheet;
060:        import org.openide.util.NbBundle;
061:        import org.openide.util.Utilities;
062:        import org.openide.util.actions.SystemAction;
063:
064:        import org.netbeans.modules.compapp.casaeditor.model.casa.CasaComponent;
065:        import org.netbeans.modules.compapp.casaeditor.model.jbi.impl.JBIAttributes;
066:        import org.netbeans.modules.compapp.casaeditor.properties.PortTypeProperty;
067:        import org.netbeans.modules.xml.wsdl.ui.view.treeeditor.PortNode;
068:        import org.openide.nodes.Children;
069:
070:        import javax.swing.Action;
071:
072:        /**
073:         *
074:         * @author Josh Sandusky
075:         */
076:        public class WSDLEndpointNode extends CasaNode {
077:
078:            private static final Image ICON = Utilities
079:                    .loadImage("org/netbeans/modules/compapp/casaeditor/nodes/resources/WSDLEndpointNode.png"); // NOI18N
080:
081:            private static final String CHILD_ID_PROVIDES = "Provides"; // NOI18N
082:            private static final String CHILD_ID_CONSUMES = "Consumes"; // NOI18N
083:            private static final String SOAP_BINDING = "soap"; // NOI18N
084:
085:            public WSDLEndpointNode(CasaPort component, CasaNodeFactory factory) {
086:                super (component, new MyChildren(component, factory), factory);
087:            }
088:
089:            @Override
090:            public String getName() {
091:                CasaPort endpoint = (CasaPort) getData();
092:                if (endpoint != null) {
093:                    return endpoint.getEndpointName();
094:                    //return endpoint.getQName().getLocalPart(); // TMP FIXME
095:                }
096:                return super .getName();
097:            }
098:
099:            @Override
100:            public String getHtmlDisplayName() {
101:                try {
102:                    String htmlDisplayName = getName();
103:                    CasaPort endpoint = (CasaPort) getData();
104:                    String decoration = null;
105:                    if (endpoint != null) {
106:                        decoration = NbBundle.getMessage(
107:                                WSDLEndpointNode.class, "LBL_NameAttr", // NOI18N
108:                                endpoint.getEndpointName());
109:                    }
110:                    if (decoration == null) {
111:                        return htmlDisplayName;
112:                    }
113:                    return htmlDisplayName + " <font color='#999999'>"
114:                            + decoration + "</font>"; // NOI18N
115:                } catch (Throwable t) {
116:                    // getHtmlDisplayName MUST recover gracefully.
117:                    return getBadName();
118:                }
119:            }
120:
121:            // todo: 05/31/07, enable WSIT GUI
122:            @Override
123:            protected void addCustomActions(List<Action> actions) {
124:                CasaPort cp = (CasaPort) this .getData();
125:                CasaWrapperModel model = (CasaWrapperModel) cp.getModel();
126:                if (model.isEditable(cp)) {
127:                    // only add this for soap port...
128:                    if (model.getBindingType(cp).equalsIgnoreCase(SOAP_BINDING)) {
129:                        actions.add(new WSDLEndpointAction());
130:                    }
131:                } else { // non-editable port
132:                    actions.add(SystemAction.get(CloneWSDLPortAction.class));
133:                }
134:            }
135:
136:            protected void setupPropertySheet(Sheet sheet) {
137:                final CasaPort casaPort = (CasaPort) getData();
138:                if (casaPort == null) {
139:                    return;
140:                }
141:
142:                Sheet.Set identificationProperties = getPropertySet(sheet,
143:                        PropertyUtils.PropertiesGroups.IDENTIFICATION_SET);
144:
145:                Node.Property portTypeDefinition = new PortTypeProperty(this );
146:                identificationProperties.put(portTypeDefinition);
147:
148:                PropertyUtils.installEndpointNameProperty(
149:                        identificationProperties, this , casaPort,
150:                        JBIAttributes.ENDPOINT_NAME.getName(), "endpointName", // NOI18N
151:                        NbBundle.getMessage(getClass(), "PROP_EndpointName"), // NOI18N
152:                        NbBundle.getMessage(getClass(), "PROP_EndpointName")); // NOI18N
153:
154:                Node.Property<String> componentNameSupport = new PropertySupport.ReadOnly<String>(
155:                        "componentName", // NOI18N
156:                        String.class, NbBundle.getMessage(getClass(),
157:                                "PROP_ComponentName"), // NOI18N
158:                        Constants.EMPTY_STRING) {
159:                    public String getValue() {
160:                        return ((CasaWrapperModel) casaPort.getModel())
161:                                .getBindingComponentName(casaPort);
162:                    }
163:                };
164:                identificationProperties.put(componentNameSupport);
165:
166:                // Add all concrete child properties, as a convenience to the user.
167:                for (Node child : getChildren().getNodes()) {
168:                    if (child instanceof  PortNode) {
169:                        addPortChildrenProperties(sheet, child.getChildren(),
170:                                isEditable());
171:                        break;
172:                    }
173:                }
174:            }
175:
176:            private static void addPortChildrenProperties(Sheet sheet,
177:                    Children children, boolean bEditable) {
178:                if (children == null) {
179:                    return;
180:                }
181:                Node child;
182:                for (Node origChild : children.getNodes()) {
183:                    child = bEditable ? origChild : new ReadOnlyFilterNode(
184:                            origChild);
185:                    Sheet.Set portProperties = new Sheet.Set();
186:                    portProperties.setName(child.getDisplayName());
187:                    sheet.put(portProperties);
188:
189:                    PropertySet[] propertySets = child.getPropertySets();
190:                    if (propertySets != null) {
191:                        for (PropertySet propertySet : propertySets) {
192:                            portProperties.put(propertySet.getProperties());
193:                        }
194:                    }
195:                    addPortChildrenProperties(sheet, child.getChildren(),
196:                            bEditable);
197:                }
198:            }
199:
200:            private static class MyChildren extends CasaNodeChildren {
201:                public MyChildren(CasaComponent component,
202:                        CasaNodeFactory factory) {
203:                    super (component, factory);
204:                }
205:
206:                protected Node[] createNodes(Object key) {
207:                    if (key instanceof  Port) {
208:                        Node pn = NodesFactory.getInstance().create((Port) key);
209:                        return new Node[] { pn };
210:                    } else if (key instanceof  Binding) {
211:                        Node bn = NodesFactory.getInstance().create(
212:                                (Binding) key);
213:                        return new Node[] { bn };
214:                    }
215:                    return null;
216:                }
217:
218:                public Object getChildKeys(Object data) {
219:                    List<Object> children = new ArrayList<Object>();
220:                    CasaPort endpoint = (CasaPort) getData();
221:                    if (endpoint != null) {
222:
223:                        // todo: 12/15/06 test code...
224:                        Port p = ((CasaWrapperModel) endpoint.getModel())
225:                                .getLinkedWSDLPort(endpoint);
226:                        if (p != null) {
227:                            children.add(p);
228:                            // TMP: the try/catch is added temporarly to ignore an 
229:                            // illegal state exception thrown when executing the steps
230:                            // in BUG #13.
231:                            // I probably need to fire some event when port/binding/service 
232:                            // is removed from wsdl model or need to change the order 
233:                            // that things get deleted in the model. 
234:                            // -Jun 01/26/07
235:                            try {
236:                                Binding b = p.getBinding().get();
237:                                if (b != null) {
238:                                    children.add(b);
239:                                }
240:                            } catch (Exception e) {
241:                                e.printStackTrace();
242:                            }
243:                        }
244:
245:                        if (endpoint.getConsumes() != null) {
246:                            children.add(CHILD_ID_CONSUMES);
247:                        }
248:                        if (endpoint.getProvides() != null) {
249:                            children.add(CHILD_ID_PROVIDES);
250:                        }
251:                    }
252:                    return children;
253:                }
254:            }
255:
256:            public Image getIcon(int type) {
257:                return ICON;
258:            }
259:
260:            public Image getOpenedIcon(int type) {
261:                return ICON;
262:            }
263:
264:            public boolean isEditable(String propertyType) {
265:                CasaPort port = (CasaPort) getData();
266:                if (port != null) {
267:                    return getModel().isEditable(port, propertyType);
268:                }
269:                return false;
270:            }
271:
272:            public boolean isEditable() {
273:                CasaPort port = (CasaPort) getData();
274:                if (port != null) {
275:                    return getModel().isEditable(port);
276:                }
277:                return false;
278:            }
279:
280:            public boolean isDeletable() {
281:                CasaPort port = (CasaPort) getData();
282:                if (port != null) {
283:                    return getModel().isDeletable(port);
284:                }
285:                return false;
286:            }
287:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.