KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > registry > nodes > WebServiceGroupNode


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

19
20 package org.netbeans.modules.websvc.registry.nodes;
21
22 import org.openide.actions.*;
23 import org.openide.nodes.*;
24 import org.openide.util.HelpCtx;
25 import org.openide.util.NbBundle;
26 import org.openide.util.Utilities;
27 import org.openide.util.actions.SystemAction;
28
29 import org.netbeans.modules.websvc.registry.actions.*;
30 import org.netbeans.modules.websvc.registry.model.WebServiceGroup;
31 import org.netbeans.modules.websvc.registry.model.WebServiceListModel;
32 import java.awt.Image JavaDoc;
33 import java.io.IOException JavaDoc;
34 import java.util.Iterator JavaDoc;
35 import javax.swing.Action JavaDoc;
36
37 /**
38  * A second level node representing Group of Web Services
39  * @author Winston Prakash
40  */

41 public class WebServiceGroupNode extends AbstractNode implements WebServiceGroupCookie {
42     WebServiceGroup websvcGroup;
43
44     public WebServiceGroupNode(WebServiceGroup wsGroup) {
45         super(new WebServiceGroupNodeChildren(wsGroup));
46         websvcGroup = wsGroup;
47         setIconBaseWithExtension("org/netbeans/modules/websvc/registry/resources/folder.png");
48         
49         getCookieSet().add(this);
50     }
51
52     public WebServiceGroup getWebServiceGroup() {
53         return websvcGroup;
54     }
55
56     public boolean canRename() {
57         return true;
58     }
59
60     public String JavaDoc getName() {
61         return websvcGroup.getName();
62     }
63
64     public void setName(String JavaDoc name){
65         websvcGroup.setName(name);
66         setDisplayName(name);
67         this.fireDisplayNameChange(name,null);
68     }
69
70 // protected SystemAction[] createActions() {
71
// return new SystemAction[] {
72
// SystemAction.get(AddWebServiceAction.class),
73
// SystemAction.get(DeleteWebServiceGroupAction.class),
74
// SystemAction.get(RenameAction.class)
75
// };
76
// }
77

78     public Action[] getActions(boolean context) {
79         return new SystemAction[] {
80             SystemAction.get(AddWebServiceAction.class),
81             SystemAction.get(DeleteWebServiceGroupAction.class),
82             SystemAction.get(RenameAction.class)
83         };
84     }
85
86     public boolean canDestroy() {
87         return true;
88     }
89
90     public void destroy() throws IOException JavaDoc{
91         WebServiceListModel wsListModel = WebServiceListModel.getInstance();
92         /**
93          * Fix for Bug #:5039378
94          * We simply need to remove the group from the list model and the list model
95          * will take care of removing the children.
96          */

97         wsListModel.removeWebServiceGroup(websvcGroup.getId());
98         super.destroy();
99     }
100
101     public HelpCtx getHelpCtx() {
102         return new HelpCtx("websvcGroupNode");
103     }
104 }
105
Popular Tags