FileDocCategorySizeDatePackage
DateBeanBeanInfo.javaAPI DocExample6067Sat Sep 12 03:01:00 BST 1998borland.samples.beans.customizer

DateBeanBeanInfo

public class DateBeanBeanInfo extends SimpleBeanInfo

Fields Summary
Class
beanClass
String
iconColor16x16Filename
String
iconColor32x32Filename
String
iconMono16x16Filename
String
iconMono32x32Filename
static final boolean
livemode
Constructors Summary
public DateBeanBeanInfo()


    
  
Methods Summary
public java.beans.BeanDescriptorgetBeanDescriptor()

    if(livemode)
      return new BeanDescriptor(DateBean.class, DateBeanCustomizer_live.class);
    else
      return new BeanDescriptor(DateBean.class, DateBeanCustomizer_batch.class);
  
public java.awt.ImagegetIcon(int iconKind)

    switch (iconKind) {
      case BeanInfo.ICON_COLOR_16x16:
        return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null;
      case BeanInfo.ICON_COLOR_32x32:
        return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null;
      case BeanInfo.ICON_MONO_16x16:
        return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null;
      case BeanInfo.ICON_MONO_32x32:
        return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null;
    }
    return null;
  
public java.beans.PropertyDescriptor[]getPropertyDescriptors()

    try  {

      PropertyDescriptor _background = new PropertyDescriptor("background", beanClass, "getBackground", "setBackground");
      _background.setDisplayName("background");
      _background.setShortDescription("background");

      PropertyDescriptor _font = new PropertyDescriptor("font", beanClass, "getFont", "setFont");
      _font.setDisplayName("font");
      _font.setShortDescription("font");

      PropertyDescriptor _fontColor = new PropertyDescriptor("fontColor", beanClass, "getFontColor", "setFontColor");
      _fontColor.setDisplayName("color for font");
      _fontColor.setShortDescription("font color");

      PropertyDescriptor _style = new PropertyDescriptor("style", beanClass, "getStyle", "setStyle");
      _style.setDisplayName("style");
      _style.setShortDescription("style");

      // enumeration mechanism added to the Beans spec.  Format is a simple array
      // of objects in triplet sets.  First item is the string to display in the
      // IDE (each mfr has to decide how they want to do it).  The second item is
      // the value of the object (typically an Integer) and the third is the
      // code-gen string.  This mechanism really makes code more readable when
      // created by a bean-aware RAD tool.  Instead of seeing
      //    x.setStyle(2);
      // you would see
      //    x.setStyle(DateBean.YEAR_MONTH_DAY);
      // in your code.  The latter matching what many developers already do to
      // make their code more readible
      _style.setValue("enumerationValues", new Object[] {
        "Mon Day Year",     new Integer(DateBean.MONTH_DAY_YEAR),     "DateBean.MONTH_DAY_YEAR",
        "Mon Day Year Era", new Integer(DateBean.MONTH_DAY_YEAR_ERA), "DateBean.MONTH_DAY_YEAR_ERA",
        "Year Mon Day",     new Integer(DateBean.YEAR_MONTH_DAY),     "DateBean.YEAR_MONTH_DAY",
        "Mon Year",         new Integer(DateBean.MONTH_YEAR),         "DateBean.MONTH_YEAR",
        "Day Mon Year",     new Integer(DateBean.DAY_MONTH_YEAR),     "DateBean.DAY_MONTH_YEAR"
      });

      PropertyDescriptor _useMonthString = new PropertyDescriptor("useMonthString", beanClass, "getUseMonthString", "setUseMonthString");
      _useMonthString.setDisplayName("use month string");
      _useMonthString.setShortDescription("month string");

      PropertyDescriptor[] pds = new PropertyDescriptor[] {
        _background,
        _font,
        _fontColor,
        _style,
        _useMonthString
      };

      return pds;
    }
    catch (IntrospectionException ex) {
      ex.printStackTrace();
        return null;
    }