home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / prosrc.bin / ListBeanInfo.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  3.8 KB  |  139 lines

  1. /*
  2.  * @(#ListBeanInfo.java
  3.  *
  4.  * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
  5.  *
  6.  */
  7.  
  8. package symantec.itools.db.awt;
  9.  
  10. import java.beans.*;
  11. import symantec.itools.beans.*;
  12. import java.util.ResourceBundle;
  13.  
  14.  
  15. /**
  16.  * BeanInfo for the List component.
  17.  *
  18.  */
  19.  
  20. public class ListBeanInfo extends SimpleBeanInfo {
  21.  
  22.  
  23.     /**
  24.      * Constructs a ListBeanInfo object.
  25.      */
  26.     public ListBeanInfo() {
  27.     }
  28.  
  29.     /**
  30.      * Gets BeanInfo for the superclass of this bean.
  31.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  32.      */
  33.     public BeanInfo[] getAdditionalBeanInfo() {
  34.         try {
  35.             java.util.Vector v = new java.util.Vector();
  36.             BeanInfo[] rv;
  37.             BeanInfo b;
  38.             Class c = beanClass.getSuperclass();
  39.  
  40.             while (c.isAssignableFrom(Object.class) != true) {
  41.                 b = Introspector.getBeanInfo(c);
  42.                 v.addElement(b);
  43.                 c = c.getSuperclass();
  44.             }
  45.             rv = new BeanInfo[v.size()];
  46.             v.copyInto(rv);
  47.  
  48.             return rv;
  49.         }
  50.         catch (IntrospectionException e) { throw new Error(e.toString());}
  51.     }
  52.  
  53.     /**
  54.      * Gets the SymantecBeanDescriptor for this bean.
  55.      * @return an object of type SymantecBeanDescriptor
  56.      * @see symantec.itools.beans.SymantecBeanDescriptor
  57.      */
  58.     public BeanDescriptor getBeanDescriptor() {
  59.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  60.         bd.setFolder("dbAWARE");
  61.         bd.setToolbar("dbAWARE");
  62.         // bd.setValue("VPO_Object", new Boolean(true));
  63.  
  64.         return (BeanDescriptor) bd;
  65.     }
  66.  
  67.     /**
  68.      * Gets an image that may be used to visually represent this bean
  69.      * (in the toolbar, on a form, etc).
  70.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  71.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  72.      * @return an image for this bean, always color even if requested monochrome
  73.      * @see BeanInfo#ICON_MONO_16x16
  74.      * @see BeanInfo#ICON_COLOR_16x16
  75.      * @see BeanInfo#ICON_MONO_32x32
  76.      * @see BeanInfo#ICON_COLOR_32x32
  77.      */
  78.     public java.awt.Image getIcon(int iconKind) {
  79.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  80.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  81.             java.awt.Image img = loadImage("ListC16.gif");
  82.             return img;
  83.         }
  84.  
  85.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  86.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  87.             java.awt.Image img = loadImage("ListC32.gif");
  88.             return img;
  89.         }
  90.  
  91.         return null;
  92.     }
  93.  
  94.     /**
  95.      * Gets an empty MethodDescriptor array.
  96.      * @return an empty array
  97.      */
  98.     public MethodDescriptor[] getMethodDescriptors() {
  99.         return new MethodDescriptor[0];
  100.     }
  101.  
  102.     /**
  103.      * Gets an array of descriptions of this bean's properties.
  104.      * @return property descriptions for this bean
  105.      */
  106.     public PropertyDescriptor[] getPropertyDescriptors() {
  107.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.db.resources.PropBundle");
  108.  
  109.         try{
  110.  
  111.         PropertyDescriptor pd1 = new PropertyDescriptor("dataBinding", beanClass);
  112.         pd1.setBound(false);
  113.         pd1.setConstrained(false);
  114.         pd1.setDisplayName(prop.getString("dataBinding"));
  115.         pd1.setPropertyEditorClass(symantec.itools.db.beans.binding.NameEditor.class);
  116.  
  117.         PropertyDescriptor pd4 = new PropertyDescriptor("triggeringEvent", beanClass);
  118.         pd4.setBound(false);
  119.         pd4.setConstrained(false);
  120.         pd4.setDisplayName(prop.getString("triggeringEvent"));
  121.         pd4.setValue("ENUMERATION", "Focus_Event=1, Item_Event=5");
  122.  
  123.         PropertyDescriptor[] rv = {pd1, pd4};
  124.  
  125.         return rv;
  126.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  127.     }
  128.  
  129.     /**
  130.      * Returns the index of the property expected to be changed most often by the designer.
  131.      */
  132.     public int getDefaultPropertyIndex() {
  133.         return 0;    //  the index for our default property is always 0
  134.     }
  135.  
  136.     private final static Class beanClass = List.class;
  137.  
  138. }    //  end of class ListBeanInfo|
  139.