KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > beaninfo > SwingBrowserBeanInfo


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 package org.netbeans.beaninfo;
21
22 import java.awt.Image JavaDoc;
23 import java.beans.*;
24
25 import org.netbeans.core.ui.SwingBrowser;
26 import org.openide.util.NbBundle;
27 import org.openide.util.Utilities;
28
29 /**
30  * Swing HTML Browser support.
31  *
32  * Factory for built-in Swing HTML browser.
33  *
34  * @author Radim Kubacki
35  */

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

45     public BeanDescriptor getBeanDescriptor() {
46         BeanDescriptor beanDescriptor = new BeanDescriptor (SwingBrowser.class);
47         beanDescriptor.setDisplayName (NbBundle.getMessage (SwingBrowserBeanInfo.class, "CTL_SwingBrowser"));
48         beanDescriptor.setShortDescription (NbBundle.getMessage (SwingBrowserBeanInfo.class, "HINT_SwingBrowser"));
49
50         beanDescriptor.setValue ("helpID", "org.openide.awt.SwingBrowser"); // NOI18N
51
return beanDescriptor;
52     }
53
54     /**
55      * Gets the bean's <code>PropertyDescriptor</code>s.
56      *
57      * @return An array of PropertyDescriptors describing the editable
58      * properties supported by this bean. May return null if the
59      * information should be obtained by automatic analysis.
60      * <p>
61      * If a property is indexed, then its entry in the result array will
62      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
63      * A client of getPropertyDescriptors can use "instanceof" to check
64      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
65      */

66     public PropertyDescriptor[] getPropertyDescriptors() {
67         try {
68             PropertyDescriptor [] props = new PropertyDescriptor [] {
69                 new PropertyDescriptor (SwingBrowser.PROP_DESCRIPTION, SwingBrowser.class, "getDescritpion", null) // NOI18N
70
};
71             props[0].setDisplayName (NbBundle.getMessage (SwingBrowserBeanInfo.class, "PROP_SwingBrowserDescription"));
72             props[0].setShortDescription (NbBundle.getMessage (SwingBrowserBeanInfo.class, "HINT_SwingBrowserDescription"));
73             return props;
74         } catch( IntrospectionException e) {
75             return null;
76         }
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         try {
88             return new EventSetDescriptor[] {
89                 new EventSetDescriptor (SwingBrowser.class,
90                         "propertyChangeListener", // NOI18N
91
PropertyChangeListener.class,
92                         new String JavaDoc[] {"propertyChange"}, // NOI18N
93
"addPropertyChangeListener", // NOI18N
94
"removePropertyChangeListener" // NOI18N
95
) // NOI18N
96
};
97         }
98         catch( IntrospectionException e) {
99             return null;
100         }
101     }
102
103     /**
104     * Returns the internal browser icon.
105     */

106     public Image JavaDoc getIcon (int type) {
107         return Utilities.loadImage("org/openide/resources/html/htmlView.gif"); // NOI18N
108
}
109 }
110
Popular Tags