KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > treeeditor > PartnerLinkTypeNode


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.wsdl.ui.view.treeeditor;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.List JavaDoc;
24 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.PartnerLinkType;
25 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.Role;
26 import org.openide.nodes.Node;
27 import org.openide.util.NbBundle;
28
29 /**
30  * Class PartnerLinkTypeNode represents a partner link type component.
31  *
32  * @author Nathan Fiedler
33  */

34 public class PartnerLinkTypeNode extends ExtensibilityElementNode {
35     /** The partner link type component. */
36     private PartnerLinkType partnerLinkType;
37
38     /**
39      * Creates a new instance of PartnerLinkTypeNode.
40      *
41      * @param wsdlComponent the WSDL component.
42      */

43     public PartnerLinkTypeNode(PartnerLinkType wsdlComponent) {
44         super(wsdlComponent);
45         partnerLinkType = wsdlComponent;
46     }
47
48     @Override JavaDoc
49     protected List JavaDoc<Node.Property> createAlwaysPresentAttributeProperty() throws Exception JavaDoc {
50         ArrayList JavaDoc<Node.Property> list = new ArrayList JavaDoc<Node.Property>();
51         Role role = partnerLinkType.getRole1();
52         if (role != null) {
53             String JavaDoc name = role.getName();
54             String JavaDoc dname = NbBundle.getMessage(PartnerLinkTypeNode.class,
55                     "ROLE1_NAME_DISPLAYNAME");
56             String JavaDoc desc = NbBundle.getMessage(PartnerLinkTypeNode.class,
57                     "ROLE_NAME_DESC");
58             Node.Property prop = new ReadOnlyProperty("role1", String JavaDoc.class,
59                     dname, desc, name);
60             list.add(prop);
61         }
62         role = partnerLinkType.getRole2();
63         if (role != null) {
64             String JavaDoc name = role.getName();
65             String JavaDoc dname = NbBundle.getMessage(PartnerLinkTypeNode.class,
66                     "ROLE2_NAME_DISPLAYNAME");
67             String JavaDoc desc = NbBundle.getMessage(PartnerLinkTypeNode.class,
68                     "ROLE_NAME_DESC");
69             Node.Property prop = new ReadOnlyProperty("role2", String JavaDoc.class,
70                     dname, desc, name);
71             list.add(prop);
72         }
73         return list;
74     }
75 }
76
Popular Tags