package com.ibm.able.examples.rules;

//====================================================================
//
// Licensed Materials - Property of IBM
//
// "Restricted Materials of IBM"
//
// Product: com.ibm.able.examples.rules
//
// (C) Copyright IBM Corp. 2001 All Rights Reserved.
//
// US Government Users Restricted Rights - Use, duplication or
// disclosure restricted by GSA ADP Schedule Contract with
// IBM Corp.
//
//
//                             DISCLAIMER
//                             ----------
//
// This material contains programming source code for your consideration.
// These examples have not been thoroughly tested under all conditions.
// IBM, therefore, cannot guarantee or imply reliability, serviceability,
// performance or function of these programs.  All programs contained
// herein are provided to you "AS IS".  THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
// DISCLAIMED.
//
//====================================================================

//====================================================================
// Imports
//====================================================================

import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.SimpleBeanInfo;

import com.ibm.able.Able;
import com.ibm.able.editor.AbleEditor;

/**
 * @version  $Revision: 1.4 $, $Date: 2001/09/26 20:31:03 $
 */
public class SampleSensorEffectorBeanInfo extends SimpleBeanInfo {

  /**
   * Serialized version identifier in form       YYYYMMDDVerRelModxx
   */
  static final long serialVersionUID = 2001100500100300000L;

  Class  beanClass = SampleSensorEffector.class;

  String iconColor16x16Filename = "seneff16.gif";
  String iconColor32x32Filename = "seneff32.gif";
  String iconMono16x16Filename;
  String iconMono32x32Filename;
  private final static Class customizerClass = com.ibm.able.examples.rules.SampleSensorEffectorCustomizer.class;


  public SampleSensorEffectorBeanInfo() {
  }


  public BeanDescriptor getBeanDescriptor() {
    //BeanDescriptor returnDescriptor = new BeanDescriptor(beanClass);
    BeanDescriptor returnDescriptor = new BeanDescriptor(beanClass, customizerClass);
    returnDescriptor.setValue("hidden-state", Boolean.TRUE);
    returnDescriptor.setValue("able-category",AbleEditor.CAT_SAMPLES);
    returnDescriptor.setValue("able-slot", String.valueOf(AbleEditor.LEFTCENTER)) ;
    return returnDescriptor;
  }


  public java.awt.Image getIcon(int iconKind) {
    switch (iconKind) {
      case BeanInfo.ICON_COLOR_16x16:
        return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null;
      case BeanInfo.ICON_COLOR_32x32:
        return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null;
      case BeanInfo.ICON_MONO_16x16:
        return iconMono16x16Filename  != null ? loadImage(iconMono16x16Filename)  : null;
      case BeanInfo.ICON_MONO_32x32:
        return iconMono32x32Filename  != null ? loadImage(iconMono32x32Filename)  : null;
    }
    return null;
  }


  public BeanInfo[] getAdditionalBeanInfo() {
    Class superclass = beanClass.getSuperclass();
    try  {
      BeanInfo superBeanInfo = Introspector.getBeanInfo(superclass);
      return new BeanInfo[] { superBeanInfo };
    }
    catch (IntrospectionException ex) {
        Able.MessageLog.text(Able.MSG_WARNING,this,"getAdditionalBeanInfo",ex.getLocalizedMessage());
        if (Able.TraceLog.isLogging()) Able.TraceLog.exception(Able.TRC_LOW,this,"getAdditionalBeanInfo",ex);
      return null;
    }
  }


  /**
   * Determine the copyright of this class.
   *
   * @return    A String containing this class's copyright statement.
   *            <p>
   */
  private static String Copyright() {
    return Able.Copyright;
  }

}
