KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > properties > PropertiesDataLoaderBeanInfo


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.modules.properties;
22
23
24 import java.awt.Image JavaDoc;
25 import java.beans.BeanInfo JavaDoc;
26 import java.beans.IntrospectionException JavaDoc;
27 import java.beans.Introspector JavaDoc;
28 import java.beans.PropertyDescriptor JavaDoc;
29 import java.beans.SimpleBeanInfo JavaDoc;
30 import org.openide.ErrorManager;
31
32 import org.openide.loaders.MultiFileLoader;
33 import org.openide.util.NbBundle;
34 import org.openide.util.Utilities;
35
36
37 /** BeanInfo for properties loader.
38  *
39  * @author Ian Formanek
40  */

41 public final class PropertiesDataLoaderBeanInfo extends SimpleBeanInfo JavaDoc {
42
43     public BeanInfo JavaDoc[] getAdditionalBeanInfo () {
44         try {
45             return new BeanInfo JavaDoc[] { Introspector.getBeanInfo (MultiFileLoader.class) };
46         } catch (IntrospectionException JavaDoc ie) {
47             ErrorManager.getDefault().notify(ie);
48             return null;
49         }
50     }
51     
52     /**
53      * @return Returns an array of PropertyDescriptors
54      * describing the editable properties supported by this bean. */

55     public PropertyDescriptor JavaDoc[] getPropertyDescriptors () {
56         try {
57
58             PropertyDescriptor JavaDoc p2 = new PropertyDescriptor JavaDoc(
59                 "extensions", // NOI18N
60
PropertiesDataLoader.class,
61                 "getExtensions", // NOI18N
62
"setExtensions"); // NOI18N
63

64             p2.setDisplayName(NbBundle.getBundle(PropertiesDataLoaderBeanInfo.class).getString("PROP_Ext"));
65             p2.setShortDescription(NbBundle.getBundle(PropertiesDataLoaderBeanInfo.class).getString("HINT_Ext"));
66
67             return new PropertyDescriptor JavaDoc[] {p2};
68         } catch(IntrospectionException JavaDoc ie) {
69             ErrorManager.getDefault().notify(ie);
70             
71             return null;
72         }
73     }
74
75     /** @param type Desired type of the icon
76      * @return returns the properties loader's icon */

77     public Image JavaDoc getIcon(final int type) {
78         if((type == BeanInfo.ICON_COLOR_16x16) || (type == BeanInfo.ICON_MONO_16x16)) {
79             return Utilities.loadImage("org/netbeans/modules/properties/propertiesObject.png"); // NOI18N
80
} else {
81             return Utilities.loadImage("org/netbeans/modules/properties/propertiesObject32.gif"); // NOI18N
82
}
83     }
84 }
85
Popular Tags