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 / JFCBinderModelBeanInfo.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  2.8 KB  |  95 lines

  1.  
  2. package symantec.itools.db.beans.binding;
  3.  
  4. import java.beans.*;
  5. import symantec.itools.beans.*;
  6.  
  7. public class JFCBinderModelBeanInfo extends SimpleBeanInfo {
  8.  
  9.     public BeanInfo[] getAdditionalBeanInfo() {
  10.         try {
  11.             java.util.Vector v = new java.util.Vector();
  12.             BeanInfo[] rv;
  13.             BeanInfo b;
  14.             Class c = beanClass.getSuperclass();
  15.  
  16.             while (c.isAssignableFrom(Object.class) != true) {
  17.                 b = Introspector.getBeanInfo(c);
  18.                 v.addElement(b);
  19.                 c = c.getSuperclass();
  20.             }
  21.             rv = new BeanInfo[v.size()];
  22.             v.copyInto(rv);
  23.  
  24.             return rv;
  25.         }
  26.         catch (IntrospectionException e) { throw new Error(e.toString());}
  27.     }
  28.  
  29.     public BeanDescriptor getBeanDescriptor() {
  30.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  31.         bd.setFolder("JDBC");
  32.         bd.setWinHelp("0x123CE");
  33.  
  34.         return (BeanDescriptor) bd;
  35.     }
  36.  
  37.     public java.awt.Image getIcon(int iconKind) {
  38.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  39.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  40.             java.awt.Image img = loadImage("MediatorDSIconColor16.gif");
  41.             return img;
  42.         }
  43.  
  44.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  45.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  46.             java.awt.Image img = loadImage("MediatorDSIconColor32.gif");
  47.             return img;
  48.         }
  49.  
  50.         return null;
  51.     }
  52.  
  53.     public PropertyDescriptor[] getPropertyDescriptors() {
  54.         try{
  55.         PropertyDescriptor dataBinding = new PropertyDescriptor("dataBinding", beanClass);
  56.         dataBinding.setBound(false);
  57.         dataBinding.setConstrained(false);
  58.         dataBinding.setDisplayName("Data Binding");
  59.         dataBinding.setPropertyEditorClass(NameEditor.class);
  60.  
  61.         PropertyDescriptor lookupBinding = new PropertyDescriptor("lookupBinding", beanClass);
  62.         lookupBinding.setBound(false);
  63.         lookupBinding.setConstrained(false);
  64.         lookupBinding.setDisplayName("Lookup Binding");
  65.         lookupBinding.setPropertyEditorClass(NameEditorMultiRow.class);
  66.         
  67.         PropertyDescriptor booleanFalseString = new PropertyDescriptor("booleanFalseString", beanClass);
  68.         booleanFalseString.setBound(false);
  69.         booleanFalseString.setConstrained(false);
  70.         booleanFalseString.setDisplayName("Boolean False String");
  71.         
  72.         PropertyDescriptor booleanTrueString = new PropertyDescriptor("booleanTrueString", beanClass);
  73.         booleanTrueString.setBound(false);
  74.         booleanTrueString.setConstrained(false);
  75.         booleanTrueString.setDisplayName("Boolean True String");
  76.         
  77.         
  78.         PropertyDescriptor[] rv = {
  79.             booleanFalseString,
  80.             booleanTrueString,
  81.             dataBinding,
  82.             lookupBinding
  83.             };
  84.  
  85.         return rv;
  86.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  87.     }
  88.  
  89.     public int getDefaultPropertyIndex() {
  90.         return 0;    //  the index for our default property is always 0
  91.     }
  92.  
  93.     private final static Class beanClass = JFCBinderModel.class;
  94.  
  95. }    //  end of class MediatorDSBeanInfo