home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 13.1 KB | 377 lines |
- package symantec.itools.awt.util;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 09/19/97 RKM Fixed connection that called deprecated code
-
- /**
- * BeanInfo for StatusScroller.
- *
- */
-
- public class StatusScrollerBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a StatusScrollerBeanInfo object.
- */
- public StatusScrollerBeanInfo() {
- }
-
- /**
- * 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("GroupUtility");
-
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setFolder(s);
- bd.setToolbar(s);
- bd.setWinHelp("0x12396");
-
- 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("StatusScrollerC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("StatusScrollerC32.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 isScrollClean = new MethodDescriptor(beanClass.getMethod("isScrollClean", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isScrollClean()",
- conn.getString("isScrollClean"));
- connections.addElement(connection);
-
- isScrollClean.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isScrollClean);
- } catch (Exception e) { throw new Error("isScrollClean:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setScrollClean = new MethodDescriptor(beanClass.getMethod("setScrollClean", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setScrollClean(%arg%);",
- conn.getString("setScrollClean"));
- connections.addElement(connection);
-
- setScrollClean.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setScrollClean);
- } catch (Exception e) { throw new Error("setScrollClean:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.String.class ;
- MethodDescriptor setString = new MethodDescriptor(beanClass.getMethod("setString", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "String", "",
- "%name%.setString(%arg%);",
- conn.getString("setString"));
- connections.addElement(connection);
-
- setString.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setString);
- } catch (Exception e) { throw new Error("setString:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isRightToLeft = new MethodDescriptor(beanClass.getMethod("isRightToLeft", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isRightToLeft()",
- conn.getString("isRightToLeft"));
- connections.addElement(connection);
-
- isRightToLeft.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isRightToLeft);
- } catch (Exception e) { throw new Error("isRightToLeft:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setRightToLeft = new MethodDescriptor(beanClass.getMethod("setRightToLeft", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setRightToLeft(%name%.isRightToLeft());",
- conn.getString("setRightToLeftToggle"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setRightToLeft(%arg%);",
- conn.getString("setRightToLeft"));
- connections.addElement(connection);
-
- setRightToLeft.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setRightToLeft);
- } catch (Exception e) { throw new Error("setRightToLeft:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isAutoStart = new MethodDescriptor(beanClass.getMethod("isAutoStart", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isAutoStart()",
- conn.getString("isAutoStart"));
- connections.addElement(connection);
-
- isAutoStart.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isAutoStart);
- } catch (Exception e) { throw new Error("isAutoStart:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setDelay = new MethodDescriptor(beanClass.getMethod("setDelay", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setDelay(%arg%);",
- conn.getString("setDelay"));
- connections.addElement(connection);
-
- setDelay.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setDelay);
- } catch (Exception e) { throw new Error("setDelay:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor stop = new MethodDescriptor(beanClass.getMethod("stop", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.stop();",
- conn.getString("stop"));
- connections.addElement(connection);
-
- stop.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(stop);
- } catch (Exception e) { throw new Error("stop:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setRepeat = new MethodDescriptor(beanClass.getMethod("setRepeat", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setRepeat(%arg%);",
- conn.getString("setRepeat"));
- connections.addElement(connection);
-
- setRepeat.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setRepeat);
- } catch (Exception e) { throw new Error("setRepeat:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isRepeat = new MethodDescriptor(beanClass.getMethod("isRepeat", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isRepeat()",
- conn.getString("isRepeat"));
- connections.addElement(connection);
-
- isRepeat.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isRepeat);
- } catch (Exception e) { throw new Error("isRepeat:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getString = new MethodDescriptor(beanClass.getMethod("getString", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "String", "",
- "%name%.getString()",
- conn.getString("getString"));
- connections.addElement(connection);
-
- getString.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getString);
- } catch (Exception e) { throw new Error("getString:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getDelay = new MethodDescriptor(beanClass.getMethod("getDelay", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getDelay()",
- conn.getString("getDelay"));
- connections.addElement(connection);
-
- getDelay.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getDelay);
- } catch (Exception e) { throw new Error("getDelay:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor clear = new MethodDescriptor(beanClass.getMethod("clear", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.clear();",
- conn.getString("clearStatusArea"));
- connections.addElement(connection);
-
- clear.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(clear);
- } catch (Exception e) { throw new Error("clear:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor start = new MethodDescriptor(beanClass.getMethod("start", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.start();",
- conn.getString("start"));
- connections.addElement(connection);
-
- start.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(start);
- } catch (Exception e) { throw new Error("start:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setAutoStart = new MethodDescriptor(beanClass.getMethod("setAutoStart", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setAutoStart(%arg%);",
- conn.getString("setAutoStart"));
- connections.addElement(connection);
-
- setAutoStart.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setAutoStart);
- } catch (Exception e) { throw new Error("setAutoStart:: " + 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("string", beanClass);
- defProperty.setBound(true);
- defProperty.setConstrained(true);
- defProperty.setDisplayName(prop.getString("string"));
-
- PropertyDescriptor delay = new PropertyDescriptor("delay", beanClass);
- delay.setBound(true);
- delay.setConstrained(true);
- delay.setDisplayName(prop.getString("delay"));
-
- PropertyDescriptor repeat = new PropertyDescriptor("repeat", beanClass);
- repeat.setBound(true);
- repeat.setConstrained(true);
- repeat.setDisplayName(prop.getString("repeat"));
-
- PropertyDescriptor rightToLeft = new PropertyDescriptor("rightToLeft", beanClass);
- rightToLeft.setBound(true);
- rightToLeft.setConstrained(true);
- rightToLeft.setDisplayName(prop.getString("rightToLeft"));
-
- PropertyDescriptor scrollClean = new PropertyDescriptor("scrollClean", beanClass);
- scrollClean.setBound(true);
- scrollClean.setConstrained(true);
- scrollClean.setDisplayName(prop.getString("scrollClean"));
-
- PropertyDescriptor autoStart = new PropertyDescriptor("autoStart", beanClass);
- autoStart.setBound(true);
- autoStart.setConstrained(true);
- autoStart.setDisplayName(prop.getString("autoStart"));
-
- PropertyDescriptor[] rv = {
- defProperty,
- delay,
- repeat,
- rightToLeft,
- scrollClean,
- autoStart};
- 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 = StatusScroller.class;
-
- } // end of class StatusScrollerBeanInfo