/*
 * @(#) MultiHistogramBeanInfo.java 1.0 97/1/18
 * Copyright (c) 1997 Larry Rodrigues
 */

  package vis.beans.plotter;
  import java.awt.*;
  import java.beans.*;
  import java.lang.reflect.*;
  import vis.beans.events.*;

  /** HistogramBeanInfo Class
    * @version 1.0  18  July 1997
    * @author Larry Rodrigues
    **/
  public class MultiHistogramBeanInfo extends SimpleBeanInfo {
     protected Class histoClass = null;
     public MultiHistogramBeanInfo(){
        histoClass = MultiHistogram.class;
     }
     public Image getIcon(int iconType){
         return loadImage("histo.gif");
     }

     public BeanDescriptor getBeanDescriptor(){
        BeanDescriptor bd = new BeanDescriptor(histoClass, MultiHistoCustomizer.class);
        bd.setDisplayName("Multi Histogram");
        return bd;
     }

     public BeanInfo[] getAdditionalBeanInfo(){
        BeanInfo  plVp =  new PlotViewportBeanInfo();
        BeanInfo[] bi = {plVp};
        return bi;
     }

     public MethodDescriptor[] getMethodDescriptors(){
        try{
           Class args[] = {PlotEvent.class};
           Method hipt = histoClass.getMethod("plotHistogram",args);
           MethodDescriptor hiptMd = new MethodDescriptor(hipt);
           MethodDescriptor[] md = {hiptMd};
           return md;
        } catch (Exception e){
           System.out.println("MethodDescriptor exception");
         }
        return null;
     }
  
     public PropertyDescriptor[] getPropertyDescriptors(){
        try{
           PropertyDescriptor barsPd = new PropertyDescriptor("numBars", histoClass);
           barsPd.setDisplayName("Number of bars");
           PropertyDescriptor barclPd = new PropertyDescriptor("barColor", histoClass);
           barclPd.setDisplayName("Bar Color");
           PropertyDescriptor legPd = new PropertyDescriptor("legendOn", histoClass);
           legPd.setDisplayName("Legend on");
           PropertyDescriptor pd[] = {barsPd, barclPd, legPd};
           return pd;

        } catch(IntrospectionException e){
              e.printStackTrace();
          }
        return null;
      }
  }


