KickJava   Java API By Example, From Geeks To Geeks.

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


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.TreeDocument;
23 import org.netbeans.modules.xml.tax.beans.customizer.TreeDocumentCustomizer;
24 import org.netbeans.modules.xml.tax.beans.editor.VersionEditor;
25 import org.netbeans.modules.xml.tax.beans.editor.StandaloneEditor;
26 import org.netbeans.modules.xml.tax.beans.editor.EncodingEditor;
27 import org.openide.util.Exceptions;
28
29 /**
30  *
31  * @author Libor Kramolis
32  * @version 0.1
33  */

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

59     public PropertyDescriptor[] getPropertyDescriptors() {
60         int PROPERTY_encoding = 0;
61         int PROPERTY_version = 1;
62         int PROPERTY_standalone = 2;
63         PropertyDescriptor[] properties = new PropertyDescriptor[3];
64
65         try {
66             properties[PROPERTY_encoding] = new PropertyDescriptor ( "encoding", TreeDocument.class, "getEncoding", "setEncoding" ); // NOI18N
67
properties[PROPERTY_encoding].setDisplayName ( Util.THIS.getString ( "PROP_TreeDocumentBeanInfo_encoding" ) );
68             properties[PROPERTY_encoding].setShortDescription ( Util.THIS.getString ( "HINT_TreeDocumentBeanInfo_encoding" ) );
69             properties[PROPERTY_encoding].setPropertyEditorClass ( EncodingEditor.class );
70
71             properties[PROPERTY_version] = new PropertyDescriptor ( "version", TreeDocument.class, "getVersion", "setVersion" ); // NOI18N
72
properties[PROPERTY_version].setDisplayName ( Util.THIS.getString ( "PROP_TreeDocumentBeanInfo_version" ) );
73             properties[PROPERTY_version].setShortDescription ( Util.THIS.getString ( "HINT_TreeDocumentBeanInfo_version" ) );
74             properties[PROPERTY_version].setPropertyEditorClass ( VersionEditor.class );
75
76             properties[PROPERTY_standalone] = new PropertyDescriptor ( "standalone", TreeDocument.class, "getStandalone", "setStandalone" ); // NOI18N
77
properties[PROPERTY_standalone].setDisplayName ( Util.THIS.getString ( "PROP_TreeDocumentBeanInfo_standalone" ) );
78             properties[PROPERTY_standalone].setShortDescription ( Util.THIS.getString ( "HINT_TreeDocumentBeanInfo_standalone" ) );
79             properties[PROPERTY_standalone].setPropertyEditorClass ( StandaloneEditor.class );
80         } catch( IntrospectionException e) {
81             Exceptions.printStackTrace(e);
82         }
83         return properties;
84     }
85
86     /**
87      * Gets the bean's <code>EventSetDescriptor</code>s.
88      *
89      * @return An array of EventSetDescriptors describing the kinds of
90      * events fired by this bean. May return null if the information
91      * should be obtained by automatic analysis.
92      */

93     public EventSetDescriptor[] getEventSetDescriptors() {
94         EventSetDescriptor[] eventSets = new EventSetDescriptor[1];
95
96         try {
97             eventSets[0] = new EventSetDescriptor ( org.netbeans.tax.TreeDocument.class, "propertyChangeListener", java.beans.PropertyChangeListener JavaDoc.class, new String JavaDoc[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" ); // NOI18N
98
} catch( IntrospectionException e) {
99             Exceptions.printStackTrace(e);
100         }
101     return eventSets;
102     }
103
104     /**
105      * Gets the bean's <code>MethodDescriptor</code>s.
106      *
107      * @return An array of MethodDescriptors describing the methods
108      * implemented by this bean. May return null if the information
109      * should be obtained by automatic analysis.
110      */

111     public MethodDescriptor[] getMethodDescriptors() {
112     return new MethodDescriptor[0];
113     }
114
115 }
116
Popular Tags