KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xsl > XSLDataLoaderBeanInfo


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 package org.netbeans.modules.xsl;
20
21 import java.beans.*;
22 import java.awt.Image JavaDoc;
23 import org.openide.util.Utilities;
24 import org.openide.loaders.MultiFileLoader;
25 import org.openide.util.Exceptions;
26
27 /**
28  * Loader BeanInfo adding metadata missing in org.openide.loaders.MultiFileLoaderBeanInfo.
29  *
30  * @author Libor Kramolis
31  */

32 public class XSLDataLoaderBeanInfo extends SimpleBeanInfo {
33     /* Icon base dir. */
34     private static final String JavaDoc ICON_DIR_BASE = "org/netbeans/modules/xsl/resources/"; // NOI18N
35

36     /**
37      * Gets the bean's <code>BeanDescriptor</code>s.
38      *
39      * @return BeanDescriptor describing the editable
40      * properties of this bean. May return null if the
41      * information should be obtained by automatic analysis.
42      */

43     public BeanDescriptor getBeanDescriptor() {
44         BeanDescriptor beanDescriptor = new BeanDescriptor ( XSLDataLoader.class , null );
45         beanDescriptor.setDisplayName ( Util.THIS.getString("NAME_XSLDataLoader") );//GEN-HEADEREND:BeanDescriptor
46

47         // Here you can add code for customizing the BeanDescriptor.
48

49         return beanDescriptor;
50     }
51     
52     /**
53      * Gets the bean's <code>PropertyDescriptor</code>s.
54      *
55      * @return An array of PropertyDescriptors describing the editable
56      * properties supported by this bean. May return null if the
57      * information should be obtained by automatic analysis.
58      * <p>
59      * If a property is indexed, then its entry in the result array will
60      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
61      * A client of getPropertyDescriptors can use "instanceof" to check
62      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
63      */

64     public PropertyDescriptor[] getPropertyDescriptors() {
65         int PROPERTY_extensions = 0;
66         PropertyDescriptor[] properties = new PropertyDescriptor[1];
67     
68         try {
69             properties[PROPERTY_extensions] = new PropertyDescriptor ( "extensions", XSLDataLoader.class, "getExtensions", "setExtensions" );
70             properties[PROPERTY_extensions].setDisplayName ( Util.THIS.getString ("PROP_XSL_Extensions") );
71             properties[PROPERTY_extensions].setShortDescription ( Util.THIS.getString ("HINT_XSL_Extensions") );
72         }
73         catch( IntrospectionException e) {
74             Exceptions.printStackTrace(e);
75         }
76         return properties;
77     }
78     
79     /**
80      * Gets the bean's <code>EventSetDescriptor</code>s.
81      *
82      * @return An array of EventSetDescriptors describing the kinds of
83      * events fired by this bean. May return null if the information
84      * should be obtained by automatic analysis.
85      */

86     public EventSetDescriptor[] getEventSetDescriptors() {
87         return new EventSetDescriptor[0];
88     }
89     
90     /**
91      * Gets the bean's <code>MethodDescriptor</code>s.
92      *
93      * @return An array of MethodDescriptors describing the methods
94      * implemented by this bean. May return null if the information
95      * should be obtained by automatic analysis.
96      */

97     public MethodDescriptor[] getMethodDescriptors() {
98         return new MethodDescriptor[0];
99     }
100     
101     /** @param type Desired type of the icon
102      * @return returns the Entity loader's icon
103      */

104     public Image JavaDoc getIcon(final int type) {
105         if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) ||
106             (type == java.beans.BeanInfo.ICON_MONO_16x16)) {
107
108             return Utilities.loadImage (ICON_DIR_BASE + "xslObject.gif"); // NOI18N
109
} else {
110             return Utilities.loadImage (ICON_DIR_BASE + "xslObject32.gif"); // NOI18N
111
}
112     }
113
114     public BeanInfo[] getAdditionalBeanInfo() {
115         try {
116             return new BeanInfo[] {
117                 java.beans.Introspector.getBeanInfo (MultiFileLoader.class)
118             };
119         } catch (IntrospectionException e) {
120             Exceptions.printStackTrace(e);
121         }
122         return super.getAdditionalBeanInfo();
123     }
124
125 }
126
Popular Tags