home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Main.bin / SimpleBeanInfo.java < prev    next >
Text File  |  1998-09-22  |  4KB  |  117 lines

  1. /*
  2.  * @(#)SimpleBeanInfo.java    1.18 98/07/01
  3.  *
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.beans;
  16.  
  17. /**
  18.  * This is a support class to make it easier for people to provide
  19.  * BeanInfo classes.
  20.  * <p>
  21.  * It defaults to providing "noop" information, and can be selectively
  22.  * overriden to provide more explicit information on chosen topics.
  23.  * When the introspector sees the "noop" values, it will apply low
  24.  * level introspection and design patterns to automatically analyze
  25.  * the target bean.
  26.  */
  27.  
  28. public class SimpleBeanInfo implements BeanInfo {
  29.  
  30.     /**
  31.      * Deny knowledge about the class and customizer of the bean.
  32.      * You can override this if you wish to provide explicit info.
  33.      */
  34.     public BeanDescriptor getBeanDescriptor() {
  35.     return null;
  36.     }
  37.  
  38.     /**
  39.      * Deny knowledge of properties. You can override this
  40.      * if you wish to provide explicit property info.
  41.      */
  42.     public PropertyDescriptor[] getPropertyDescriptors() {
  43.     return null;
  44.     }
  45.  
  46.     /**
  47.      * Deny knowledge of a default property. You can override this
  48.      * if you wish to define a default property for the bean.
  49.      */
  50.     public int getDefaultPropertyIndex() {
  51.     return -1;
  52.     }
  53.  
  54.     /**
  55.      * Deny knowledge of event sets. You can override this
  56.      * if you wish to provide explicit event set info.
  57.      */
  58.     public EventSetDescriptor[] getEventSetDescriptors() {
  59.     return null;
  60.     }
  61.  
  62.     /**
  63.      * Deny knowledge of a default event. You can override this
  64.      * if you wish to define a default event for the bean.
  65.      */
  66.     public int getDefaultEventIndex() {
  67.     return -1;
  68.     }
  69.  
  70.     /**
  71.      * Deny knowledge of methods. You can override this
  72.      * if you wish to provide explicit method info.
  73.      */
  74.     public MethodDescriptor[] getMethodDescriptors() {
  75.     return null;
  76.     }
  77.  
  78.     /**
  79.      * Claim there are no other relevant BeanInfo objects.  You
  80.      * may override this if you want to (for example) return a
  81.      * BeanInfo for a base class.
  82.      */
  83.     public BeanInfo[] getAdditionalBeanInfo() {
  84.     return null;
  85.     }
  86.  
  87.     /**
  88.      * Claim there are no icons available.  You can override
  89.      * this if you want to provide icons for your bean.
  90.      */
  91.     public java.awt.Image getIcon(int iconKind) {
  92.     return null;
  93.     }
  94.  
  95.     /**
  96.      * This is a utility method to help in loading icon images.
  97.      * It takes the name of a resource file associated with the
  98.      * current object's class file and loads an image object
  99.      * from that file.  Typically images will be GIFs.
  100.      * <p>
  101.      * @param resourceName  A pathname relative to the directory
  102.      *        holding the class file of the current class.  For example,
  103.      *        "wombat.gif".
  104.      * @return  an image object.  May be null if the load failed.
  105.      */
  106.     public java.awt.Image loadImage(String resourceName) {
  107.     try {
  108.         java.net.URL url = getClass().getResource(resourceName);
  109.         java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
  110.         return tk.createImage((java.awt.image.ImageProducer) url.getContent());
  111.     } catch (Exception ex) {
  112.         return null;
  113.     }
  114.     }
  115.  
  116. }
  117.