KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tests > j2eeserver > plugin > registry > ManagerNode


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.tests.j2eeserver.plugin.registry;
21
22 import org.openide.nodes.*;
23 import org.openide.util.actions.*;
24 import java.util.*;
25 import org.netbeans.tests.j2eeserver.plugin.jsr88.*;
26
27 /**
28  *
29  * @author nn136682
30  */

31 public class ManagerNode extends AbstractNode {
32     static java.util.Collection JavaDoc bogusNodes = java.util.Arrays.asList(new Node[] { Node.EMPTY, Node.EMPTY });
33
34     public ManagerNode(DepManager manager) {
35         super(new MyChildren(bogusNodes));
36         setDisplayName("Original:"+manager.getName());
37         setIconBase("org/netbeans/tests/j2eeserver/plugin/registry/manager");
38     }
39     
40     public javax.swing.Action JavaDoc[] getActions(boolean context) {
41         return new javax.swing.Action JavaDoc[] {
42             SystemAction.get(ManagerAction.class)
43         };
44     }
45     
46     public PropertySet[] getPropertySets() {
47         Sheet sheet = Sheet.createDefault();
48         Sheet.Set ps = sheet.get(Sheet.PROPERTIES);
49         //ps.setDisplayName("Manager");
50
//ps.setName("Manager");
51
ps.put(new PropertySupport.ReadWrite(
52             "ManagerHome", //NOI18N
53
String JavaDoc.class,
54             "Manager Home",
55             "Home of manager") {
56                 public Object JavaDoc getValue() {
57                     return "Madison";
58                 }
59                 public void setValue(Object JavaDoc home) {
60                 }
61         });
62         return new PropertySet[] { ps };
63     }
64
65     public static class MyChildren extends Children.Array {
66         public MyChildren(Collection nodes) {
67             super(nodes);
68         }
69     }
70     
71     public static class ManagerAction extends NodeAction {
72         public String JavaDoc getName () { return "Manager Action"; }
73         
74         protected boolean enable(Node[] activatedNodes) {
75             return true;
76         }
77         
78         public org.openide.util.HelpCtx getHelpCtx() {
79             return org.openide.util.HelpCtx.DEFAULT_HELP;
80         }
81         
82         protected void performAction(Node[] activatedNodes) {
83             System.out.println("Some one called Manager?");
84         }
85     }
86 }
87
Popular Tags