KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > tax > beans > beaninfo > TreeDocumentFragmentBeanInfo


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.xml.tax.beans.beaninfo;
20
21 import java.beans.*;
22 import org.netbeans.tax.TreeDocumentFragment;
23 import org.netbeans.modules.xml.tax.beans.customizer.TreeDocumentFragmentCustomizer;
24 import org.netbeans.modules.xml.tax.beans.editor.VersionEditor;
25 import org.netbeans.modules.xml.tax.beans.editor.EncodingEditor;
26 import org.openide.util.Exceptions;
27
28 /**
29  *
30  * @author Libor Kramolis
31  * @version 0.1
32  */

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

42     public BeanDescriptor getBeanDescriptor() {
43     return new BeanDescriptor ( TreeDocumentFragment.class , TreeDocumentFragmentCustomizer.class );
44     }
45
46     /**
47      * Gets the bean's <code>PropertyDescriptor</code>s.
48      *
49      * @return An array of PropertyDescriptors describing the editable
50      * properties supported by this bean. May return null if the
51      * information should be obtained by automatic analysis.
52      * <p>
53      * If a property is indexed, then its entry in the result array will
54      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
55      * A client of getPropertyDescriptors can use "instanceof" to check
56      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
57      */

58     public PropertyDescriptor[] getPropertyDescriptors() {
59         int PROPERTY_encoding = 0;
60         int PROPERTY_version = 1;
61         PropertyDescriptor[] properties = new PropertyDescriptor[2];
62
63         try {
64             properties[PROPERTY_encoding] = new PropertyDescriptor ( "encoding", TreeDocumentFragment.class, "getEncoding", "setEncoding" ); // NOI18N
65
properties[PROPERTY_encoding].setDisplayName ( Util.THIS.getString ( "PROP_TreeDocumentFragmentBeanInfo_encoding" ) );
66             properties[PROPERTY_encoding].setShortDescription ( Util.THIS.getString ( "HINT_TreeDocumentFragmentBeanInfo_encoding" ) );
67             properties[PROPERTY_encoding].setPropertyEditorClass ( EncodingEditor.class );
68
69             properties[PROPERTY_version] = new PropertyDescriptor ( "version", TreeDocumentFragment.class, "getVersion", "setVersion" ); // NOI18N
70
properties[PROPERTY_version].setDisplayName ( Util.THIS.getString ( "PROP_TreeDocumentFragmentBeanInfo_version" ) );
71             properties[PROPERTY_version].setShortDescription ( Util.THIS.getString ( "HINT_TreeDocumentFragmentBeanInfo_version" ) );
72             properties[PROPERTY_version].setPropertyEditorClass ( VersionEditor.class );
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         EventSetDescriptor[] eventSets = new EventSetDescriptor[1];
88
89         try {
90             eventSets[0] = new EventSetDescriptor ( org.netbeans.tax.TreeDocumentFragment.class, "propertyChangeListener", java.beans.PropertyChangeListener JavaDoc.class, new String JavaDoc[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" ); // NOI18N
91
} catch( IntrospectionException e) {
92             Exceptions.printStackTrace(e);
93         }
94     return eventSets;
95     }
96
97     /**
98      * Gets the bean's <code>MethodDescriptor</code>s.
99      *
100      * @return An array of MethodDescriptors describing the methods
101      * implemented by this bean. May return null if the information
102      * should be obtained by automatic analysis.
103      */

104     public MethodDescriptor[] getMethodDescriptors() {
105     return new MethodDescriptor[0];
106     }
107
108 }
109
Popular Tags