/*
 * @(#) XYPlotInfo.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.*;
  public class MultiXYPlotBeanInfo extends SimpleBeanInfo {
     protected Class xyPlotClass = null;
     public MultiXYPlotBeanInfo(){
        xyPlotClass = MultiXYPlot.class;
     }
     public Image getIcon(int iconType){
         return loadImage("xyplot.gif");
     }

     public MethodDescriptor[] getMethodDescriptors(){
        try{
           Class args[] = {PlotEvent.class};
           Method xypt = xyPlotClass.getMethod("plotXYGraph",args);
           MethodDescriptor xyptMd = new MethodDescriptor(xypt);
           MethodDescriptor[] md = {xyptMd};
           return md;
        } catch (Exception e){
           e.printStackTrace();
        }
        return null;
     }

     public BeanDescriptor getBeanDescriptor(){
        BeanDescriptor bd = new BeanDescriptor(xyPlotClass, MultiXYPlotCustomizer.class);
        bd.setDisplayName("Multi XY Plot");
        registerEditor();
        return bd;
     }
     /**
       * Registering property editors.
       */
     private void registerEditor(){
        PropertyEditorManager.registerEditor(vis.util.Enum.class, vis.beans.editors.EnumEditor.class);
     }

  
     public PropertyDescriptor[] getPropertyDescriptors(){
        try{
           PropertyDescriptor smxtickPd = new PropertyDescriptor("numSmallXTicks", xyPlotClass);
           smxtickPd.setDisplayName("Number of small x ticks/tick");
           PropertyDescriptor smytickPd = new PropertyDescriptor("numSmallYTicks", xyPlotClass);
           smxtickPd.setDisplayName("Number of small y ticks/tick");
           PropertyDescriptor dmodePd = new PropertyDescriptor("dataMode", xyPlotClass);
           dmodePd.setDisplayName("Data mode");

           PropertyDescriptor xmmPd = new PropertyDescriptor("xMinmax", xyPlotClass);
           xmmPd.setDisplayName("X min and max value");

           PropertyDescriptor ymmPd = new PropertyDescriptor("yMinmax", xyPlotClass);
           ymmPd.setDisplayName("Y min and max value");

           try{
             Class insed = Class.forName("vis.beans.editors.IndexedIntEditor");
             xmmPd.setPropertyEditorClass(insed);
             ymmPd.setPropertyEditorClass(insed);
            } catch(Exception e){System.out.println(" String edit class not found"); }
           PropertyDescriptor pd[] = {smxtickPd,
                                      smytickPd,
                                      dmodePd,
                                      xmmPd,ymmPd,
                                      };

           return pd;

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

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


  }


