   /*
    * @(#) MultiImageLoaderBeanInfo.java 1.0 96/21/12
    * Copyright (c) 1996 Lawrence Rodrigues
    */

  package com.vistech.imageloader;

  import java.io.*;
  import java.awt.*;
  import java.awt.event.*;

  import java.util.*;
  import java.beans.*;
  import com.vistech.events.*;
  import java.lang.reflect.*;

  /** MultiImageLoaderBeanInfo Class
    * @version 1.0  21 Jan 1997
    * @author Lawrence Rodrigues
    **/

  public class MultiImageLoaderBeanInfo extends SimpleBeanInfo {
     protected Class loaderClass = null;
     public MultiImageLoaderBeanInfo(){
        loaderClass =  com.vistech.imageloader.MultiImageLoader.class;
     }

     public Image getIcon(int iconType){
         return loadImage("imageloader.gif");
     }

     /**
       * Constructs method descriptors for all the public methods in the
       * Loader class.
       * @return an array of Method descriptors. 
       */
     public MethodDescriptor[] getMethodDescriptors(){
        Method loaderMtds[] = MultiImageLoader.class.getDeclaredMethods();
        if(loaderMtds == null) System.out.println("null methods");
        MethodDescriptor mgPd[] = new MethodDescriptor[loaderMtds.length];
        for(int i= 0;i<loaderMtds.length;i++){
            mgPd[i] = new MethodDescriptor(loaderMtds[i]);
        }
        return mgPd;
     }

     public BeanDescriptor getBeanDescriptor(){
        BeanDescriptor bd = new BeanDescriptor(loaderClass);
        bd.setDisplayName("Image Loader");
        return bd;
     }

     /**
       * Constructs event set descriptor image loaded event.
       * @return an array of event set descriptors. 
       */
     public EventSetDescriptor[] getEventSetDescriptors(){
        try{
           EventSetDescriptor imgLoadPd = new EventSetDescriptor(loaderClass,
                                              "imageLoad",
                                              ImageLoadedListener.class,
                                              "imageLoaded");
           return new EventSetDescriptor[] {imgLoadPd};
        } catch(IntrospectionException e){
             e.printStackTrace();
             return null;
        }
      }
    }

