KickJava   Java API By Example, From Geeks To Geeks.

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


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
21 package org.netbeans.modules.xml.wsdl.ui.view.treeeditor;
22
23 import java.util.Collection JavaDoc;
24
25 import org.netbeans.modules.xml.wsdl.model.Definitions;
26 import org.netbeans.modules.xml.wsdl.model.PortType;
27 import org.netbeans.modules.xml.wsdl.ui.cookies.AddChildWSDLElementCookie;
28 import org.netbeans.modules.xml.wsdl.ui.extensibility.model.WSDLExtensibilityElements;
29 import org.netbeans.modules.xml.wsdl.ui.view.treeeditor.newtype.ExtensibilityElementNewTypesFactory;
30 import org.netbeans.modules.xml.wsdl.ui.view.treeeditor.newtype.PortTypeNewType;
31 import org.openide.util.NbBundle;
32 import org.openide.util.Utilities;
33 import org.openide.util.datatransfer.NewType;
34
35
36 /**
37  *
38  * @author Ritesh Adval
39  *
40  */

41 public class PortTypeFolderNode extends FolderNode {
42
43     private Definitions mDef = null;
44     
45     
46     public PortTypeFolderNode(Definitions element) {
47         super(new PortTypeFolderChildren(element), element, PortType.class);
48         mDef = element;
49         this.setDisplayName(NbBundle.getMessage(MessageFolderNode.class,
50         "PORTTYPE_FOLDER_NODE_NAME"));
51         getLookupContents().add(new AddChildWSDLElementCookie(element));
52         this.addNodeListener(new WSDLNodeListener(this));
53         BADGE_ICON= Utilities.loadImage
54         ("org/netbeans/modules/xml/wsdl/ui/view/resources/port_type_badge.png");
55     }
56
57
58     @Override JavaDoc
59     public final NewType[] getNewTypes()
60     {
61         if (isEditable()) {
62             return new NewType[] {new PortTypeNewType(mDef)};
63         }
64         return new NewType[] {};
65     }
66     
67     public Object JavaDoc getWSDLConstruct() {
68         return mDef;
69     }
70
71     public static final class PortTypeFolderChildren extends GenericWSDLComponentChildren {
72         public PortTypeFolderChildren(Definitions definitions) {
73             super(definitions);
74         }
75
76         @Override JavaDoc
77         protected Collection JavaDoc getKeys() {
78             Definitions def = (Definitions) getWSDLComponent();
79             return def.getPortTypes();
80         }
81     }
82
83     @Override JavaDoc
84     public Class JavaDoc getType() {
85         return PortType.class;
86     }
87 }
88
Popular Tags