home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1999 February / CDW0299.iso / Demos / Cafe / Source.bin / ScrollingTextBeanInfo.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  14.0 KB  |  382 lines

  1. package symantec.itools.multimedia;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. /**
  8.  * BeanInfo for ScrollingText.
  9.  *
  10.  */
  11.  
  12. public class ScrollingTextBeanInfo extends SimpleBeanInfo {
  13.  
  14.     /**
  15.      * Constructs a ScrollingTextBeanInfo object.
  16.      */
  17.     public ScrollingTextBeanInfo() {
  18.     }
  19.  
  20.     /**
  21.      * Gets a BeanInfo for the superclass of this bean.
  22.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  23.      */
  24.     public BeanInfo[] getAdditionalBeanInfo() {
  25.         try {
  26.             BeanInfo[] bi = new BeanInfo[1];
  27.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  28.             return bi;
  29.         }
  30.         catch (IntrospectionException e) { throw new Error(e.toString());}
  31.     }
  32.  
  33.     /**
  34.      * Gets the SymantecBeanDescriptor for this bean.
  35.      * @return an object of type SymantecBeanDescriptor
  36.      * @see symantec.itools.beans.SymantecBeanDescriptor
  37.      */
  38.     public BeanDescriptor getBeanDescriptor() {
  39.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  40.         String s=group.getString("GroupMultimedia"); 
  41.  
  42.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  43.         bd.setFolder(s);
  44.         bd.setToolbar(s);
  45.         bd.setWinHelp("0x12397");
  46.  
  47.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  48.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  49.                                                 "%name%.SCROLL_LEFT",
  50.                                                 conn.getString("SCROLL_LEFT")));
  51.  
  52.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  53.                                                 "%name%.SCROLL_RIGHT",
  54.                                                 conn.getString("SCROLL_RIGHT")));
  55.  
  56.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
  57.                                                 "symantec.itools.util.GeneralUtils.frameTarget_self",
  58.                                                 conn.getString("_self")));
  59.  
  60.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
  61.                                                 "symantec.itools.util.GeneralUtils.frameTarget_parent",
  62.                                                 conn.getString("_parent")));
  63.  
  64.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
  65.                                                 "symantec.itools.util.GeneralUtils.frameTarget_top",
  66.                                                 conn.getString("_top")));
  67.  
  68.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
  69.                                                 "symantec.itools.util.GeneralUtils.frameTarget_blank",
  70.                                                 conn.getString("_blank")));
  71.  
  72.  
  73.         return (BeanDescriptor) bd;
  74.     }
  75.  
  76.     /**
  77.      * Gets an image that may be used to visually represent this bean
  78.      * (in the toolbar, on a form, etc).
  79.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  80.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  81.      * @return an image for this bean, always color even if requested monochrome
  82.      * @see BeanInfo#ICON_MONO_16x16
  83.      * @see BeanInfo#ICON_COLOR_16x16
  84.      * @see BeanInfo#ICON_MONO_32x32
  85.      * @see BeanInfo#ICON_COLOR_32x32
  86.      */
  87.     public java.awt.Image getIcon(int iconKind) {
  88.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  89.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  90.             java.awt.Image img = loadImage("ScrollingTextC16.gif");
  91.             return img;
  92.         }
  93.  
  94.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  95.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  96.             java.awt.Image img = loadImage("ScrollingTextC32.gif");
  97.             return img;
  98.         }
  99.  
  100.         return null;
  101.     }
  102.  
  103.     /**
  104.      * Gets an array of descriptions of the methods used for "connections" by
  105.      * Visual CafΘ's Interaction Wizard.
  106.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  107.      * @return method descriptions for this bean
  108.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  109.      */
  110.     public MethodDescriptor[] getMethodDescriptors() {
  111.         Class[] args;
  112.         ConnectionDescriptor connection;
  113.         java.util.Vector connections;
  114.         java.util.Vector md = new java.util.Vector();
  115.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  116.  
  117.         try{
  118.             args = new Class[1];
  119.             args[0] = java.lang.Integer.TYPE ;
  120.             MethodDescriptor setScrollInterval = new MethodDescriptor(beanClass.getMethod("setScrollInterval", args));
  121.  
  122.             connections = new java.util.Vector();
  123.             connection = new ConnectionDescriptor("input", "int", "",
  124.                                     "%name%.setScrollInterval(%arg%);",
  125.                                     conn.getString("setScrollInterval"));
  126.             connections.addElement(connection);
  127.  
  128.             setScrollInterval.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  129.             md.addElement(setScrollInterval);
  130.         } catch (Exception e) { throw new Error("setScrollInterval:: " + e.toString()); }
  131.  
  132.         try{
  133.             args = null;
  134.             MethodDescriptor stopScrollingText = new MethodDescriptor(beanClass.getMethod("stopScrollingText", args));
  135.  
  136.             connections = new java.util.Vector();
  137.             connection = new ConnectionDescriptor("input", "void", "",
  138.                                     "%name%.stopScrollingText();",
  139.                                     conn.getString("stopScrollingText"));
  140.             connections.addElement(connection);
  141.  
  142.             stopScrollingText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  143.             md.addElement(stopScrollingText);
  144.         } catch (Exception e) { throw new Error("stopScrollingText:: " + e.toString()); }
  145.  
  146.         try{
  147.             args = null;
  148.             MethodDescriptor show = new MethodDescriptor(beanClass.getMethod("show", args));
  149.  
  150.             connections = new java.util.Vector();
  151.             connection = new ConnectionDescriptor("input", "void", "",
  152.                                     "%name%.show();",
  153.                                     conn.getString("show"));
  154.             connections.addElement(connection);
  155.  
  156.             show.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  157.             md.addElement(show);
  158.         } catch (Exception e) { throw new Error("show:: " + e.toString()); }
  159.  
  160.         try{
  161.             args = null;
  162.             MethodDescriptor getHiliteColor = new MethodDescriptor(beanClass.getMethod("getHiliteColor", args));
  163.  
  164.             connections = new java.util.Vector();
  165.             connection = new ConnectionDescriptor("output", "Color", "",
  166.                                     "%name%.getHiliteColor()",
  167.                                     conn.getString("getHiliteColor"));
  168.             connections.addElement(connection);
  169.  
  170.             getHiliteColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  171.             md.addElement(getHiliteColor);
  172.         } catch (Exception e) { throw new Error("getHiliteColor:: " + e.toString()); }
  173.  
  174.         try{
  175.             args = null;
  176.             MethodDescriptor getScrollInterval = new MethodDescriptor(beanClass.getMethod("getScrollInterval", args));
  177.  
  178.             connections = new java.util.Vector();
  179.             connection = new ConnectionDescriptor("output", "int", "",
  180.                                     "%name%.getScrollInterval()",
  181.                                     conn.getString("getScrollInterval"));
  182.             connections.addElement(connection);
  183.  
  184.             getScrollInterval.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  185.             md.addElement(getScrollInterval);
  186.         } catch (Exception e) { throw new Error("getScrollInterval:: " + e.toString()); }
  187.  
  188.         try{
  189.             args = new Class[1];
  190.             args[0] = java.lang.Integer.TYPE ;
  191.             MethodDescriptor setScrollDirection = new MethodDescriptor(beanClass.getMethod("setScrollDirection", args));
  192.  
  193.             connections = new java.util.Vector();
  194.             connection = new ConnectionDescriptor("input", "int", "",
  195.                                     "%name%.setScrollDirection(%arg%);",
  196.                                     conn.getString("setScrollDirection"));
  197.             connections.addElement(connection);
  198.  
  199.             setScrollDirection.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  200.             md.addElement(setScrollDirection);
  201.         } catch (Exception e) { throw new Error("setScrollDirection:: " + e.toString()); }
  202.  
  203.         try{
  204.             args = null;
  205.             MethodDescriptor hide = new MethodDescriptor(beanClass.getMethod("hide", args));
  206.  
  207.             connections = new java.util.Vector();
  208.             connection = new ConnectionDescriptor("input", "void", "",
  209.                                     "%name%.hide();",
  210.                                     conn.getString("hide"));
  211.             connections.addElement(connection);
  212.  
  213.             hide.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  214.             md.addElement(hide);
  215.         } catch (Exception e) { throw new Error("hide:: " + e.toString()); }
  216.  
  217.         try{
  218.             args = new Class[1];
  219.             args[0] = java.lang.Integer.TYPE ;
  220.             MethodDescriptor setScrollUnit = new MethodDescriptor(beanClass.getMethod("setScrollUnit", args));
  221.  
  222.             connections = new java.util.Vector();
  223.             connection = new ConnectionDescriptor("input", "int", "",
  224.                                     "%name%.setScrollUnit(%arg%);",
  225.                                     conn.getString("setScrollUnit"));
  226.             connections.addElement(connection);
  227.  
  228.             setScrollUnit.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  229.             md.addElement(setScrollUnit);
  230.         } catch (Exception e) { throw new Error("setScrollUnit:: " + e.toString()); }
  231.  
  232.         try{
  233.             args = new Class[1];
  234.             args[0] = java.awt.Color.class ;
  235.             MethodDescriptor setHiliteColor = new MethodDescriptor(beanClass.getMethod("setHiliteColor", args));
  236.  
  237.             connections = new java.util.Vector();
  238.             connection = new ConnectionDescriptor("input", "Color", "",
  239.                                     "%name%.setHiliteColor(%arg%);",
  240.                                     conn.getString("setHiliteColor"));
  241.             connections.addElement(connection);
  242.  
  243.             setHiliteColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  244.             md.addElement(setHiliteColor);
  245.         } catch (Exception e) { throw new Error("setHiliteColor:: " + e.toString()); }
  246.  
  247.         try{
  248.             args = null;
  249.             MethodDescriptor getScrollDirection = new MethodDescriptor(beanClass.getMethod("getScrollDirection", args));
  250.  
  251.             connections = new java.util.Vector();
  252.             connection = new ConnectionDescriptor("output", "int", "",
  253.                                     "%name%.getScrollDirection()",
  254.                                     conn.getString("getScrollDirection"));
  255.             connections.addElement(connection);
  256.  
  257.             getScrollDirection.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  258.             md.addElement(getScrollDirection);
  259.         } catch (Exception e) { throw new Error("getScrollDirection:: " + e.toString()); }
  260.  
  261.         try{
  262.             args = null;
  263.             MethodDescriptor startScrollingText = new MethodDescriptor(beanClass.getMethod("startScrollingText", args));
  264.  
  265.             connections = new java.util.Vector();
  266.             connection = new ConnectionDescriptor("input", "void", "",
  267.                                     "%name%.startScrollingText();",
  268.                                     conn.getString("startScrollingText"));
  269.             connections.addElement(connection);
  270.  
  271.             startScrollingText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  272.             md.addElement(startScrollingText);
  273.         } catch (Exception e) { throw new Error("startScrollingText:: " + e.toString()); }
  274.  
  275.         try{
  276.             args = new Class[1];
  277.             args[0] = java.lang.String.class ;
  278.             MethodDescriptor setFrame = new MethodDescriptor(beanClass.getMethod("setFrame", args));
  279.  
  280.             connections = new java.util.Vector();
  281.             connection = new ConnectionDescriptor("input", "String", "",
  282.                                     "%name%.setFrame(%arg%);",
  283.                                     conn.getString("setFrameST"));
  284.             connections.addElement(connection);
  285.  
  286.             setFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  287.             md.addElement(setFrame);
  288.         } catch (Exception e) { throw new Error("setFrame:: " + e.toString()); }
  289.  
  290.         try{
  291.             args = null;
  292.             MethodDescriptor getFrame = new MethodDescriptor(beanClass.getMethod("getFrame", args));
  293.  
  294.             connections = new java.util.Vector();
  295.             connection = new ConnectionDescriptor("output", "String", "",
  296.                                     "%name%.getFrame()",
  297.                                     conn.getString("getFrameST"));
  298.             connections.addElement(connection);
  299.  
  300.             getFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  301.             md.addElement(getFrame);
  302.         } catch (Exception e) { throw new Error("getFrame:: " + e.toString()); }
  303.  
  304.         try{
  305.             args = null;
  306.             MethodDescriptor getScrollUnit = new MethodDescriptor(beanClass.getMethod("getScrollUnit", args));
  307.  
  308.             connections = new java.util.Vector();
  309.             connection = new ConnectionDescriptor("output", "int", "",
  310.                                     "%name%.getScrollUnit()",
  311.                                     conn.getString("getScrollUnit"));
  312.             connections.addElement(connection);
  313.  
  314.             getScrollUnit.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  315.             md.addElement(getScrollUnit);
  316.         } catch (Exception e) { throw new Error("getScrollUnit:: " + e.toString()); }
  317.  
  318.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  319.         md.copyInto(rv);
  320.  
  321.         return rv;
  322.     }
  323.  
  324.     /**
  325.      * Returns descriptions of this bean's properties.
  326.      */
  327.     public PropertyDescriptor[] getPropertyDescriptors() {
  328.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  329.  
  330.         try{
  331.         PropertyDescriptor scrollInterval = new PropertyDescriptor("scrollInterval", beanClass);
  332.         scrollInterval.setBound(true);
  333.         scrollInterval.setConstrained(true);
  334.         scrollInterval.setDisplayName(prop.getString("scrollInterval"));
  335.  
  336.         PropertyDescriptor scrollUnit = new PropertyDescriptor("scrollUnit", beanClass);
  337.         scrollUnit.setBound(true);
  338.         scrollUnit.setConstrained(true);
  339.         scrollUnit.setDisplayName(prop.getString("scrollUnit"));
  340.  
  341.         PropertyDescriptor scrollDirection = new PropertyDescriptor("scrollDirection", beanClass);
  342.         scrollDirection.setBound(true);
  343.         scrollDirection.setConstrained(true);
  344.         scrollDirection.setDisplayName(prop.getString("scrollDirection"));
  345.         scrollDirection.setValue("ENUMERATION", "SCROLL_LEFT=0, SCROLL_RIGHT=1");
  346.  
  347.         PropertyDescriptor hiliteColor = new PropertyDescriptor("hiliteColor", beanClass);
  348.         hiliteColor.setBound(true);
  349.         hiliteColor.setConstrained(true);
  350.         hiliteColor.setDisplayName(prop.getString("hiliteColor"));
  351.  
  352.         PropertyDescriptor messageList = new PropertyDescriptor("messageList", beanClass);
  353.         messageList.setBound(true);
  354.         messageList.setConstrained(true);
  355.         messageList.setDisplayName(prop.getString("messageList"));
  356.  
  357.         PropertyDescriptor linkToList = new PropertyDescriptor("linkToList", beanClass);
  358.         linkToList.setBound(true);
  359.         linkToList.setConstrained(true);
  360.         linkToList.setDisplayName(prop.getString("linkToList"));
  361.         linkToList.setValue("URLFILTER", prop.getString("webURLFILTER"));
  362.  
  363.         PropertyDescriptor frame = new PropertyDescriptor("frame", beanClass);
  364.         frame.setBound(true);
  365.         frame.setConstrained(true);
  366.         frame.setDisplayName(prop.getString("frame"));
  367.  
  368.         PropertyDescriptor[] rv = {
  369.             scrollInterval,
  370.             scrollUnit,
  371.             scrollDirection,
  372.             hiliteColor,
  373.             messageList,
  374.             linkToList,
  375.             frame};
  376.         return rv;
  377.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  378.     }
  379.  
  380.     private final static Class beanClass = ScrollingText.class;
  381.  
  382.     }    //  end of class ScrollingTextBeanInfo