alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */


package org.netbeans.modules.search.types;


import java.awt.Image;
import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.EventSetDescriptor;
import java.beans.Introspector;
import java.beans.IntrospectionException;
import java.beans.PropertyChangeListener;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
import org.openide.ErrorManager;

import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openidex.search.SearchType;


/** Bean info for ObjectNameType search type.
 *
 * @author  Petr Kuzel
 */
public class ObjectNameTypeBeanInfo extends SimpleBeanInfo {


    /** Gets property descriptors. Overrides superclass method. */
    public PropertyDescriptor[] getPropertyDescriptors() {
        try {
            PropertyDescriptor p1 = new PropertyDescriptor(
                    "matchString",                                      //NOI18N
                    ObjectNameType.class,
                    "getMatchString",                                   //NOI18N
                    "setMatchString" );                                 //NOI18N
            p1.setDisplayName(NbBundle.getBundle(ObjectNameType.class)
                              .getString("TEXT_PROP_SUBSTRING"));       //NOI18N
            
            PropertyDescriptor p2 = new PropertyDescriptor(
                    "re",                                               //NOI18N
                    ObjectNameType.class,
                    "getRe",                                            //NOI18N
                    "setRe");                                           //NOI18N
            p2.setDisplayName(NbBundle.getBundle(ObjectNameType.class)
                              .getString("TEXT_PROP_RE"));              //NOI18N
            
            return new PropertyDescriptor[] {p1, p2};
        } catch( IntrospectionException ie) {
            ErrorManager.getDefault().notify(ie);
            
            return null;
        }
    }

    /** Get event set descriptors. Overrides superclass method. */
    public EventSetDescriptor[] getEventSetDescriptors() {
        try {
            return new EventSetDescriptor[] {
                new EventSetDescriptor(
                    ObjectNameType.class,
                    "propertyChangeListener", // NOI18N
                    PropertyChangeListener.class,
                    new String[0],
                    "addPropertyChangeListener", // NOI18N
                    "removePropertyChangeListener") // NOI18N
            };
        } catch( IntrospectionException ie) {
            ErrorManager.getDefault().notify(ie);
            
            return null;
        }
    }

    /** Gets icon. Overrides superclass method. */
    public Image getIcon(int type) {
        if(type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) {
            return Utilities.loadImage(
                    "org/netbeans/modules/search/res/find.gif");        //NOI18N
        } else {
            return null;
        }
    }

    /** Gets bean descriptor. Overrides superclass method. */
    public BeanDescriptor getBeanDescriptor(){
        BeanDescriptor descr = new BeanDescriptor(ObjectNameType.class,
                                                  ObjectNameCustomizer.class);
        descr.setDisplayName(NbBundle.getBundle(ObjectNameType.class)
                             .getString("TEXT_OBJECTNAME_CRITERION"));  //NOI18N
        
        return descr;
    }

    /** Gets additional beaninfos. Overides superclass method. */
    public BeanInfo[] getAdditionalBeanInfo () {
        try {
            return new BeanInfo[] { Introspector.getBeanInfo(SearchType.class) };
        } catch (IntrospectionException ie) {
            ErrorManager.getDefault().notify(ie);
            
            return null;
        }
    }

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.