Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   *
   * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
   *
   * The contents of this file are subject to the terms of either the GNU
   * General Public License Version 2 only ("GPL") or the Common
   * Development and Distribution License("CDDL") (collectively, the
   * "License"). You may not use this file except in compliance with the
  * License. You can obtain a copy of the License at
  * http://www.netbeans.org/cddl-gplv2.html
  * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  * specific language governing permissions and limitations under the
  * License.  When distributing the software, include this License Header
  * Notice in each file and include the License file at
  * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Sun in the GPL Version 2 section of the License file that
  * accompanied this code. If applicable, add the following below the
  * License Header, with the fields enclosed by brackets [] replaced by
  * your own identifying information:
  * "Portions Copyrighted [year] [name of copyright owner]"
  *
  * Contributor(s):
  *
  * The Original Software is NetBeans. The Initial Developer of the Original
  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  * Microsystems, Inc. All Rights Reserved.
  *
  * If you wish your version of this file to be governed by only the CDDL
  * or only the GPL Version 2, indicate your decision by adding
  * "[Contributor] elects to include this software in this distribution
  * under the [CDDL or GPL Version 2] license." If you do not indicate a
  * single choice of license, a recipient has the option to distribute
  * your version of this file under either the CDDL, the GPL Version 2 or
  * to extend the choice of license to its licensees as provided above.
  * However, if you add GPL Version 2 code and therefore, elected the GPL
  * Version 2 license, then the option applies only if the new code is
  * made subject to such option by the copyright holder.
  */
 package org.netbeans.modules.j2ee.sun.ide.sunresources.beans;
 
 import java.beans.*;
 
 public class DataSourceBeanBeanInfo extends SimpleBeanInfo {
 
     static private String getLabel(String key){
         return NbBundle.getMessage(DataSourceBean.class,key);
     }

    
Gets the bean's BeanDescriptors.

Returns:
BeanDescriptor describing the editable properties of this bean. May return null if the information should be obtained by automatic analysis.
 
     public BeanDescriptor getBeanDescriptor() {
         BeanDescriptor beanDescriptor = new BeanDescriptor  ( DataSourceBean.class , null );                              
         return beanDescriptor;
     }
    
    
Gets the bean's PropertyDescriptors.

Returns:
An array of PropertyDescriptors describing the editable properties supported by this bean. May return null if the information should be obtained by automatic analysis.

If a property is indexed, then its entry in the result array will belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client of getPropertyDescriptors can use "instanceof" to check if a given PropertyDescriptor is an IndexedPropertyDescriptor.

 
         int PROPERTY_connPoolName = 0;
         int PROPERTY_description = 1;
         int PROPERTY_isEnabled = 2;
         int PROPERTY_jndiName = 3;
         int PROPERTY_name = 4;
         int PROPERTY_resType = 5;
         PropertyDescriptor[] properties = new PropertyDescriptor[6];
     
         try {
             properties[PROPERTY_connPoolName] = new PropertyDescriptor ( "connPoolName"DataSourceBean.class"getConnPoolName""setConnPoolName" );
             properties[PROPERTY_connPoolName].setDisplayName ( getLabel("LBL_PoolName") );
             properties[PROPERTY_connPoolName].setShortDescription ( getLabel("DSC_PoolName") );
             properties[PROPERTY_description] = new PropertyDescriptor ( "description"DataSourceBean.class"getDescription""setDescription" );
             properties[PROPERTY_description].setDisplayName ( getLabel("LBL_Description") );
             properties[PROPERTY_description].setShortDescription ( getLabel("DSC_Description") );
             properties[PROPERTY_isEnabled] = new PropertyDescriptor ( "isEnabled"DataSourceBean.class"getIsEnabled""setIsEnabled" );
             properties[PROPERTY_isEnabled].setDisplayName ( getLabel("LBL_Enabled") );
             properties[PROPERTY_isEnabled].setShortDescription ( getLabel("DSC_Enabled") );
             properties[PROPERTY_isEnabled].setPropertyEditorClass ( BooleanEditor.class );
             properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName"DataSourceBean.class"getJndiName""setJndiName" );
             properties[PROPERTY_jndiName].setDisplayName ( getLabel("LBL_JndiName") );
            properties[PROPERTY_jndiName].setShortDescription ( getLabel("DSC_JndiName") );
            properties[PROPERTY_name] = new PropertyDescriptor ( "name"DataSourceBean.class"getName""setName" );
            properties[PROPERTY_name].setHidden ( true );
            properties[PROPERTY_resType] = new PropertyDescriptor ( "resType"DataSourceBean.class"getResType""setResType" );
            properties[PROPERTY_resType].setDisplayName ( getLabel("LBL_DSResType") );
            properties[PROPERTY_resType].setShortDescription ( getLabel("DSC_DSResType") );
        }
        catchIntrospectionException e) {
            Exceptions.printStackTrace(e);
        }
        return properties;
    }
    
    
Gets the bean's EventSetDescriptors.

Returns:
An array of EventSetDescriptors describing the kinds of events fired by this bean. May return null if the information should be obtained by automatic analysis.
        int EVENT_propertyChangeListener = 0;
        EventSetDescriptor[] eventSets = new EventSetDescriptor[1];
    
        try {
        eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( org.netbeans.modules.j2ee.sun.ide.sunresources.beans.DataSourceBean.class"propertyChangeListener"java.beans.PropertyChangeListener.classnew String[] {"propertyChange"}, "addPropertyChangeListener""removePropertyChangeListener" );
        }
        catchIntrospectionException e) {
            Exceptions.printStackTrace(e);
        }
        return eventSets;
    }
    
    
Gets the bean's MethodDescriptors.

Returns:
An array of MethodDescriptors describing the methods implemented by this bean. May return null if the information should be obtained by automatic analysis.
        return new MethodDescriptor[0];
    }
    
New to GrepCode? Check out our FAQ X