home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 8.6 KB | 257 lines |
- package symantec.itools.multimedia;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- /**
- * BeanInfo for SoundPlayer.
- *
- */
-
- public class SoundPlayerBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a SoundPlayerBeanInfo object.
- */
- public SoundPlayerBeanInfo() {
- }
-
- /**
- * 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.setFlags("invisible");
- bd.setWinHelp("0x1238D");
- bd.setFolder(s);
- bd.setToolbar(s);
-
- 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("SoundPlayerC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("SoundPlayerC32.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.lang.String.class ;
- MethodDescriptor addStringURL = new MethodDescriptor(beanClass.getMethod("addStringURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "String", "",
- "%name%.addStringURL(%arg%);",
- conn.getString("addStringURL"));
- connections.addElement(connection);
-
- addStringURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(addStringURL);
- } catch (Exception e) { throw new Error("addStringURL:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getRepeat = new MethodDescriptor(beanClass.getMethod("getRepeat", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getRepeat()",
- conn.getString("getRepeat"));
- connections.addElement(connection);
-
- getRepeat.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getRepeat);
- } catch (Exception e) { throw new Error("getRepeat:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isSyncMode = new MethodDescriptor(beanClass.getMethod("isSyncMode", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isSyncMode()",
- conn.getString("isSyncMode"));
- connections.addElement(connection);
-
- isSyncMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isSyncMode);
- } catch (Exception e) { throw new Error("isSyncMode:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setSyncMode = new MethodDescriptor(beanClass.getMethod("setSyncMode", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setSyncMode(%arg%);",
- conn.getString("setSyncMode"));
- connections.addElement(connection);
-
- setSyncMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setSyncMode);
- } catch (Exception e) { throw new Error("setSyncMode:: " + 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("stopSP"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.stop(%arg%);",
- conn.getString("stopSPDelay"));
- 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.Integer.TYPE ;
- MethodDescriptor setRepeat = new MethodDescriptor(beanClass.getMethod("setRepeat", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setRepeat(%arg%);",
- conn.getString("setRepeatSP"));
- connections.addElement(connection);
-
- setRepeat.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setRepeat);
- } catch (Exception e) { throw new Error("setRepeat:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor play = new MethodDescriptor(beanClass.getMethod("play", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.play();",
- conn.getString("play"));
- connections.addElement(connection);
-
- play.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(play);
- } catch (Exception e) { throw new Error("play:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.net.URL.class ;
- MethodDescriptor addURL = new MethodDescriptor(beanClass.getMethod("addURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "RelativeURL", "",
- "%name%.addURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
- conn.getString("addURLRelative"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "URL", "",
- "%name%.addURL(%arg%);",
- conn.getString("addURL"));
- connections.addElement(connection);
-
- addURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(addURL);
- } catch (Exception e) { throw new Error("addURL:: " + 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 syncMode = new PropertyDescriptor("syncMode", beanClass);
- syncMode.setBound(true);
- syncMode.setConstrained(true);
- syncMode.setDisplayName(prop.getString("syncMode"));
-
- PropertyDescriptor repeat = new PropertyDescriptor("repeat", beanClass);
- repeat.setBound(true);
- repeat.setConstrained(true);
- repeat.setDisplayName(prop.getString("repeatSP"));
-
- PropertyDescriptor uRLList = new PropertyDescriptor("uRLList", beanClass);
- uRLList.setBound(true);
- uRLList.setConstrained(true);
- uRLList.setDisplayName(prop.getString("uRLList"));
- uRLList.setValue("URLFILTER", prop.getString("soundURLFILTER"));
-
- PropertyDescriptor[] rv = {
- syncMode,
- repeat,
- uRLList};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = SoundPlayer.class;
-
- } // end of class SoundPlayerBeanInfo