001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.j2ee.sun.share.configbean;
043:
044: import java.beans.*;
045: import org.openide.util.Exceptions;
046:
047: /**
048: * @author Peter Williams
049: */
050: public class MessageDestinationRefBeanInfo extends SimpleBeanInfo {
051:
052: /** Return an appropriate icon (currently, only 16x16 color is available)
053: */
054: public java.awt.Image getIcon(int iconKind) {
055: return loadImage("resources/MessageDestinationRefIcon16.gif"); // NOI18N
056: }
057:
058: /**
059: * Gets the bean's <code>BeanDescriptor</code>s.
060: *
061: * @return BeanDescriptor describing the editable
062: * properties of this bean. May return null if the
063: * information should be obtained by automatic analysis.
064: */
065: public BeanDescriptor getBeanDescriptor() {
066: BeanDescriptor beanDescriptor = new BeanDescriptor(
067: org.netbeans.modules.j2ee.sun.share.configbean.MessageDestinationRef.class,
068: org.netbeans.modules.j2ee.sun.share.configbean.customizers.MessageDestinationRefCustomizer.class); // NOI18N//GEN-HEADEREND:BeanDescriptor
069: return beanDescriptor;
070: }
071:
072: /**
073: * Gets the bean's <code>PropertyDescriptor</code>s.
074: *
075: * @return An array of PropertyDescriptors describing the editable
076: * properties supported by this bean. May return null if the
077: * information should be obtained by automatic analysis.
078: * <p>
079: * If a property is indexed, then its entry in the result array will
080: * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
081: * A client of getPropertyDescriptors can use "instanceof" to check
082: * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
083: */
084: public PropertyDescriptor[] getPropertyDescriptors() {
085: int PROPERTY_identity = 0;
086: int PROPERTY_jndiName = 1;
087: int PROPERTY_messageDestinationRefName = 2;
088: PropertyDescriptor[] properties = new PropertyDescriptor[3];
089:
090: try {
091: properties[PROPERTY_identity] = new PropertyDescriptor(
092: "identity",
093: org.netbeans.modules.j2ee.sun.share.configbean.MessageDestinationRef.class,
094: "getIdentity", "setIdentity"); // NOI18N
095: properties[PROPERTY_jndiName] = new PropertyDescriptor(
096: "jndiName",
097: org.netbeans.modules.j2ee.sun.share.configbean.MessageDestinationRef.class,
098: "getJndiName", "setJndiName"); // NOI18N
099: properties[PROPERTY_messageDestinationRefName] = new PropertyDescriptor(
100: "messageDestinationRefName",
101: org.netbeans.modules.j2ee.sun.share.configbean.MessageDestinationRef.class,
102: "getMessageDestinationRefName", null); // NOI18N
103: } catch (IntrospectionException e) {
104: Exceptions.printStackTrace(e);
105: }
106: return properties;
107: }
108:
109: /**
110: * Gets the bean's <code>EventSetDescriptor</code>s.
111: *
112: * @return An array of EventSetDescriptors describing the kinds of
113: * events fired by this bean. May return null if the information
114: * should be obtained by automatic analysis.
115: */
116: public EventSetDescriptor[] getEventSetDescriptors() {
117: int EVENT_propertyChangeListener = 0;
118: int EVENT_vetoableChangeListener = 1;
119: EventSetDescriptor[] eventSets = new EventSetDescriptor[2];
120:
121: try {
122: eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor(
123: org.netbeans.modules.j2ee.sun.share.configbean.MessageDestinationRef.class,
124: "propertyChangeListener",
125: java.beans.PropertyChangeListener.class,
126: new String[] { "propertyChange" },
127: "addPropertyChangeListener",
128: "removePropertyChangeListener"); // NOI18N
129: eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor(
130: org.netbeans.modules.j2ee.sun.share.configbean.MessageDestinationRef.class,
131: "vetoableChangeListener",
132: java.beans.VetoableChangeListener.class,
133: new String[] { "vetoableChange" },
134: "addVetoableChangeListener",
135: "removeVetoableChangeListener"); // NOI18N
136: } catch (IntrospectionException e) {
137: Exceptions.printStackTrace(e);
138: }
139: return eventSets;
140: }
141:
142: /**
143: * Gets the bean's <code>MethodDescriptor</code>s.
144: *
145: * @return An array of MethodDescriptors describing the methods
146: * implemented by this bean. May return null if the information
147: * should be obtained by automatic analysis.
148: */
149: public MethodDescriptor[] getMethodDescriptors() {
150: return new MethodDescriptor[0];
151: }
152: }
|