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 / NervousTextBeanInfo.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  3.7 KB  |  133 lines

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