KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > serverresources > beans > WS70MailResourceBeanDataNode


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  * WS70MailResourceBeanDataNode.java
22  */

23
24 package org.netbeans.modules.j2ee.sun.ws7.serverresources.beans;
25
26 import java.beans.PropertyEditor JavaDoc;
27
28 import org.openide.util.Utilities;
29 import org.openide.util.HelpCtx;
30 import org.openide.util.NbBundle;
31
32 import org.openide.nodes.Node;
33 import org.openide.nodes.Sheet;
34 import org.openide.nodes.BeanNode;
35 import org.openide.nodes.PropertySupport;
36
37 import org.openide.filesystems.FileObject;
38
39 import org.netbeans.modules.j2ee.sun.ide.editors.NameValuePairsPropertyEditor;
40 import org.netbeans.modules.j2ee.sun.ws7.serverresources.loaders.SunWS70ResourceDataObject;
41
42 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.WS70Resources;
43 /**
44  *
45  * Code reused from Appserver common API module
46  */

47 public class WS70MailResourceBeanDataNode extends WS70BaseResourceNode implements java.beans.PropertyChangeListener JavaDoc{
48     private WS70MailResourceBean resource = null;
49    
50     /**
51      * Creates a new instance of WS70MailResourceBeanDataNode
52      */

53     public WS70MailResourceBeanDataNode(SunWS70ResourceDataObject obj, WS70MailResourceBean key) {
54         super(obj);
55         resource = key;
56         setIconBaseWithExtension("org/netbeans/modules/j2ee/sun/ws7/resources/ResNodeNodeIcon.gif"); //NOI18N
57
setShortDescription (NbBundle.getMessage (WS70MailResourceBeanDataNode.class, "DSC_MailNode"));//NOI18N
58
key.addPropertyChangeListener(this);
59         
60         Class JavaDoc clazz = key.getClass ();
61         try{
62             createProperties(key, Utilities.getBeanInfo(clazz));
63         } catch (Exception JavaDoc e){
64             e.printStackTrace();
65         }
66     }
67  
68     
69     protected WS70MailResourceBeanDataNode getWS70MailResourceBeanDataNode(){
70         return this;
71     }
72     
73     protected WS70MailResourceBean getWS70MailResourceBean(){
74         return resource;
75     }
76     
77     public void propertyChange(java.beans.PropertyChangeEvent JavaDoc evt) {
78         FileObject resFile = getWS70MailResourceBeanDataNode().getDataObject().getPrimaryFile();
79         WS70ResourceUtils.saveNodeToXml(resFile, resource.getGraph());
80     }
81     
82     public WS70Resources getBeanGraph(){
83         return resource.getGraph();
84     }
85     
86     public HelpCtx getHelpCtx() {
87         return null; // new HelpCtx("AS_Res_Mail");//NOI18N
88
}
89     
90     protected void createProperties(Object JavaDoc bean, java.beans.BeanInfo JavaDoc info) {
91         BeanNode.Descriptor d = BeanNode.computeProperties(bean, info);
92         Sheet sets = getSheet();
93         Sheet.Set pset = Sheet.createPropertiesSet();
94         pset.put(d.property);
95         //pset.put(p);
96
// pset.setValue("helpID", "AS_Res_Mail_Props"); //NOI18N
97
sets.put(pset);
98     }
99         
100 }
101
Popular Tags