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

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