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: * WebServiceDescriptorBeanInfo.java
043: *
044: * Created on October 5, 2005, 4:28 PM
045: */
046:
047: package org.netbeans.modules.j2ee.sun.share.configbean;
048:
049: import java.beans.*;
050: import org.openide.util.Exceptions;
051:
052: /**
053: * @author Peter Williams
054: */
055: public class WebServiceDescriptorBeanInfo extends SimpleBeanInfo {
056:
057: /** Return an appropriate icon (currently, only 16x16 color is available)
058: */
059: public java.awt.Image getIcon(int iconKind) {
060: return loadImage("resources/WebServiceDescriptorIcon16.png"); // NOI18N
061: }
062:
063: /**
064: * Gets the bean's <code>BeanDescriptor</code>s.
065: *
066: * @return BeanDescriptor describing the editable
067: * properties of this bean. May return null if the
068: * information should be obtained by automatic analysis.
069: */
070: public BeanDescriptor getBeanDescriptor() {
071: BeanDescriptor beanDescriptor = new BeanDescriptor(
072: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class,
073: org.netbeans.modules.j2ee.sun.share.configbean.customizers.webservice.WebServiceDescriptorCustomizer.class);
074: beanDescriptor
075: .setDisplayName("WebServiceDescriptorDisplayName");
076: beanDescriptor
077: .setShortDescription("WebServiceDescriptorShortDescription");//GEN-HEADEREND:BeanDescriptor
078: return beanDescriptor;
079: }
080:
081: /**
082: * Gets the bean's <code>PropertyDescriptor</code>s.
083: *
084: * @return An array of PropertyDescriptors describing the editable
085: * properties supported by this bean. May return null if the
086: * information should be obtained by automatic analysis.
087: * <p>
088: * If a property is indexed, then its entry in the result array will
089: * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
090: * A client of getPropertyDescriptors can use "instanceof" to check
091: * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
092: */
093: public PropertyDescriptor[] getPropertyDescriptors() {
094: int PROPERTY_displayName = 0;
095: int PROPERTY_helpId = 1;
096: int PROPERTY_identity = 2;
097: int PROPERTY_webServiceDescriptionName = 3;
098: int PROPERTY_webServiceEndpoint = 4;
099: int PROPERTY_webServiceEndpoints = 5;
100: int PROPERTY_wsdlPublishLocation = 6;
101: PropertyDescriptor[] properties = new PropertyDescriptor[7];
102:
103: try {
104: properties[PROPERTY_displayName] = new PropertyDescriptor(
105: "displayName",
106: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class,
107: "getDisplayName", null);
108: properties[PROPERTY_helpId] = new PropertyDescriptor(
109: "helpId",
110: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class,
111: "getHelpId", null);
112: properties[PROPERTY_identity] = new PropertyDescriptor(
113: "identity",
114: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class,
115: "getIdentity", "setIdentity");
116: properties[PROPERTY_webServiceDescriptionName] = new PropertyDescriptor(
117: "webServiceDescriptionName",
118: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class,
119: "getWebServiceDescriptionName", null);
120: properties[PROPERTY_webServiceEndpoint] = new IndexedPropertyDescriptor(
121: "webServiceEndpoint",
122: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class,
123: null, null, "getWebServiceEndpoint", null);
124: properties[PROPERTY_webServiceEndpoints] = new PropertyDescriptor(
125: "webServiceEndpoints",
126: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class,
127: "getWebServiceEndpoints", "setWebServiceEndpoints");
128: properties[PROPERTY_wsdlPublishLocation] = new PropertyDescriptor(
129: "wsdlPublishLocation",
130: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class,
131: "getWsdlPublishLocation", "setWsdlPublishLocation");
132: } catch (IntrospectionException e) {
133: Exceptions.printStackTrace(e);
134: }
135:
136: return properties;
137: }
138:
139: /**
140: * Gets the bean's <code>EventSetDescriptor</code>s.
141: *
142: * @return An array of EventSetDescriptors describing the kinds of
143: * events fired by this bean. May return null if the information
144: * should be obtained by automatic analysis.
145: */
146: public EventSetDescriptor[] getEventSetDescriptors() {
147: return new EventSetDescriptor[0];
148: }
149:
150: /**
151: * Gets the bean's <code>MethodDescriptor</code>s.
152: *
153: * @return An array of MethodDescriptors describing the methods
154: * implemented by this bean. May return null if the information
155: * should be obtained by automatic analysis.
156: */
157: public MethodDescriptor[] getMethodDescriptors() {
158: int METHOD_addWebServiceEndpoint0 = 0;
159: int METHOD_removeWebServiceEndpoint1 = 1;
160: int METHOD_setDirty2 = 2;
161: MethodDescriptor[] methods = new MethodDescriptor[3];
162:
163: try {
164: methods[METHOD_addWebServiceEndpoint0] = new MethodDescriptor(
165: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class
166: .getMethod(
167: "addWebServiceEndpoint",
168: new Class[] { org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceEndpoint.class }));
169: methods[METHOD_addWebServiceEndpoint0].setDisplayName("");
170: methods[METHOD_removeWebServiceEndpoint1] = new MethodDescriptor(
171: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class
172: .getMethod(
173: "removeWebServiceEndpoint",
174: new Class[] { org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceEndpoint.class }));
175: methods[METHOD_removeWebServiceEndpoint1]
176: .setDisplayName("");
177: methods[METHOD_setDirty2] = new MethodDescriptor(
178: org.netbeans.modules.j2ee.sun.share.configbean.WebServiceDescriptor.class
179: .getMethod("setDirty", new Class[] {}));
180: methods[METHOD_setDirty2].setDisplayName("");
181: } catch (Exception e) {
182: Exceptions.printStackTrace(e);
183: }
184: return methods;
185: }
186: }
|