/*
 * @(#) PlotViewportBeanInfo.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.*;
  public class PlotViewportBeanInfo extends SimpleBeanInfo {
     protected Class plotVpClass = null;
     public PlotViewportBeanInfo(){
        plotVpClass = PlotViewport.class;
     }
     public MethodDescriptor[] getMethodDescriptors(){
        try{
           Class args[] = {Object.class, Object.class};
           Method drawpt = plotVpClass.getMethod("drawPlot",args);
           MethodDescriptor drawptMd = new MethodDescriptor(drawpt);

           args = new Class[] {java.lang.String.class};
           Method settit = plotVpClass.getMethod("setTitleString",args);
           MethodDescriptor settitMd = new MethodDescriptor(settit);

           MethodDescriptor[] drawmd = {drawptMd,settitMd};
           return drawmd;
        }catch (Exception e){
           e.printStackTrace();
        }
        return null;
     }

     public PropertyDescriptor[] getPropertyDescriptors(){
       
        try{
           //Colors
           PropertyDescriptor bkPd = new PropertyDescriptor("background", 
							     plotVpClass);
           bkPd.setDisplayName("Background color");
           PropertyDescriptor fgPd = new PropertyDescriptor("foreground",
							     plotVpClass);
           fgPd.setDisplayName("Foreground color");
           PropertyDescriptor grcolPd = new PropertyDescriptor("graphColor", 
								plotVpClass);
           grcolPd.setDisplayName("Graph color");
           PropertyDescriptor titlePd = new PropertyDescriptor("titleString", 
								plotVpClass);
           titlePd.setDisplayName("Plot title");
           //Labels and ticks
           PropertyDescriptor xlabPd = new PropertyDescriptor("xLabelString", 
							       plotVpClass);
           xlabPd.setDisplayName("X label");
           PropertyDescriptor ylabPd = new PropertyDescriptor("yLabelString",
							       plotVpClass);
           ylabPd.setDisplayName("Y label");
           PropertyDescriptor ytickPd = new PropertyDescriptor("numYTicks",
								plotVpClass);
           ytickPd.setDisplayName("Number of Y ticks");
           PropertyDescriptor xtickPd = new PropertyDescriptor("numXTicks",
								plotVpClass);
           xtickPd.setDisplayName("Number of X ticks");
           PropertyDescriptor ylabtPd = new PropertyDescriptor("yLabelsPerTick",
 								plotVpClass);
           ylabtPd.setDisplayName("Number of Y ticks between labels");
           ylabtPd.setShortDescription("Number of Y ticks per Y label");
           PropertyDescriptor xlabtPd = new PropertyDescriptor("xLabelsPerTick",
								 plotVpClass);
           xlabtPd.setDisplayName("Number of X ticks between labels");
           ylabtPd.setShortDescription("Number of X ticks per X label");
           PropertyDescriptor maxgrPd = new PropertyDescriptor("maxGraphs",
								plotVpClass);
           maxgrPd.setDisplayName("Maximum number of graphs");
           IndexedPropertyDescriptor bdPd = new 
					    IndexedPropertyDescriptor("borderULHC",
								       plotVpClass);
           bdPd.setPropertyEditorClass(vis.beans.editors.ArrayEditor.class);
           bdPd.setDisplayName("Border ULHC");
           //Legend related properties
           IndexedPropertyDescriptor legposPd = new 
						IndexedPropertyDescriptor("legendPos",
									   plotVpClass);
           legposPd.setDisplayName("Legend position");
           legposPd.setPropertyEditorClass(vis.beans.editors.ArrayEditor.class);

           PropertyDescriptor legxPd = new PropertyDescriptor("legendPosXIncr",
 							       plotVpClass);
           legxPd.setDisplayName("Legend position X increment");

           PropertyDescriptor legyPd = new PropertyDescriptor("legendPosYIncr",
							       plotVpClass);
           legyPd.setDisplayName("Legend position Y increment");
           PropertyDescriptor leggapPd = new PropertyDescriptor("legendGapIncr",
								 plotVpClass);
           leggapPd.setDisplayName("Legend gap increment");
           PropertyDescriptor legonPd = new PropertyDescriptor("legendOn",
 								plotVpClass);
          
           legonPd.setDisplayName("Legend on");
           PropertyDescriptor fontPd = new PropertyDescriptor("font",
							       plotVpClass);
           PropertyDescriptor grtPd = new PropertyDescriptor("graphTitle", 
								plotVpClass);
           grtPd.setDisplayName("Graph title");
     

           PropertyDescriptor pd[] = {bkPd,fgPd,
                                      titlePd,
                                      xlabPd,ylabPd,
                                      ytickPd,xtickPd,
                                      xlabtPd, ylabtPd,
                                      bdPd,
                                      grcolPd,
                                      maxgrPd,
                                      fontPd,
				      legposPd,
                                      legxPd, legyPd,
                                      leggapPd,
                                      legonPd,
                                      grtPd};
            return pd;

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

  }


