KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openidex > search > SearchTypeBeanInfo


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.openidex.search;
22
23
24 import java.awt.Image JavaDoc;
25 import java.beans.*;
26
27 import org.openide.ErrorManager;
28
29 /** Bean info for <code>SearchType</code> class.
30  *
31  * @author Petr Kuzel
32  * */

33 public class SearchTypeBeanInfo extends SimpleBeanInfo {
34
35     /**
36      * Gets the beans <code>PropertyDescriptor</code>s.
37      *
38      * @return An array of PropertyDescriptors describing the editable
39      * properties supported by this bean. May return null if the
40      * information should be obtained by automatic analysis.
41      * <p>
42      * If a property is indexed, then its entry in the result array will
43      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
44      * A client of getPropertyDescriptors can use "instanceof" to check
45      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
46      */

47     public PropertyDescriptor[] getPropertyDescriptors() {
48         try {
49         PropertyDescriptor[] properties = new PropertyDescriptor[2];
50             properties[0] = new PropertyDescriptor ( "name", SearchType.class, "getName", "setName" ); // NOI18N
51
properties[0].setHidden ( true );
52             properties[1] = new PropertyDescriptor ( "helpCtx", SearchType.class, "getHelpCtx", null ); // NOI18N
53
properties[1].setHidden ( true );
54             return properties;
55         } catch( IntrospectionException e) {
56         ErrorManager.getDefault().notify(e);
57         return null;
58         }
59     }
60
61     /**
62      * Gets the beans <code>EventSetDescriptor</code>s.
63      *
64      * @return An array of EventSetDescriptors describing the kinds of
65      * events fired by this bean. May return null if the information
66      * should be obtained by automatic analysis.
67      */

68     public EventSetDescriptor[] getEventSetDescriptors() {
69         try {
70         return new EventSetDescriptor[] {
71             new EventSetDescriptor ( SearchType.class, "propertyChangeListener", PropertyChangeListener.class, new String JavaDoc[0], "addPropertyChangeListener", "removePropertyChangeListener" ) // NOI18N
72
};
73         } catch( IntrospectionException e) {
74         ErrorManager.getDefault().notify(e);
75         return null;
76         }
77     }
78
79
80     /**
81      * This method returns an image object that can be used to
82      * represent the bean in toolboxes, toolbars, etc. Icon images
83      * will typically be GIFs, but may in future include other formats.
84      * <p>
85      * Beans aren't required to provide icons and may return null from
86      * this method.
87      * <p>
88      * There are four possible flavors of icons (16x16 color,
89      * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
90      * support a single icon we recommend supporting 16x16 color.
91      * <p>
92      * We recommend that icons have a "transparent" background
93      * so they can be rendered onto an existing background.
94      *
95      * @param iconKind The kind of icon requested. This should be
96      * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
97      * ICON_MONO_16x16, or ICON_MONO_32x32.
98      * @return An image object representing the requested icon. May
99      * return null if no suitable icon is available.
100      */

101
102     public Image JavaDoc getIcon(int iconKind) {
103         if (iconKind == ICON_COLOR_16x16)
104             return loadImage( "org/openidex/search/res/find.gif" ); // NOI18N
105

106         return null;
107     }
108
109     public BeanDescriptor getBeanDescriptor(){
110         BeanDescriptor descr = new BeanDescriptor(SearchType.class);
111         descr.setDisplayName(org.openide.util.NbBundle.getBundle(SearchTypeBeanInfo.class).getString("CTL_SearchTypes"));
112         return descr;
113     }
114
115     public BeanInfo[] getAdditionalBeanInfo () {
116         try {
117             return new BeanInfo[] { Introspector.getBeanInfo (org.openide.ServiceType.class) };
118         } catch (IntrospectionException ie) {
119         ErrorManager.getDefault().notify(ie);
120             return null;
121         }
122     }
123
124
125 }
126
Popular Tags