home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 11.2 KB | 320 lines |
- package symantec.itools.multimedia;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 08/30/97 LAB Removed extraneous semicolon in getImageList interacion (Addresses Mac Bug #7672).
-
- /**
- * BeanInfo for Animator.
- *
- */
-
- public class AnimatorBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a AnimatorBeanInfo object.
- */
- public AnimatorBeanInfo() {
- }
-
- /**
- * 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("0x1239D");
-
- 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("AnimatorC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("AnimatorC32.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 = new Class[1];
- args[0] = java.net.URL.class ;
- MethodDescriptor addImage = new MethodDescriptor(beanClass.getMethod("addImage", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "URL", "",
- "%name%.addImage(%arg%);",
- conn.getString("addImageURL"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "RelativeURL", "",
- "%name%.addImage(symantec.itools.net.RelativeURL.getURL(%arg%));",
- conn.getString("addImageName"));
- connections.addElement(connection);
-
- addImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(addImage);
- } catch (Exception e) { throw new Error("addImage:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setClearFrame = new MethodDescriptor(beanClass.getMethod("setClearFrame", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setClearFrame(true);",
- conn.getString("setClearFrameTrue"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setClearFrame(false);",
- conn.getString("setClearFrameFalse"));
- connections.addElement(connection);
-
- setClearFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setClearFrame);
- } catch (Exception e) { throw new Error("setClearFrame:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getNumLoops = new MethodDescriptor(beanClass.getMethod("getNumLoops", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getNumLoops()",
- conn.getString("getNumLoops"));
- connections.addElement(connection);
-
- getNumLoops.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getNumLoops);
- } catch (Exception e) { throw new Error("getNumLoops:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor startAnimation = new MethodDescriptor(beanClass.getMethod("startAnimation", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.startAnimation();",
- conn.getString("startAnimation"));
- connections.addElement(connection);
-
- startAnimation.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(startAnimation);
- } catch (Exception e) { throw new Error("startAnimation:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor stopAnimation = new MethodDescriptor(beanClass.getMethod("stopAnimation", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.stopAnimation();",
- conn.getString("stopAnimation"));
- connections.addElement(connection);
-
- stopAnimation.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(stopAnimation);
- } catch (Exception e) { throw new Error("stopAnimation:: " + 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 = new Class[1];
- args[0] = java.net.URL[].class ;
- MethodDescriptor setImageList = new MethodDescriptor(beanClass.getMethod("setImageList", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "URL[]", "",
- "%name%.setImageList(%arg%);",
- conn.getString("setImageList"));
- connections.addElement(connection);
-
- setImageList.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setImageList);
- } catch (Exception e) { throw new Error("setImageList:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setNumLoops = new MethodDescriptor(beanClass.getMethod("setNumLoops", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setNumLoops(%arg%);",
- conn.getString("setNumLoops"));
- connections.addElement(connection);
-
- setNumLoops.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setNumLoops);
- } catch (Exception e) { throw new Error("setNumLoops:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setRepeatMode = new MethodDescriptor(beanClass.getMethod("setRepeatMode", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setRepeatMode(%arg%);",
- conn.getString("setRepeatMode"));
- connections.addElement(connection);
-
- setRepeatMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setRepeatMode);
- } catch (Exception e) { throw new Error("setRepeatMode:: " + 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 getImageList = new MethodDescriptor(beanClass.getMethod("getImageList", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "URL[]", "",
- "%name%.getImageList()",
- conn.getString("getImageList"));
- connections.addElement(connection);
-
- getImageList.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getImageList);
- } catch (Exception e) { throw new Error("getImageList:: " + 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 delay = new PropertyDescriptor("delay", beanClass);
- delay.setBound(true);
- delay.setConstrained(true);
- delay.setDisplayName(prop.getString("delay"));
-
- PropertyDescriptor numLoops = new PropertyDescriptor("numLoops", beanClass);
- numLoops.setBound(true);
- numLoops.setConstrained(true);
- numLoops.setDisplayName(prop.getString("numLoops"));
-
- PropertyDescriptor repeatMode = new PropertyDescriptor("repeatMode", beanClass);
- repeatMode.setBound(true);
- repeatMode.setConstrained(true);
- repeatMode.setDisplayName(prop.getString("repeatMode"));
-
- PropertyDescriptor imageList = new PropertyDescriptor("imageList", beanClass);
- imageList.setBound(true);
- imageList.setConstrained(true);
- imageList.setDisplayName(prop.getString("imageList"));
- imageList.setValue("URLFILTER", prop.getString("imageURLFILTER"));
-
- PropertyDescriptor clearFrame = new PropertyDescriptor("clearFrame", beanClass);
- clearFrame.setBound(true);
- clearFrame.setConstrained(true);
- clearFrame.setDisplayName(prop.getString("clearFrame"));
-
- PropertyDescriptor previewMode = new PropertyDescriptor("previewMode", beanClass);
- previewMode.setBound(true);
- previewMode.setConstrained(false);
- previewMode.setDisplayName(prop.getString("previewMode"));
-
- PropertyDescriptor[] rv = {
- delay,
- numLoops,
- repeatMode,
- imageList,
- clearFrame,
- previewMode};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = Animator.class;
-
- } // end of class AnimatorBeanInfo