home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 8.5 KB | 246 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- /**
- * BeanInfo for StatusBar.
- *
- */
-
- public class StatusBarBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a StatusBarBeanInfo object.
- */
- public StatusBarBeanInfo() {
- }
-
- /**
- * Gets a BeanInfo for the superclass of this bean.
- * @return BeanInfo[] containing this bean's superclass BeanInfo
- */
- public BeanInfo[] getAdditionalBeanInfo() {
- try {
- BeanInfo[] bi = new BeanInfo[1];
- bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
- return bi;
- }
- 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() {
- ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
- String s=group.getString("GroupAdditional");
-
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setCanAddChild(false);
- bd.setWinHelp("0x12390");
- bd.setFolder(s);
- bd.setToolbar(s);
-
- bd.addAdditionalConnections(getAdditionalBeanInfo());
-
- 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("StatusBarC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("StatusBarC32.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() {
- Class[] args;
- ConnectionDescriptor connection;
- java.util.Vector connections;
- java.util.Vector md = new java.util.Vector();
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
-
- try{
- args = null;
- MethodDescriptor getStatusTextColor = new MethodDescriptor(beanClass.getMethod("getStatusTextColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getStatusTextColor();",
- conn.getString("getStatusTextColor"));
- connections.addElement(connection);
-
- getStatusTextColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getStatusTextColor);
- } catch (Exception e) { throw new Error("getStatusTextColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.String.class ;
- MethodDescriptor setStatusText = new MethodDescriptor(beanClass.getMethod("setStatusText", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "String", "",
- "%name%.setStatusText(%arg%);",
- conn.getString("setStatusText"));
- connections.addElement(connection);
-
- setStatusText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setStatusText);
- } catch (Exception e) { throw new Error("setStatusText:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getStatusText = new MethodDescriptor(beanClass.getMethod("getStatusText", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "String", "",
- "%name%.getStatusText()",
- conn.getString("getStatusText"));
- connections.addElement(connection);
-
- getStatusText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getStatusText);
- } catch (Exception e) { throw new Error("getStatusText:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setStatusTextColor = new MethodDescriptor(beanClass.getMethod("setStatusTextColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setStatusTextColor(%arg%);",
- conn.getString("setStatusTextColor"));
- connections.addElement(connection);
-
- setStatusTextColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setStatusTextColor);
- } catch (Exception e) { throw new Error("setStatusTextColor:: " + e.toString()); }
-
- MethodDescriptor[] rv = new MethodDescriptor[md.size()];
- md.copyInto(rv);
-
- return rv;
- }
-
- /**
- * Returns descriptions of this bean's properties.
- */
- public PropertyDescriptor[] getPropertyDescriptors() {
- ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
-
- try{
- PropertyDescriptor defProperty = new PropertyDescriptor("statusText", beanClass);
- defProperty.setBound(true);
- defProperty.setConstrained(true);
- defProperty.setDisplayName(prop.getString("statusText"));
-
- PropertyDescriptor statusTextColor = new PropertyDescriptor("statusTextColor", beanClass);
- statusTextColor.setBound(true);
- statusTextColor.setConstrained(true);
- statusTextColor.setDisplayName(prop.getString("statusTextColor"));
-
- PropertyDescriptor paddingTop = new PropertyDescriptor("paddingTop", beanClass);
- paddingTop.setBound(true);
- paddingTop.setConstrained(true);
- paddingTop.setDisplayName(prop.getString("paddingTop"));
-
- PropertyDescriptor paddingBottom = new PropertyDescriptor("paddingBottom", beanClass);
- paddingBottom.setBound(true);
- paddingBottom.setConstrained(true);
- paddingBottom.setDisplayName(prop.getString("paddingBottom"));
-
- PropertyDescriptor paddingLeft = new PropertyDescriptor("paddingLeft", beanClass);
- paddingLeft.setBound(true);
- paddingLeft.setConstrained(true);
- paddingLeft.setDisplayName(prop.getString("paddingLeft"));
-
- PropertyDescriptor paddingRight = new PropertyDescriptor("paddingRight", beanClass);
- paddingRight.setBound(true);
- paddingRight.setConstrained(true);
- paddingRight.setDisplayName(prop.getString("paddingRight"));
-
- PropertyDescriptor iPadTop = new PropertyDescriptor("iPadTop", beanClass);
- iPadTop.setBound(true);
- iPadTop.setConstrained(true);
- iPadTop.setDisplayName(prop.getString("iPadTop"));
-
- PropertyDescriptor iPadBottom = new PropertyDescriptor("iPadBottom", beanClass);
- iPadBottom.setBound(true);
- iPadBottom.setConstrained(true);
- iPadBottom.setDisplayName(prop.getString("iPadBottom"));
-
- PropertyDescriptor iPadSides = new PropertyDescriptor("iPadSides", beanClass);
- iPadSides.setBound(true);
- iPadSides.setConstrained(true);
- iPadSides.setDisplayName(prop.getString("iPadSides"));
-
- PropertyDescriptor borderColor = new PropertyDescriptor("borderColor", beanClass);
- borderColor.setBound(true);
- borderColor.setConstrained(true);
- borderColor.setDisplayName(prop.getString("borderColor"));
-
- PropertyDescriptor bevelStyle = new PropertyDescriptor("bevelStyle", beanClass);
- bevelStyle.setBound(true);
- bevelStyle.setConstrained(true);
- bevelStyle.setDisplayName(prop.getString("bevelStyle"));
- bevelStyle.setValue("ENUMERATION", "BEVEL_LOWERED=0, BEVEL_RAISED=1, BEVEL_LINE=2, BEVEL_NONE=3");
-
- PropertyDescriptor[] rv = {
- defProperty,
- statusTextColor,
- paddingTop,
- paddingBottom,
- paddingLeft,
- paddingRight,
- iPadTop,
- iPadBottom,
- iPadSides,
- borderColor,
- bevelStyle};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- /**
- * Returns the index of the property expected to be changed most often by the designer.
- */
- public int getDefaultPropertyIndex() {
- return 0; // the index for our default property is always 0
- }
-
- private final static Class beanClass = StatusBar.class;
-
- } // end of class StatusBarBeanInfo