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 / LabelBeanInfo.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  3.8 KB  |  139 lines

  1. /*
  2.  * @(#LabelBeanInfo.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 Label component.
  17.  *
  18.  */
  19.  
  20. public class LabelBeanInfo extends SimpleBeanInfo {
  21.  
  22.     /**
  23.      * Constructs a LabelBeanInfo object.
  24.      */
  25.     public LabelBeanInfo() {
  26.     }
  27.  
  28.     /**
  29.      * Gets BeanInfo for the superclass of this bean.
  30.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  31.      */
  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.         bd.setWinHelp("0x12331");
  64.  
  65.         return (BeanDescriptor) bd;
  66.     }
  67.  
  68.     /**
  69.      * Gets an image that may be used to visually represent this bean
  70.      * (in the toolbar, on a form, etc).
  71.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  72.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  73.      * @return an image for this bean, always color even if requested monochrome
  74.      * @see BeanInfo#ICON_MONO_16x16
  75.      * @see BeanInfo#ICON_COLOR_16x16
  76.      * @see BeanInfo#ICON_MONO_32x32
  77.      * @see BeanInfo#ICON_COLOR_32x32
  78.      */
  79.     public java.awt.Image getIcon(int iconKind) {
  80.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  81.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  82.             java.awt.Image img = loadImage("LabelC16.gif");
  83.             return img;
  84.         }
  85.  
  86.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  87.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  88.             java.awt.Image img = loadImage("LabelC32.gif");
  89.             return img;
  90.         }
  91.  
  92.         return null;
  93.     }
  94.  
  95.     /**
  96.      * Gets an array of descriptions of the methods used for "connections" by
  97.      * Visual CafΘ's Interaction Wizard.
  98.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  99.      * @return method descriptions for this bean
  100.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  101.      */
  102.     public MethodDescriptor[] getMethodDescriptors() {
  103.         return new MethodDescriptor[0];
  104.     }
  105.  
  106.     /**
  107.      * Gets an array of descriptions of this bean's properties.
  108.      * @return property descriptions for this bean
  109.      */
  110.     public PropertyDescriptor[] getPropertyDescriptors() {
  111.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.db.resources.PropBundle");
  112.  
  113.         try{
  114.  
  115.         PropertyDescriptor dataBinding = new PropertyDescriptor("dataBinding", beanClass);
  116.         dataBinding.setBound(false);
  117.         dataBinding.setConstrained(false);
  118.         dataBinding.setDisplayName(prop.getString("dataBinding"));
  119.         dataBinding.setPropertyEditorClass(symantec.itools.db.beans.binding.NameEditor.class);
  120.  
  121.         PropertyDescriptor[] rv = {
  122.             dataBinding,
  123.             };
  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 = Label.class;
  137.  
  138. }    //  end of class LabelBeanInfo|
  139.