/*
 * ShowTextCustomBeanInfo.java    1.0 97/08/28
 *
 * Copyright (c) 1997 Netscape Communications Corporation
 *
 * Netscape grants you a non-exclusive, royalty free, license to use,
 * modify and redistribute this software in source and binary code form,
 * provided that i) this copyright notice and license appear on all copies of
 * the software; and ii) Licensee does not utilize the software in a manner
 * which is disparaging to Netscape.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 * See the CDK License Agreement for additional terms and conditions.
 */

import java.beans.SimpleBeanInfo;
import java.beans.BeanDescriptor;
import java.beans.EventSetDescriptor;
import java.beans.MethodDescriptor;
import java.beans.PropertyDescriptor;
import java.beans.ParameterDescriptor;
import java.beans.BeanInfo;

public class ShowTextCustomBeanInfo extends SimpleBeanInfo {
    private final static Class customizerClass = ShowTextCustomizer.class;
    private final static Class beanClass = ShowTextCustom.class;

    public ShowTextCustomBeanInfo() throws Exception {

        // Publish methods -------------------------------------------------

        _methodDescriptor = new MethodDescriptor[0];

        // Publish properties ----------------------------------------------
        _propertyDescriptor = new PropertyDescriptor[1];

        _propertyDescriptor[0] = new PropertyDescriptor("message",
                                  Class.forName("ShowTextCustom"));

        // Publish events --------------------------------------------------
        _eventSetDescriptor = new EventSetDescriptor[0];

    }

    public BeanDescriptor getBeanDescriptor() {
        try {
            // We'd return this if we didn't have a customizer
            //return new BeanDescriptor(Class.forName("ShowTextCustom"));

            ///////////////////////////////////////////////////////////
            //
            // Here is where we return the reference to our Custom
            // Property Editor for this bean!
            //
            return new BeanDescriptor(beanClass, customizerClass);
        } catch (Exception e) {
            return null;
        }
    }

    public EventSetDescriptor[] getEventSetDescriptors() {
        return _eventSetDescriptor;
    }

    public MethodDescriptor[] getMethodDescriptors() {
        return _methodDescriptor;
    }

    public PropertyDescriptor[] getPropertyDescriptors() {
        return _propertyDescriptor;
    }

    public BeanInfo[] getAdditionalBeanInfo() {
        return null;
    }

    public int getDefaultEventIndex() {
        return -1;
    }

    public int getDefaultPropertyIndex() {
        return -1;
    }

    private EventSetDescriptor[] _eventSetDescriptor;
    private MethodDescriptor[]   _methodDescriptor;
    private PropertyDescriptor[] _propertyDescriptor;
}
