home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / Source.bin / RectBeanInfo.java < prev    next >
Text File  |  1998-03-18  |  2KB  |  80 lines

  1. package symantec.itools.awt.shape;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. /**
  8.  * BeanInfo for Rect.
  9.  *
  10.  */
  11.  
  12. public class RectBeanInfo extends SimpleBeanInfo {
  13.  
  14.     /**
  15.      * Constructs a RectBeanInfo object.
  16.      */
  17.     public RectBeanInfo() {
  18.     }
  19.  
  20.     /**
  21.      * Gets a BeanInfo for the superclass of this bean.
  22.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  23.      */
  24.     public BeanInfo[] getAdditionalBeanInfo() {
  25.         try {
  26.             BeanInfo[] bi = new BeanInfo[1];
  27.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  28.             return bi;
  29.         }
  30.         catch (IntrospectionException e) { throw new Error(e.toString());}
  31.     }
  32.  
  33.     /**
  34.      * Gets the SymantecBeanDescriptor for this bean.
  35.      * @return an object of type SymantecBeanDescriptor
  36.      * @see symantec.itools.beans.SymantecBeanDescriptor
  37.      */
  38.     public BeanDescriptor getBeanDescriptor() {
  39.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  40.         String s=group.getString("GroupShape"); 
  41.  
  42.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  43.         bd.setFolder(s);
  44.         bd.setToolbar(s);
  45.  
  46.         bd.addAdditionalConnections(getAdditionalBeanInfo());
  47.  
  48.         return (BeanDescriptor) bd;
  49.     }
  50.  
  51.     /**
  52.      * Gets an image that may be used to visually represent this bean
  53.      * (in the toolbar, on a form, etc).
  54.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  55.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  56.      * @return an image for this bean, always color even if requested monochrome
  57.      * @see BeanInfo#ICON_MONO_16x16
  58.      * @see BeanInfo#ICON_COLOR_16x16
  59.      * @see BeanInfo#ICON_MONO_32x32
  60.      * @see BeanInfo#ICON_COLOR_32x32
  61.      */
  62.     public java.awt.Image getIcon(int iconKind) {
  63.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  64.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  65.             java.awt.Image img = loadImage("RectC16.gif");
  66.             return img;
  67.         }
  68.  
  69.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  70.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  71.             java.awt.Image img = loadImage("RectC32.gif");
  72.             return img;
  73.         }
  74.  
  75.         return null;
  76.     }
  77.  
  78.     private final static Class beanClass = Rect.class;
  79.  
  80.     }    //  end of class RectBeanInfo