home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 4.3 KB | 142 lines |
- /*
- * @(#FormattedTextFieldBeanInfo.java
- *
- * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
- *
- */
-
- package symantec.itools.db.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- /**
- * BeanInfo for the FormattedTextField component.
- *
- */
-
- public class FormattedTextFieldBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a FormattedTextFieldBeanInfo object.
- */
- public FormattedTextFieldBeanInfo() {
- }
-
- /**
- * Gets an array of BeanInfo on the superclasses of this object.
- * The superclasses returned are all assignable from class Object
- * (see isAssignableFrom).
- * @return BeanInfo on this class's superclasses
- * @see java.lang.Class#isAssignableFrom
- */
- public BeanInfo[] getAdditionalBeanInfo() {
- try {
- java.util.Vector v = new java.util.Vector();
- BeanInfo[] rv;
- BeanInfo b;
- Class c = beanClass.getSuperclass();
-
- while (c.isAssignableFrom(Object.class) != true) {
- b = Introspector.getBeanInfo(c);
- v.addElement(b);
- c = c.getSuperclass();
- }
- rv = new BeanInfo[v.size()];
- v.copyInto(rv);
-
- return rv;
- }
- catch (IntrospectionException e) { throw new Error(e.toString());}
- }
-
- /**
- * Gets the SymantecBeanDescriptor for this bean.
- * @return an object of type SymantecBeanDescriptor
- * @see symantec.itools.beans.SymantecBeanDescriptor
- */
- public BeanDescriptor getBeanDescriptor() {
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setFolder("dbAWARE");
- bd.setToolbar("dbAWARE");
- bd.setWinHelp("0x123AE");
-
- return (BeanDescriptor) bd;
- }
-
- /**
- * Gets an image that may be used to visually represent this bean
- * (in the toolbar, on a form, etc).
- * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
- * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
- * @return an image for this bean, always color even if requested monochrome
- * @see BeanInfo#ICON_MONO_16x16
- * @see BeanInfo#ICON_COLOR_16x16
- * @see BeanInfo#ICON_MONO_32x32
- * @see BeanInfo#ICON_COLOR_32x32
- */
- public java.awt.Image getIcon(int iconKind) {
- if (iconKind == BeanInfo.ICON_MONO_16x16 ||
- iconKind == BeanInfo.ICON_COLOR_16x16) {
- java.awt.Image img = loadImage("FormattedTextFieldC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("FormattedTextFieldC32.gif");
- return img;
- }
-
- return null;
- }
-
- /**
- * Gets an array of descriptions of the methods used for "connections" by
- * Visual CafΘ's Interaction Wizard.
- * Included in each method description is a CONNECTIONS ConnectionDescriptor.
- * @return method descriptions for this bean
- * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
- */
- public MethodDescriptor[] getMethodDescriptors() {
- java.util.Vector md = new java.util.Vector();
- MethodDescriptor[] rv = new MethodDescriptor[md.size()];
- return rv;
- }
-
- /**
- * Gets an array of descriptions of this bean's properties.
- * @return property descriptions for this bean
- */
- public PropertyDescriptor[] getPropertyDescriptors() {
- ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.db.resources.PropBundle");
-
- try{
- PropertyDescriptor pd1 = new PropertyDescriptor("dataBinding", beanClass);
- pd1.setBound(false);
- pd1.setConstrained(false);
- pd1.setDisplayName(prop.getString("dataBinding"));
- pd1.setPropertyEditorClass(symantec.itools.db.beans.binding.NameEditor.class);
-
- PropertyDescriptor pd2 = new PropertyDescriptor("triggeringEvent", beanClass);
- pd2.setBound(false);
- pd2.setConstrained(false);
- pd2.setDisplayName(prop.getString("triggeringEvent"));
- pd2.setValue("ENUMERATION", "Focus_Event=0, Key_Event=1, Text_Event=2");
-
- PropertyDescriptor pd4 = new PropertyDescriptor("emptyMeansNull", beanClass);
- pd4.setBound(false);
- pd4.setConstrained(false);
- pd4.setDisplayName(prop.getString("emptyMeansNull"));
-
- PropertyDescriptor[] rv = {pd1, pd2, pd4};
-
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = FormattedTextField.class;
-
- } // end of class FormattedTextFieldBeanInfo|
-