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-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.openide.src.nodes;

import java.beans.*;
import java.awt.Image;
import java.util.ResourceBundle;

import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.ErrorManager;

/** BeanInfo for source options.
*
* @author Petr Hamernik
*/
public final class SourceOptionsBeanInfo extends SimpleBeanInfo {
    /** Prefix of the icon location. */

    public BeanDescriptor getBeanDescriptor() {
        ResourceBundle bundle = NbBundle.getBundle(SourceOptionsBeanInfo.class);
        BeanDescriptor desc = new BeanDescriptor(SourceOptions.class);
        desc.setDisplayName(bundle.getString("MSG_sourceOptions"));
        /* for Post-FCS desc.setShortDescription(bundle.getString("HINT_sourceOptions")); */
        return desc;
    }

    /*
    * @return Returns an array of PropertyDescriptors
    * describing the editable properties supported by this bean.
    */
    public PropertyDescriptor[] getPropertyDescriptors () {
        try {
    	    ResourceBundle bundle = NbBundle.getBundle(SourceOptionsBeanInfo.class);
            PropertyDescriptor[] descriptors = new PropertyDescriptor[6];
            for (int i = 0; i < 6; i++) {
                descriptors[i] = new PropertyDescriptor(SourceOptions.PROP_NAMES[i], SourceOptions.class);
                descriptors[i].setDisplayName(bundle.getString("PROP_"+SourceOptions.PROP_NAMES[i]));
                descriptors[i].setShortDescription(bundle.getString("HINT_"+SourceOptions.PROP_NAMES[i]));
            }
            //        descriptors[6] = new PropertyDescriptor(SourceOptions.PROP_CATEGORIES_USAGE, SourceOptions.class);
            //        descriptors[6].setDisplayName(bundle.getString("PROP_"+SourceOptions.PROP_CATEGORIES_USAGE));
            //        descriptors[6].setShortDescription(bundle.getString("HINT_"+SourceOptions.PROP_CATEGORIES_USAGE));
    	    return descriptors;
        } catch (IntrospectionException e) {
	    ErrorManager.getDefault().notify(e);
	    return null;
        }
    }

    /* @param type Desired type of the icon
    * @return returns the Java loader's icon
    */
    public Image getIcon(final int type) {
        if ((type == BeanInfo.ICON_COLOR_16x16) || (type == BeanInfo.ICON_MONO_16x16)) {
	    return Utilities.loadImage("org/openide/src/resources/sourceOptions.gif"); // NOI18N
        }
        else {
            return Utilities.loadImage("org/openide/src/resources/sourceOptions32.gif"); // NOI18N
        }
    }
}
... 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.