home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 6.8 KB | 208 lines |
- package symantec.itools.multimedia;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- /**
- * BeanInfo for NervousText.
- *
- */
-
- public class NervousTextBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a NervousTextBeanInfo object.
- */
- public NervousTextBeanInfo() {
- }
-
- /**
- * 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("GroupMultimedia");
-
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setFolder(s);
- bd.setToolbar(s);
- bd.setWinHelp("0x12341");
-
- 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("NervousTextC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("NervousTextC32.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 isPaused = new MethodDescriptor(beanClass.getMethod("isPaused", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isPaused()",
- conn.getString("isPaused"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isPaused()",
- conn.getString("isRunning"));
- connections.addElement(connection);
-
- isPaused.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isPaused);
- } catch (Exception e) { throw new Error("isPaused:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.String.class ;
- MethodDescriptor setText = new MethodDescriptor(beanClass.getMethod("setText", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "String", "",
- "%name%.setText(%arg%);",
- conn.getString("setText"));
- connections.addElement(connection);
-
- setText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setText);
- } catch (Exception e) { throw new Error("setText:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getText = new MethodDescriptor(beanClass.getMethod("getText", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "String", "",
- "%name%.getText()",
- conn.getString("getText"));
- connections.addElement(connection);
-
- getText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getText);
- } catch (Exception e) { throw new Error("getText:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setPaused = new MethodDescriptor(beanClass.getMethod("setPaused", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setPaused(true);",
- conn.getString("setPaused"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setPaused(false);",
- conn.getString("setPausedResume"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setPaused(%arg%);",
- conn.getString("setPausedCondition"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setPaused(!%name%.isPaused());",
- conn.getString("setPausedToggle"));
- connections.addElement(connection);
-
- setPaused.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setPaused);
- } catch (Exception e) { throw new Error("setPaused:: " + 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("text", beanClass);
- defProperty.setBound(true);
- defProperty.setConstrained(true);
- defProperty.setDisplayName(prop.getString("text"));
-
- PropertyDescriptor paused = new PropertyDescriptor("paused", beanClass);
- paused.setBound(true);
- paused.setConstrained(true);
- paused.setDisplayName(prop.getString("paused"));
-
- PropertyDescriptor[] rv = {
- defProperty,
- paused};
- 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 = NervousText.class;
-
- } // end of class NervousTextBeanInfo