KickJava   Java API By Example, From Geeks To Geeks.

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


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

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