home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Main.bin / RollOverButtonBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  16KB  |  437 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  08/25/97    LAB    Obeject name was left out of some interactions (Addresses Mac Bug #7253)
  8. //  09/07/97    LAB    Fixed misspelling of descriptions.
  9. //    09/19/97    RKM    Fixed connections that called deprecated methods
  10. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  11.  
  12. /**
  13.  * BeanInfo for RollOverButton.
  14.  *
  15.  */
  16. public class RollOverButtonBeanInfo extends SimpleBeanInfo {
  17.  
  18.     /**
  19.      * Constructs a RollOverButtonBeanInfo object.
  20.      */
  21.     public RollOverButtonBeanInfo() {
  22.     }
  23.  
  24.     /**
  25.      * Gets a BeanInfo for the superclass of this bean.
  26.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  27.      */
  28.     public BeanInfo[] getAdditionalBeanInfo() {
  29.         try {
  30.             BeanInfo[] bi = new BeanInfo[1];
  31.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  32.             return bi;
  33.         }
  34.         catch (IntrospectionException e) { throw new Error(e.toString());}
  35.     }
  36.  
  37.     /**
  38.      * Gets the SymantecBeanDescriptor for this bean.
  39.      * @return an object of type SymantecBeanDescriptor
  40.      * @see symantec.itools.beans.SymantecBeanDescriptor
  41.      */
  42.     public BeanDescriptor getBeanDescriptor() {
  43.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  44.         String s=group.getString("GroupAWTAdditions"); 
  45.  
  46.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  47.         bd.setFolder(s);
  48.         bd.setWinHelp("0x123B1");
  49.  
  50.         return (BeanDescriptor) bd;
  51.     }
  52.  
  53.     /**
  54.      * Gets an image that may be used to visually represent this bean
  55.      * (in the toolbar, on a form, etc).
  56.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  57.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  58.      * @return an image for this bean, always color even if requested monochrome
  59.      * @see BeanInfo#ICON_MONO_16x16
  60.      * @see BeanInfo#ICON_COLOR_16x16
  61.      * @see BeanInfo#ICON_MONO_32x32
  62.      * @see BeanInfo#ICON_COLOR_32x32
  63.      */
  64.     public java.awt.Image getIcon(int iconKind) {
  65.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  66.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  67.             java.awt.Image img = loadImage("RollOverButtonC16.gif");
  68.             return img;
  69.         }
  70.  
  71.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  72.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  73.             java.awt.Image img = loadImage("RollOverButtonC32.gif");
  74.             return img;
  75.         }
  76.  
  77.         return null;
  78.     }
  79.  
  80.     /**
  81.      * Gets an array of descriptions of the methods used for "connections" by
  82.      * Visual CafΘ's Interaction Wizard.
  83.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  84.      * @return method descriptions for this bean
  85.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  86.      */
  87.     public MethodDescriptor[] getMethodDescriptors() {
  88.         Class[] args;
  89.         ConnectionDescriptor connection;
  90.         java.util.Vector connections;
  91.         java.util.Vector md = new java.util.Vector();
  92.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  93.  
  94.         try{
  95.             args = new Class[1];
  96.             args[0] = java.net.URL.class ;
  97.             MethodDescriptor setOverURL = new MethodDescriptor(beanClass.getMethod("setOverURL", args));
  98.  
  99.             connections = new java.util.Vector();
  100.             connection = new ConnectionDescriptor("input", "RelativeURL", "",
  101.                                     "%name%.setOverURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
  102.                                     conn.getString("setOverURL"));
  103.             connections.addElement(connection);
  104.  
  105.             setOverURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  106.             md.addElement(setOverURL);
  107.         } catch (Exception e) { throw new Error("setOverURL:: " + e.toString()); }
  108.  
  109.         try{
  110.             args = new Class[1];
  111.             args[0] = java.awt.Image.class ;
  112.             MethodDescriptor setDownImage = new MethodDescriptor(beanClass.getMethod("setDownImage", args));
  113.  
  114.             connections = new java.util.Vector();
  115.             connection = new ConnectionDescriptor("input", "Image", "",
  116.                                     "%name%.setDownImage(%arg%);",
  117.                                     conn.getString("setDownImage"));
  118.             connections.addElement(connection);
  119.  
  120.             setDownImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  121.             md.addElement(setDownImage);
  122.         } catch (Exception e) { throw new Error("setDownImage:: " + e.toString()); }
  123.  
  124.         try{
  125.             args = new Class[1];
  126.             args[0] = java.net.URL.class ;
  127.             MethodDescriptor setStandardURL = new MethodDescriptor(beanClass.getMethod("setStandardURL", args));
  128.  
  129.             connections = new java.util.Vector();
  130.             connection = new ConnectionDescriptor("input", "RelativeURL", "",
  131.                                     "%name%.setStandardURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
  132.                                     conn.getString("setStandardURL"));
  133.             connections.addElement(connection);
  134.  
  135.             setStandardURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  136.             md.addElement(setStandardURL);
  137.         } catch (Exception e) { throw new Error("setStandardURL:: " + e.toString()); }
  138.  
  139.         try{
  140.             args = new Class[1];
  141.             args[0] = java.net.URL.class ;
  142.             MethodDescriptor setDownURL = new MethodDescriptor(beanClass.getMethod("setDownURL", args));
  143.  
  144.             connections = new java.util.Vector();
  145.             connection = new ConnectionDescriptor("input", "RelativeURL", "",
  146.                                     "%name%.setDownURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
  147.                                     conn.getString("setDownURL"));
  148.             connections.addElement(connection);
  149.  
  150.             setDownURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  151.             md.addElement(setDownURL);
  152.         } catch (Exception e) { throw new Error("setDownURL:: " + e.toString()); }
  153.  
  154.         try{
  155.             args = new Class[1];
  156.             args[0] = java.lang.Boolean.TYPE ;
  157.             MethodDescriptor setClearFrame = new MethodDescriptor(beanClass.getMethod("setClearFrame", args));
  158.  
  159.             connections = new java.util.Vector();
  160.             connection = new ConnectionDescriptor("input", "void", "",
  161.                                     "%name%.setClearFrame(true);",
  162.                                     conn.getString("setClearFrameTrue"));
  163.             connections.addElement(connection);
  164.  
  165.             connection = new ConnectionDescriptor("input", "void", "",
  166.                                     "%name%.setClearFrame(false);",
  167.                                     conn.getString("setClearFrameFalse"));
  168.             connections.addElement(connection);
  169.  
  170.             connection = new ConnectionDescriptor("input", "void", "",
  171.                                     "%name%.setClearFrame(!%name%.isClearFrame());",
  172.                                     conn.getString("setClearFrameToggle"));
  173.             connections.addElement(connection);
  174.  
  175.             connection = new ConnectionDescriptor("input", "boolean", "",
  176.                                     "%name%.setClearFrame(%arg%);",
  177.                                     conn.getString("setClearFrameValue"));
  178.             connections.addElement(connection);
  179.  
  180.             setClearFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  181.             md.addElement(setClearFrame);
  182.         } catch (Exception e) { throw new Error("setClearFrame:: " + e.toString()); }
  183.  
  184.         try{
  185.             args = null;
  186.             MethodDescriptor getOverImage = new MethodDescriptor(beanClass.getMethod("getOverImage", args));
  187.  
  188.             connections = new java.util.Vector();
  189.             connection = new ConnectionDescriptor("output", "Image", "",
  190.                                     "%name%.getOverImage()",
  191.                                     conn.getString("getOverImage"));
  192.             connections.addElement(connection);
  193.  
  194.             getOverImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  195.             md.addElement(getOverImage);
  196.         } catch (Exception e) { throw new Error("getOverImage:: " + e.toString()); }
  197.  
  198.         try{
  199.             args = new Class[1];
  200.             args[0] = java.awt.Image.class ;
  201.             MethodDescriptor setOverImage = new MethodDescriptor(beanClass.getMethod("setOverImage", args));
  202.  
  203.             connections = new java.util.Vector();
  204.             connection = new ConnectionDescriptor("input", "Image", "",
  205.                                     "%name%.setOverImage(%arg%);",
  206.                                     conn.getString("setOverImage"));
  207.             connections.addElement(connection);
  208.  
  209.             setOverImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  210.             md.addElement(setOverImage);
  211.         } catch (Exception e) { throw new Error("setOverImage:: " + e.toString()); }
  212.  
  213.         try{
  214.             args = new Class[1];
  215.             args[0] = java.lang.Boolean.TYPE ;
  216.             MethodDescriptor setCenterMode = new MethodDescriptor(beanClass.getMethod("setCenterMode", args));
  217.  
  218.             connections = new java.util.Vector();
  219.             connection = new ConnectionDescriptor("input", "void", "",
  220.                                     "%name%.setCenterMode(true);",
  221.                                     conn.getString("setCenterModeTrue"));
  222.             connections.addElement(connection);
  223.  
  224.             connection = new ConnectionDescriptor("input", "void", "",
  225.                                     "%name%.setCenterMode(false);",
  226.                                     conn.getString("setCenterModeFalse"));
  227.             connections.addElement(connection);
  228.  
  229.             connection = new ConnectionDescriptor("input", "void", "",
  230.                                     "%name%.setCenterMode(!%name%.isCenterMode());",
  231.                                     conn.getString("setCenterModeToggle"));
  232.             connections.addElement(connection);
  233.  
  234.             connection = new ConnectionDescriptor("input", "boolean", "",
  235.                                     "%name%.setCenterMode(%arg%);",
  236.                                     conn.getString("setCenterModeValue"));
  237.             connections.addElement(connection);
  238.  
  239.             setCenterMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  240.             md.addElement(setCenterMode);
  241.         } catch (Exception e) { throw new Error("setCenterMode:: " + e.toString()); }
  242.  
  243.         try{
  244.             args = null;
  245.             MethodDescriptor getURL = new MethodDescriptor(beanClass.getMethod("getURL", args));
  246.  
  247.             connections = new java.util.Vector();
  248.             connection = new ConnectionDescriptor("output", "URL", "",
  249.                                     "%name%.getURL()",
  250.                                     conn.getString("getURL"));
  251.             connections.addElement(connection);
  252.  
  253.             getURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  254.             md.addElement(getURL);
  255.         } catch (Exception e) { throw new Error("getURL:: " + e.toString()); }
  256.  
  257.         try{
  258.             args = new Class[1];
  259.             args[0] = java.net.URL.class ;
  260.             MethodDescriptor setURL = new MethodDescriptor(beanClass.getMethod("setURL", args));
  261.  
  262.             connections = new java.util.Vector();
  263.             connection = new ConnectionDescriptor("input", "RelativeURL", "",
  264.                                     "%name%.setURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
  265.                                     conn.getString("setURLRelative"));
  266.             connections.addElement(connection);
  267.  
  268.             connection = new ConnectionDescriptor("input", "URL", "",
  269.                                     "%name%.setURL(%arg%);",
  270.                                     conn.getString("setURL"));
  271.             connections.addElement(connection);
  272.  
  273.             setURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  274.             md.addElement(setURL);
  275.         } catch (Exception e) { throw new Error("setURL:: " + e.toString()); }
  276.  
  277.         try{
  278.             args = new Class[1];
  279.             args[0] = java.lang.String.class ;
  280.             MethodDescriptor setFrame = new MethodDescriptor(beanClass.getMethod("setFrame", args));
  281.  
  282.             connections = new java.util.Vector();
  283.             connection = new ConnectionDescriptor("input", "String", "",
  284.                                     "%name%.setFrame(%arg%);",
  285.                                     conn.getString("setFrame"));
  286.             connections.addElement(connection);
  287.  
  288.             setFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  289.             md.addElement(setFrame);
  290.         } catch (Exception e) { throw new Error("setFrame:: " + e.toString()); }
  291.  
  292.         try{
  293.             args = null;
  294.             MethodDescriptor isClearFrame = new MethodDescriptor(beanClass.getMethod("isClearFrame", args));
  295.  
  296.             connections = new java.util.Vector();
  297.             connection = new ConnectionDescriptor("output", "boolean", "",
  298.                                     "%name%.isClearFrame()",
  299.                                     conn.getString("isClearFrame"));
  300.             connections.addElement(connection);
  301.  
  302.             isClearFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  303.             md.addElement(isClearFrame);
  304.         } catch (Exception e) { throw new Error("isClearFrame:: " + e.toString()); }
  305.  
  306.         try{
  307.             args = null;
  308.             MethodDescriptor isCenterMode = new MethodDescriptor(beanClass.getMethod("isCenterMode", args));
  309.  
  310.             connections = new java.util.Vector();
  311.             connection = new ConnectionDescriptor("output", "boolean", "",
  312.                                     "%name%.isCenterMode()",
  313.                                     conn.getString("isCenterMode"));
  314.             connections.addElement(connection);
  315.  
  316.             isCenterMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  317.             md.addElement(isCenterMode);
  318.         } catch (Exception e) { throw new Error("isCenterMode:: " + e.toString()); }
  319.  
  320.         try{
  321.             args = null;
  322.             MethodDescriptor getDownImage = new MethodDescriptor(beanClass.getMethod("getDownImage", args));
  323.  
  324.             connections = new java.util.Vector();
  325.             connection = new ConnectionDescriptor("output", "Image", "",
  326.                                     "%name%.getDownImage()",
  327.                                     conn.getString("getDownImage"));
  328.             connections.addElement(connection);
  329.  
  330.             getDownImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  331.             md.addElement(getDownImage);
  332.         } catch (Exception e) { throw new Error("getDownImage:: " + e.toString()); }
  333.  
  334.         try{
  335.             args = null;
  336.             MethodDescriptor getFrame = new MethodDescriptor(beanClass.getMethod("getFrame", args));
  337.  
  338.             connections = new java.util.Vector();
  339.             connection = new ConnectionDescriptor("output", "String", "",
  340.                                     "%name%.getFrame()",
  341.                                     conn.getString("getFrame"));
  342.             connections.addElement(connection);
  343.  
  344.             getFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  345.             md.addElement(getFrame);
  346.         } catch (Exception e) { throw new Error("getFrame:: " + e.toString()); }
  347.  
  348.         try{
  349.             args = new Class[1];
  350.             args[0] = java.awt.Image.class ;
  351.             MethodDescriptor setStandardImage = new MethodDescriptor(beanClass.getMethod("setStandardImage", args));
  352.  
  353.             connections = new java.util.Vector();
  354.             connection = new ConnectionDescriptor("input", "Image", "",
  355.                                     "%name%.setStandardImage(%arg%);",
  356.                                     conn.getString("setStandardImage"));
  357.             connections.addElement(connection);
  358.  
  359.             setStandardImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  360.             md.addElement(setStandardImage);
  361.         } catch (Exception e) { throw new Error("setStandardImage:: " + e.toString()); }
  362.  
  363.         try{
  364.             args = null;
  365.             MethodDescriptor getStandardImage = new MethodDescriptor(beanClass.getMethod("getStandardImage", args));
  366.  
  367.             connections = new java.util.Vector();
  368.             connection = new ConnectionDescriptor("output", "Image", "",
  369.                                     "%name%.getStandardImage()",
  370.                                     conn.getString("getStandardImage"));
  371.             connections.addElement(connection);
  372.  
  373.             getStandardImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  374.             md.addElement(getStandardImage);
  375.         } catch (Exception e) { throw new Error("getStandardImage:: " + e.toString()); }
  376.  
  377.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  378.         md.copyInto(rv);
  379.  
  380.         return rv;
  381.     }
  382.  
  383.     /**
  384.      * Returns descriptions of this bean's properties.
  385.      */
  386.     public PropertyDescriptor[] getPropertyDescriptors() {
  387.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  388.  
  389.         try{
  390.         PropertyDescriptor centerMode = new PropertyDescriptor("centerMode", beanClass);
  391.         centerMode.setBound(true);
  392.         centerMode.setConstrained(true);
  393.         centerMode.setDisplayName(prop.getString("centerMode"));
  394.  
  395.         PropertyDescriptor clearFrame = new PropertyDescriptor("clearFrame", beanClass);
  396.         clearFrame.setBound(true);
  397.         clearFrame.setConstrained(true);
  398.         clearFrame.setDisplayName(prop.getString("clearFrame"));
  399.  
  400.         PropertyDescriptor standardURL = new PropertyDescriptor("standardURL", beanClass);
  401.         standardURL.setBound(true);
  402.         standardURL.setConstrained(true);
  403.         standardURL.setDisplayName(prop.getString("standardURL"));
  404.         standardURL.setValue("URLFILTER", prop.getString("imageURLFILTER"));
  405.  
  406.         PropertyDescriptor overURL = new PropertyDescriptor("overURL", beanClass);
  407.         overURL.setBound(true);
  408.         overURL.setConstrained(true);
  409.         overURL.setDisplayName(prop.getString("overURL"));
  410.         overURL.setValue("URLFILTER", prop.getString("imageURLFILTER"));
  411.  
  412.         PropertyDescriptor downURL = new PropertyDescriptor("downURL", beanClass);
  413.         downURL.setBound(true);
  414.         downURL.setConstrained(true);
  415.         downURL.setDisplayName(prop.getString("downURL"));
  416.         downURL.setValue("URLFILTER", prop.getString("imageURLFILTER"));
  417.  
  418.         PropertyDescriptor uRL = new PropertyDescriptor("uRL", beanClass);
  419.         uRL.setBound(true);
  420.         uRL.setConstrained(true);
  421.         uRL.setDisplayName(prop.getString("uRL"));
  422.         uRL.setValue("URLFILTER", prop.getString("htmlURLFILTER"));
  423.  
  424.         PropertyDescriptor[] rv = {
  425.             centerMode,
  426.             clearFrame,
  427.             standardURL,
  428.             overURL,
  429.             downURL,
  430.             uRL};
  431.         return rv;
  432.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  433.     }
  434.  
  435.     private final static Class beanClass = RollOverButton.class;
  436.  
  437.     }    //  end of class RollOverButtonBeanInfo