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

  1. package symantec.itools.awt.util;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  07/24/97    LAB    Added Orientation property and connections.
  8. //  09/19/97    RKM    Hid the layout bean.
  9. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  10.  
  11. /**
  12.  * BeanInfo for ToolBarPanel.
  13.  *
  14.  */
  15.  
  16. public class ToolBarPanelBeanInfo extends SimpleBeanInfo {
  17.  
  18.     /**
  19.      * Constructs a ToolBarPanelBeanInfo object.
  20.      */
  21.     public ToolBarPanelBeanInfo() {
  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.     public java.awt.Image getIcon(int iconKind) {
  38.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  39.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  40.             java.awt.Image img = loadImage("ToolBarPanelC16.gif");
  41.             return img;
  42.         }
  43.  
  44.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  45.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  46.             java.awt.Image img = loadImage("ToolBarPanelC32.gif");
  47.             return img;
  48.         }
  49.  
  50.         return null;
  51.     }
  52.  
  53.     /**
  54.      * Gets the SymantecBeanDescriptor for this bean.
  55.      * @return an object of type SymantecBeanDescriptor
  56.      * @see symantec.itools.beans.SymantecBeanDescriptor
  57.      */
  58.     public BeanDescriptor getBeanDescriptor() {
  59.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  60.         String s=group.getString("GroupAWTAdditions"); 
  61.  
  62.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  63.         bd.setFolder(s);
  64.         bd.setWinHelp("0x123B6");
  65.  
  66.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  67.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  68.                                                 "%name%.HORIZONTAL",
  69.                                                 conn.getString("HORIZONTAL")));
  70.  
  71.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  72.                                                 "%name%.VERTICAL",
  73.                                                 conn.getString("VERTICAL")));
  74.  
  75.         bd.addAdditionalConnections(getAdditionalBeanInfo());
  76.  
  77.         return (BeanDescriptor) bd;
  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.lang.Integer.TYPE;
  97.             MethodDescriptor setOrientation = new MethodDescriptor(beanClass.getMethod("setOrientation", args));
  98.  
  99.             connections = new java.util.Vector();
  100.             connection = new ConnectionDescriptor("input", "int", "",
  101.                                     "%name%.setOrientation(%arg%);",
  102.                                     conn.getString("setOrientation"));
  103.             connections.addElement(connection);
  104.  
  105.             setOrientation.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  106.             md.addElement(setOrientation);
  107.         } catch (Exception e) { throw new Error("setOrientation:: " + e.toString()); }
  108.  
  109.         try{
  110.             args = null;
  111.             MethodDescriptor getOrientation = new MethodDescriptor(beanClass.getMethod("getOrientation", args));
  112.  
  113.             connections = new java.util.Vector();
  114.             connection = new ConnectionDescriptor("output", "int", "",
  115.                                     "%name%.getOrientation()",
  116.                                     conn.getString("getOrientation"));
  117.             connections.addElement(connection);
  118.  
  119.             getOrientation.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  120.             md.addElement(getOrientation);
  121.         } catch (Exception e) { throw new Error("getOrientation:: " + e.toString()); }
  122.  
  123.  
  124.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  125.         md.copyInto(rv);
  126.  
  127.         return rv;
  128.     }
  129.  
  130.     /**
  131.      * Returns descriptions of this bean's properties.
  132.      */
  133.     public PropertyDescriptor[] getPropertyDescriptors() {
  134.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  135.  
  136.         try{
  137.         PropertyDescriptor orientation = new PropertyDescriptor("orientation", beanClass);
  138.         orientation.setBound(true);
  139.         orientation.setConstrained(true);
  140.         orientation.setDisplayName(prop.getString("orientation"));
  141.         orientation.setValue("ENUMERATION", "HORIZONTAL=0, VERTICAL=1");
  142.  
  143.         PropertyDescriptor bevelStyle = new PropertyDescriptor("bevelStyle", beanClass);
  144.         bevelStyle.setBound(true);
  145.         bevelStyle.setConstrained(true);
  146.         bevelStyle.setDisplayName(prop.getString("bevelStyle"));
  147.         bevelStyle.setValue("ENUMERATION", "BEVEL_LOWERED=0, BEVEL_RAISED=1, BEVEL_LINE=2, BEVEL_NONE=3");
  148.  
  149.         PropertyDescriptor paddingTop = new PropertyDescriptor("paddingTop", beanClass);
  150.         paddingTop.setBound(true);
  151.         paddingTop.setConstrained(true);
  152.         paddingTop.setDisplayName(prop.getString("paddingTop"));
  153.  
  154.         PropertyDescriptor paddingBottom = new PropertyDescriptor("paddingBottom", beanClass);
  155.         paddingBottom.setBound(true);
  156.         paddingBottom.setConstrained(true);
  157.         paddingBottom.setDisplayName(prop.getString("paddingBottom"));
  158.  
  159.         PropertyDescriptor paddingLeft = new PropertyDescriptor("paddingLeft", beanClass);
  160.         paddingLeft.setBound(true);
  161.         paddingLeft.setConstrained(true);
  162.         paddingLeft.setDisplayName(prop.getString("paddingLeft"));
  163.  
  164.         PropertyDescriptor paddingRight = new PropertyDescriptor("paddingRight", beanClass);
  165.         paddingRight.setBound(true);
  166.         paddingRight.setConstrained(true);
  167.         paddingRight.setDisplayName(prop.getString("paddingRight"));
  168.  
  169.         PropertyDescriptor iPadTop = new PropertyDescriptor("iPadTop", beanClass);
  170.         iPadTop.setBound(true);
  171.         iPadTop.setConstrained(true);
  172.         iPadTop.setDisplayName(prop.getString("iPadTop"));
  173.  
  174.         PropertyDescriptor iPadBottom = new PropertyDescriptor("iPadBottom", beanClass);
  175.         iPadBottom.setBound(true);
  176.         iPadBottom.setConstrained(true);
  177.         iPadBottom.setDisplayName(prop.getString("iPadBottom"));
  178.  
  179.         PropertyDescriptor iPadSides = new PropertyDescriptor("iPadSides", beanClass);
  180.         iPadSides.setBound(true);
  181.         iPadSides.setConstrained(true);
  182.         iPadSides.setDisplayName(prop.getString("iPadSides"));
  183.         
  184.         PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
  185.         layout.setHidden(true);
  186.  
  187.         PropertyDescriptor[] rv = {
  188.             orientation,
  189.             bevelStyle,
  190.             paddingTop,
  191.             paddingBottom,
  192.             paddingLeft,
  193.             paddingRight,
  194.             iPadTop,
  195.             iPadBottom,
  196.             iPadSides,
  197.             layout};
  198.         return rv;
  199.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  200.     }
  201.  
  202.     private final static Class beanClass = ToolBarPanel.class;
  203.  
  204.     }    //  end of class ToolBarPanelBeanInfo