KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > netbeans > module > WSDLDataLoaderBeanInfo


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.netbeans.module;
21
22 import java.awt.Image JavaDoc;
23 import java.beans.BeanInfo JavaDoc;
24 import java.beans.IntrospectionException JavaDoc;
25 import java.beans.Introspector JavaDoc;
26 import java.beans.PropertyDescriptor JavaDoc;
27 import java.beans.SimpleBeanInfo JavaDoc;
28 import org.openide.ErrorManager;
29 import org.openide.util.NbBundle;
30
31 import org.openide.util.Utilities;
32
33 /** Description of {@link WSDLDataLoader}.
34  *
35  * @author Jerry Waldorf
36  */

37 public class WSDLDataLoaderBeanInfo extends SimpleBeanInfo JavaDoc {
38
39
40
41     /**
42      * copied from Ant Module
43      */

44     public PropertyDescriptor JavaDoc[] getPropertyDescriptors() {
45         // Make extensions into a r/o property.
46
// It will only contain the WSDL MIME type.
47
// Customizations should be done on the resolver object, not on the extension list.
48
// Does not work to just use additional bean info from UniFileLoader and return one extensions
49
// property with no setter--Introspector cleverly (!&#$@&) keeps your display name
50
// and everything and adds back in the setter from the superclass.
51
// So bypass UniFileLoader in the beaninfo search.
52
try {
53             PropertyDescriptor JavaDoc extensions = new PropertyDescriptor JavaDoc(
54                 "extensions", WSDLDataLoader.class, "getExtensions", null); // NOI18N
55
extensions.setDisplayName(
56                 NbBundle.getMessage(WSDLDataLoaderBeanInfo.class, "PROP_extensions"));
57             extensions.setShortDescription(
58                 NbBundle.getMessage(WSDLDataLoaderBeanInfo.class, "HINT_extensions"));
59             extensions.setExpert(true);
60             return new PropertyDescriptor JavaDoc[] {extensions};
61         } catch (IntrospectionException JavaDoc ie) {
62             ErrorManager.getDefault().notify(ie);
63             return null;
64         }
65     }
66
67
68     // If you have additional properties:
69
/*
70     public PropertyDescriptor[] getPropertyDescriptors () {
71     try {
72             PropertyDescriptor myProp = new PropertyDescriptor ("myProp", MyDataLoader.class);
73             myProp.setDisplayName (NbBundle.getMessage (MyDataLoaderBeanInfo.class, "PROP_myProp"));
74             myProp.setShortDescription (NbBundle.getMessage (MyDataLoaderBeanInfo.class, "HINT_myProp"));
75         return new PropertyDescriptor[] { myProp };
76     } catch (IntrospectionException ie) {
77             TopManager.getDefault ().getErrorManager ().notify (ie);
78         return null;
79     }
80     }
81     */

82
83     public BeanInfo JavaDoc[] getAdditionalBeanInfo () {
84         try {
85             // I.e. MultiFileLoader.class or UniFileLoader.class.
86
return new BeanInfo JavaDoc[] { Introspector.getBeanInfo(WSDLDataLoader.class.getSuperclass()) };
87         } catch (IntrospectionException JavaDoc ie) {
88             org.openide.ErrorManager.getDefault ().notify (ie);
89             return null;
90         }
91     }
92
93     public Image JavaDoc getIcon (int type) {
94         if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) {
95             return Utilities.loadImage ("org.netbeans.modules.xml.wsdl.ui.netbeans.module/resources/wsdl16.gif");
96         } else {
97             return Utilities.loadImage ("org.netbeans.modules.xml.wsdl.ui.netbeans.module/resources/wsdl32.gif");
98         }
99     }
100
101 }
102
Popular Tags