KickJava   Java API By Example, From Geeks To Geeks.

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


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

32 public class TargNode extends AbstractNode {
33     static Node[] getNodes() {
34         Node[] bogusNodes = new Node[] { Node.EMPTY.cloneNode(), Node.EMPTY.cloneNode() };
35         bogusNodes[0].setName("Bogus1"); bogusNodes[0].setDisplayName("Bogus 1");
36         bogusNodes[1].setName("Bogus2"); bogusNodes[1].setDisplayName("Bogus 2");
37         return bogusNodes;
38     }
39     
40     public TargNode(Targ targ) {
41         super(new MyChildren(Arrays.asList(getNodes())));
42         setDisplayName("Original:"+ targ.getName());
43         setIconBase("org/netbeans/tests/j2eeserver/plugin/registry/target");
44     }
45     
46     public javax.swing.Action JavaDoc[] getActions(boolean context) {
47         return new javax.swing.Action JavaDoc[] {
48             SystemAction.get(TargetAction.class)
49         };
50     }
51     
52     public PropertySet[] getPropertySets() {
53         Sheet sheet = Sheet.createDefault();
54         Sheet.Set ps = sheet.get(Sheet.PROPERTIES);
55         ps.setName("TargetServer");
56         ps.setDisplayName("Target Server");
57         ps.put(new PropertySupport.ReadWrite(
58             "DebugPort", //NOI18N
59
String JavaDoc.class,
60             "Debug Name",
61             "Debug port number or share memory name") {
62                 public Object JavaDoc getValue() {
63                     return "7485";
64                 }
65                 public void setValue(Object JavaDoc home) {
66                 }
67         });
68         return new PropertySet[] { ps };
69     }
70
71     public static class MyChildren extends Children.Array {
72         public MyChildren(Collection nodes) {
73             super(nodes);
74         }
75     }
76     
77     public static class TargetAction extends NodeAction {
78         public String JavaDoc getName () { return "Target Action"; }
79         
80         protected boolean enable(Node[] activatedNodes) {
81             return true;
82         }
83         
84         public org.openide.util.HelpCtx getHelpCtx() {
85             return org.openide.util.HelpCtx.DEFAULT_HELP;
86         }
87         
88         protected void performAction(Node[] activatedNodes) {
89             System.out.println("Some one called target?");
90         }
91     }
92 }
93
Popular Tags