home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 July / Chip_1998-07_cd.bin / zkuste / JBuilder / BDK / Win / bdk_sep97.exe / _SETUP.1 / BridgeTesterBeanInfo.java < prev    next >
Encoding:
Java Source  |  1997-09-10  |  6.2 KB  |  178 lines

  1.  
  2. // BeanInfo for an BridgeTester.
  3.  
  4. package sunw.demo.test;
  5.  
  6. import java.beans.*;
  7.  
  8.  
  9. public class BridgeTesterBeanInfo extends SimpleBeanInfo 
  10. {
  11.     Class btClass = BridgeTester.class; // around a bug in JDK1.1 javac
  12.  
  13.     public BeanDescriptor getBeanDescriptor() {
  14.     return new BeanDescriptor(btClass,
  15.                     BridgeTesterCustomizer.class);
  16.     }
  17.  
  18.     public PropertyDescriptor[] getPropertyDescriptors() {       
  19.         try {
  20.             PropertyDescriptor background =
  21.             new PropertyDescriptor("background", btClass);
  22.         PropertyDescriptor foreground =
  23.             new PropertyDescriptor("foreground", btClass);
  24.         PropertyDescriptor font =
  25.             new PropertyDescriptor("font", btClass);
  26.  
  27.         PropertyDescriptor intValue = new PropertyDescriptor("intValue",btClass);
  28.         intValue.setConstrained(false);
  29.         intValue.setBound(true);
  30.  
  31.         PropertyDescriptor shortValue = new PropertyDescriptor("shortValue", btClass);
  32.         shortValue.setConstrained(false);
  33.         shortValue.setBound(false);
  34.  
  35.         PropertyDescriptor longValue = new PropertyDescriptor("longValue", btClass);
  36.         longValue.setConstrained(false);
  37.         longValue.setBound(false);
  38.  
  39.         PropertyDescriptor byteValue = new PropertyDescriptor("byteValue", btClass);
  40.         byteValue.setConstrained(false);
  41.         byteValue.setBound(false);
  42.  
  43.         PropertyDescriptor charValue = new PropertyDescriptor("charValue", btClass);
  44.         charValue.setConstrained(false);
  45.         charValue.setBound(false);
  46.  
  47.         PropertyDescriptor floatValue = new PropertyDescriptor("floatValue", btClass);
  48.         floatValue.setConstrained(false);
  49.         floatValue.setBound(false);
  50.  
  51.         PropertyDescriptor doubleValue = new PropertyDescriptor("doubleValue", btClass);    
  52.         floatValue.setConstrained(false);
  53.         floatValue.setBound(false);
  54.  
  55.         PropertyDescriptor booleanValue = new PropertyDescriptor("booleanValue",btClass);
  56.         booleanValue.setConstrained(false);
  57.         booleanValue.setBound(false);
  58.  
  59.         PropertyDescriptor stringValue = new PropertyDescriptor("stringValue", btClass);
  60.         stringValue.setConstrained(false);
  61.         stringValue.setBound(false);
  62.  
  63.         IndexedPropertyDescriptor intArray = new IndexedPropertyDescriptor("intArray", 
  64.            btClass, "getIntArray", "setIntArray", "getIntArrayWithIndex", 
  65.            "setIntArrayWithIndex");
  66.         intArray.setBound(false);
  67.         intArray.setConstrained(false);
  68.  
  69.         IndexedPropertyDescriptor doubleArray = new IndexedPropertyDescriptor("doubleArray", 
  70.            btClass, "getDoubleArray", "setDoubleArray", "getDoubleArrayWithIndex", 
  71.            "setDoubleArrayWithIndex");
  72.         doubleArray.setConstrained(false);
  73.         doubleArray.setBound(false);
  74.  
  75.         IndexedPropertyDescriptor stringArray = new IndexedPropertyDescriptor("stringArray", 
  76.            btClass, "getStringArray", "setStringArray", "getStringArrayWithIndex", 
  77.            "setStringArrayWithIndex");
  78.         stringArray.setConstrained(false);
  79.         stringArray.setBound(false);
  80.  
  81.         IndexedPropertyDescriptor floatArray = new IndexedPropertyDescriptor("floatArray", 
  82.            btClass, "getFloatArray", "setFloatArray", "getFloatArrayWithIndex", 
  83.            "setFloatArrayWithIndex");
  84.         floatArray.setConstrained(false);
  85.         floatArray.setBound(false);
  86.  
  87.         IndexedPropertyDescriptor charArray = new IndexedPropertyDescriptor("charArray", 
  88.            btClass, "getCharArray", "setCharArray", "getCharArrayWithIndex", 
  89.            "setCharArrayWithIndex");
  90.         charArray.setConstrained(false);
  91.         charArray.setBound(false);
  92.  
  93.         IndexedPropertyDescriptor byteArray = new IndexedPropertyDescriptor("byteArray", 
  94.            btClass, "getByteArray", "setByteArray", "getByteArrayWithIndex", 
  95.            "setByteArrayWithIndex");
  96.         byteArray.setConstrained(false);
  97.         byteArray.setBound(false);
  98.  
  99.         IndexedPropertyDescriptor booleanArray = new IndexedPropertyDescriptor("booleanArray", 
  100.            btClass, "getBooleanArray", "setBooleanArray", "getBooleanArrayWithIndex", 
  101.            "setBooleanArrayWithIndex");
  102.         booleanArray.setConstrained(false);
  103.         booleanArray.setBound(false);
  104.  
  105.         IndexedPropertyDescriptor shortArray = new IndexedPropertyDescriptor("shortArray", 
  106.            btClass, "getShortArray", "setShortArray", "getShortArrayWithIndex", 
  107.            "setShortArrayWithIndex");
  108.         shortArray.setConstrained(false);
  109.         shortArray.setBound(false);
  110.          
  111.         PropertyDescriptor rv[]={intValue, shortValue, longValue, floatValue, doubleValue, charValue,
  112.                      booleanValue, byteValue,stringValue,
  113.                      intArray, doubleArray, stringArray, charArray, byteArray,
  114.                      booleanArray, floatArray, shortArray,
  115.                      background, foreground, font};
  116.         return rv;
  117.  
  118.     } catch (IntrospectionException e) {
  119.          throw new Error(e.toString());
  120.     }
  121.     }
  122.  
  123.     public int getDefaultPropertyIndex() {
  124.         return 8;
  125.     }
  126.  
  127.     public EventSetDescriptor[] getEventSetDescriptors() {
  128.       String[] listenerMethods = { "eventNumber1", "eventNumber2", "eventNumber3", "eventNumber4" };
  129.       EventSetDescriptor event, changes, vetos;
  130.       try {
  131.          event = new EventSetDescriptor(btClass, 
  132.              "Event", BridgeTesterListener.class, listenerMethods, 
  133.              "addBridgeTesterListener", "removeBridgeTesterListener");
  134.      changes = new EventSetDescriptor(btClass, 
  135.             "propertyChange",
  136.             java.beans.PropertyChangeListener.class,
  137.             "propertyChange");
  138.          vetos = new EventSetDescriptor(btClass, 
  139.             "vetoableChange",
  140.             java.beans.VetoableChangeListener.class,
  141.                 "vetoableChange");
  142.       } catch (IntrospectionException e) {
  143.        throw new Error(e.toString());
  144.       }
  145.       EventSetDescriptor[] events = {event, changes, vetos};
  146.       return events;
  147.     }
  148.  
  149.     public int getDefaultEventIndex() {
  150.       return 2;
  151.     }
  152.  
  153.     public MethodDescriptor[] getMethodDescriptors() {
  154.        return null;
  155.     }
  156.      
  157.     public java.awt.Image getIcon(int iconKind) {
  158.     if (iconKind == BeanInfo.ICON_COLOR_16x16) {
  159.         java.awt.Image img = loadImage("BridgeTesterIconColor16.gif");
  160.         return img;
  161.     }
  162.     if (iconKind == BeanInfo.ICON_COLOR_32x32) {
  163.         java.awt.Image img = loadImage("BridgeTesterIconColor32.gif");
  164.         return img;
  165.     }
  166.     if (iconKind == BeanInfo.ICON_MONO_16x16) {
  167.         java.awt.Image img = loadImage("BridgeTesterIconMono16.gif");
  168.         return img;
  169.     }
  170.     if (iconKind == BeanInfo.ICON_MONO_32x32) {
  171.         java.awt.Image img = loadImage("BridgeTesterIconMono32.gif");
  172.         return img;
  173.     }
  174.     return null;
  175.     }
  176. }
  177.  
  178.