home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / prosrc.bin / FormattedTextFieldBeanInfo.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  4.3 KB  |  142 lines

  1. /*
  2.  * @(#FormattedTextFieldBeanInfo.java
  3.  *
  4.  * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
  5.  *
  6.  */
  7.  
  8. package symantec.itools.db.awt;
  9.  
  10. import java.beans.*;
  11. import symantec.itools.beans.*;
  12. import java.util.ResourceBundle;
  13.  
  14. /**
  15.  * BeanInfo for the FormattedTextField component.
  16.  *
  17.  */
  18.  
  19. public class FormattedTextFieldBeanInfo extends SimpleBeanInfo {
  20.  
  21.     /**
  22.      * Constructs a FormattedTextFieldBeanInfo object.
  23.      */
  24.     public FormattedTextFieldBeanInfo() {
  25.     }
  26.  
  27.     /**
  28.      * Gets an array of BeanInfo on the superclasses of this object.
  29.      * The superclasses returned are all assignable from class Object
  30.      * (see isAssignableFrom).
  31.      * @return BeanInfo on this class's superclasses
  32.      * @see java.lang.Class#isAssignableFrom
  33.      */
  34.     public BeanInfo[] getAdditionalBeanInfo() {
  35.         try {
  36.             java.util.Vector v = new java.util.Vector();
  37.             BeanInfo[] rv;
  38.             BeanInfo b;
  39.             Class c = beanClass.getSuperclass();
  40.  
  41.             while (c.isAssignableFrom(Object.class) != true) {
  42.                 b = Introspector.getBeanInfo(c);
  43.                 v.addElement(b);
  44.                 c = c.getSuperclass();
  45.             }
  46.             rv = new BeanInfo[v.size()];
  47.             v.copyInto(rv);
  48.  
  49.             return rv;
  50.         }
  51.         catch (IntrospectionException e) { throw new Error(e.toString());}
  52.     }
  53.  
  54.     /**
  55.      * Gets the SymantecBeanDescriptor for this bean.
  56.      * @return an object of type SymantecBeanDescriptor
  57.      * @see symantec.itools.beans.SymantecBeanDescriptor
  58.      */
  59.     public BeanDescriptor getBeanDescriptor() {
  60.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  61.         bd.setFolder("dbAWARE");
  62.         bd.setToolbar("dbAWARE");
  63.         bd.setWinHelp("0x123AE");
  64.  
  65.         return (BeanDescriptor) bd;
  66.     }
  67.  
  68.     /**
  69.      * Gets an image that may be used to visually represent this bean
  70.      * (in the toolbar, on a form, etc).
  71.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  72.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  73.      * @return an image for this bean, always color even if requested monochrome
  74.      * @see BeanInfo#ICON_MONO_16x16
  75.      * @see BeanInfo#ICON_COLOR_16x16
  76.      * @see BeanInfo#ICON_MONO_32x32
  77.      * @see BeanInfo#ICON_COLOR_32x32
  78.      */
  79.     public java.awt.Image getIcon(int iconKind) {
  80.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  81.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  82.             java.awt.Image img = loadImage("FormattedTextFieldC16.gif");
  83.             return img;
  84.         }
  85.  
  86.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  87.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  88.             java.awt.Image img = loadImage("FormattedTextFieldC32.gif");
  89.             return img;
  90.         }
  91.  
  92.         return null;
  93.     }
  94.  
  95.     /**
  96.      * Gets an array of descriptions of the methods used for "connections" by
  97.      * Visual CafΘ's Interaction Wizard.
  98.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  99.      * @return method descriptions for this bean
  100.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  101.      */
  102.     public MethodDescriptor[] getMethodDescriptors() {
  103.         java.util.Vector md = new java.util.Vector();
  104.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  105.         return rv;
  106.     }
  107.  
  108.     /**
  109.      * Gets an array of descriptions of this bean's properties.
  110.      * @return property descriptions for this bean
  111.      */
  112.     public PropertyDescriptor[] getPropertyDescriptors() {
  113.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.db.resources.PropBundle");
  114.  
  115.         try{
  116.         PropertyDescriptor pd1 = new PropertyDescriptor("dataBinding", beanClass);
  117.         pd1.setBound(false);
  118.         pd1.setConstrained(false);
  119.         pd1.setDisplayName(prop.getString("dataBinding"));
  120.         pd1.setPropertyEditorClass(symantec.itools.db.beans.binding.NameEditor.class);
  121.  
  122.         PropertyDescriptor pd2 = new PropertyDescriptor("triggeringEvent", beanClass);
  123.         pd2.setBound(false);
  124.         pd2.setConstrained(false);
  125.         pd2.setDisplayName(prop.getString("triggeringEvent"));
  126.         pd2.setValue("ENUMERATION", "Focus_Event=0, Key_Event=1, Text_Event=2");
  127.  
  128.         PropertyDescriptor pd4 = new PropertyDescriptor("emptyMeansNull", beanClass);
  129.         pd4.setBound(false);
  130.         pd4.setConstrained(false);
  131.         pd4.setDisplayName(prop.getString("emptyMeansNull"));
  132.  
  133.         PropertyDescriptor[] rv = {pd1, pd2, pd4};
  134.  
  135.         return rv;
  136.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  137.     }
  138.  
  139.     private final static Class beanClass = FormattedTextField.class;
  140.  
  141.     }    //  end of class FormattedTextFieldBeanInfo|
  142.