home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / BeanInfo.java < prev    next >
Text File  |  1997-05-20  |  6KB  |  161 lines

  1. /*
  2.  * @(#)BeanInfo.java    1.18 97/01/01  
  3.  * 
  4.  * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion bdk_beta
  20.  * 
  21.  */
  22.  
  23. package java.beans;
  24.  
  25. /**
  26.  * A bean implementor who wishes to provide explicit information about
  27.  * their bean may provide a BeanInfo class that implements this BeanInfo
  28.  * interface and provides explicit information about the methods,
  29.  * properties, events, etc, of their  bean.
  30.  * <p>
  31.  * A bean implementor doesn't need to provide a complete set of
  32.  * explicit information.  You can pick and choose which information
  33.  * you want to provide and the rest will be obtained by automatic
  34.  * analysis using low-level reflection of the bean classes' methods
  35.  * and applying standard design patterns.
  36.  * <p>
  37.  * You get the opportunity to provide lots and lots of different
  38.  * information as part of the various XyZDescriptor classes.  But
  39.  * don't panic, you only really need to provide the minimal core
  40.  * information required by the various constructors.
  41.  * <P>
  42.  * See also the SimpleBeanInfo class which provides a convenient
  43.  * "noop" base class for BeanInfo classes, which you can override
  44.  * for those specific places where you want to return explicit info.
  45.  * <P>
  46.  * To learn about all the behaviour of a bean see the Introspector class.
  47.  */
  48.  
  49. public interface BeanInfo {
  50.  
  51.     /**
  52.      * @return  A BeanDescriptor providing overall information about
  53.      * the bean, such as its displayName, its customizer, etc.  May
  54.      * return null if the information should be obtained by automatic
  55.      * analysis.
  56.      */
  57.     BeanDescriptor getBeanDescriptor();
  58.     
  59.     /**
  60.      * @return  An array of EventSetDescriptors describing the kinds of 
  61.      * events fired by this bean.  May return null if the information
  62.      * should be obtained by automatic analysis.
  63.      */
  64.     EventSetDescriptor[] getEventSetDescriptors();
  65.  
  66.     /**
  67.      * A bean may have a "default" event that is the event that will
  68.      * mostly commonly be used by human's when using the bean. 
  69.      * @return Index of default event in the EventSetDescriptor array
  70.      *        returned by getEventSetDescriptors.
  71.      * <P>    Returns -1 if there is no default event.
  72.      */
  73.     int getDefaultEventIndex();
  74.  
  75.     /**
  76.      * @return An array of PropertyDescriptors describing the editable
  77.      * properties supported by this bean.  May return null if the
  78.      * information should be obtained by automatic analysis.
  79.      * <p>
  80.      * If a property is indexed, then its entry in the result array will
  81.      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
  82.      * A client of getPropertyDescriptors can use "instanceof" to check
  83.      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
  84.      */
  85.     PropertyDescriptor[] getPropertyDescriptors();
  86.  
  87.     /**
  88.      * A bean may have a "default" property that is the property that will
  89.      * mostly commonly be initially chosen for update by human's who are 
  90.      * customizing the bean.
  91.      * @return  Index of default property in the PropertyDescriptor array
  92.      *         returned by getPropertyDescriptors.
  93.      * <P>    Returns -1 if there is no default property.
  94.      */
  95.     int getDefaultPropertyIndex();
  96.  
  97.     /**
  98.      * @return An array of MethodDescriptors describing the externally
  99.      * visible methods supported by this bean.  May return null if
  100.      * the information should be obtained by automatic analysis.
  101.      */
  102.     MethodDescriptor[] getMethodDescriptors();
  103.  
  104.     /**
  105.      * This method allows a BeanInfo object to return an arbitrary collection
  106.      * of other BeanInfo objects that provide additional information on the
  107.      * current bean.
  108.      * <P>
  109.      * If there are conflicts or overlaps between the information provided
  110.      * by different BeanInfo objects, then the current BeanInfo takes precedence
  111.      * over the getAdditionalBeanInfo objects, and later elements in the array
  112.      * take precedence over earlier ones.
  113.      *
  114.      * @return an array of BeanInfo objects.  May return null.
  115.      */
  116.     BeanInfo[] getAdditionalBeanInfo();
  117.  
  118.     /**
  119.      * This method returns an image object that can be used to
  120.      * represent the bean in toolboxes, toolbars, etc.   Icon images
  121.      * will typically be GIFs, but may in future include other formats.
  122.      * <p>
  123.      * Beans aren't required to provide icons and may return null from
  124.      * this method.
  125.      * <p>
  126.      * There are four possible flavors of icons (16x16 color,
  127.      * 32x32 color, 16x16 mono, 32x32 mono).  If a bean choses to only
  128.      * support a single icon we recommend supporting 16x16 color.
  129.      * <p>
  130.      * We recommend that icons have a "transparent" background
  131.      * so they can be rendered onto an existing background.
  132.      *
  133.      * @param  iconKind  The kind of icon requested.  This should be
  134.      *    one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, 
  135.      *    ICON_MONO_16x16, or ICON_MONO_32x32.
  136.      * @return  An image object representing the requested icon.  May
  137.      *    return null if no suitable icon is available.
  138.      */
  139.     java.awt.Image getIcon(int iconKind);
  140.      
  141.     /**
  142.      * Constant to indicate a 16 x 16 color icon.
  143.      */
  144.     final static int ICON_COLOR_16x16 = 1;
  145.  
  146.     /**
  147.      * Constant to indicate a 32 x 32 color icon.
  148.      */
  149.     final static int ICON_COLOR_32x32 = 2;
  150.  
  151.     /**
  152.      * Constant to indicate a 16 x 16 monochrome icon.
  153.      */
  154.     final static int ICON_MONO_16x16 = 3;
  155.  
  156.     /**
  157.      * Constant to indicate a 32 x 32 monochrome icon.
  158.      */
  159.     final static int ICON_MONO_32x32 = 4;
  160. }
  161.