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.netbeans.modules.httpserver;

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

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

/** BeanInfo for http - custom editor for hosts property
*
* @author Ales Novak, Petr Jiricka
*/
public class HttpServerSettingsBeanInfo extends SimpleBeanInfo {

    /** @return the ExternalCompilerSettings' icon */
    public Image getIcon(int type) {
        if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || (type == java.beans.BeanInfo.ICON_MONO_16x16)) {
	    return Utilities.loadImage("org/netbeans/modules/httpserver/httpServerSettings.gif"); // NOI18N
        } else {
    	    return Utilities.loadImage ("org/netbeans/modules/httpserver/httpServerSettings32.gif"); // NOI18N
        }
    }

    /** Descriptor of valid properties
    * @return array of properties
    */
    public PropertyDescriptor[] getPropertyDescriptors () {
        try {
            PropertyDescriptor[] desc = new PropertyDescriptor[] {
                       new PropertyDescriptor("host", HttpServerSettings.class, null, "setHost"), // 0 // NOI18N
                       new PropertyDescriptor("grantedAddresses", HttpServerSettings.class, null, "setGrantedAddresses"), // 1 // NOI18N
                       new PropertyDescriptor("port", HttpServerSettings.class), // 2 // NOI18N
                       new PropertyDescriptor("running", HttpServerSettings.class, "isRunning", null), // 6 // NOI18N
                       new PropertyDescriptor("hostProperty", HttpServerSettings.class), // 7 // NOI18N
                       new PropertyDescriptor("showGrantAccess", HttpServerSettings.class, "isShowGrantAccessDialog", "setShowGrantAccessDialog") // 8 // NOI18N
                   };
	    ResourceBundle bundle = NbBundle.getBundle(HttpServerSettingsBeanInfo.class);

            // host and grantedAddresses are write-olny props for deserialization of old settings (release32)
            desc[0].setHidden (true);
            desc[1].setHidden (true);
            desc[2].setDisplayName(bundle.getString("PROP_Port"));
            desc[2].setShortDescription(bundle.getString("HINT_Port"));
            desc[3].setDisplayName(bundle.getString("PROP_Running"));
            desc[3].setShortDescription(bundle.getString("HINT_Running"));
            desc[4].setDisplayName(bundle.getString("PROP_HostProperty"));
            desc[4].setShortDescription(bundle.getString("HINT_HostProperty"));
            desc[4].setPropertyEditorClass (HostPropertyEditor.class);
            desc[5].setDisplayName(bundle.getString("PROP_showGrantAccess"));
            desc[5].setShortDescription(bundle.getString("HINT_showGrantAccess"));
	    return desc;
        } catch (IntrospectionException ex) {
	    ErrorManager.getDefault().notify(ex);
	    return null;
        }
    }

    public BeanDescriptor getBeanDescriptor(){
        BeanDescriptor bd = new BeanDescriptor(HttpServerSettings.class);
        bd.setShortDescription(NbBundle.getMessage(HttpServerSettingsBeanInfo.class, "CTL_HTTP_sett_HINT"));
        return bd;
    }


}
... 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.