home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 6.8 KB | 204 lines |
- package symantec.itools.awt.util;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 07/24/97 LAB Added Orientation property and connections.
- // 09/19/97 RKM Hid the layout bean.
-
- /**
- * BeanInfo for ToolBarPanel.
- *
- */
-
- public class ToolBarPanelBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a ToolBarPanelBeanInfo object.
- */
- public ToolBarPanelBeanInfo() {
- }
-
- /**
- * 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());}
- }
-
- public java.awt.Image getIcon(int iconKind) {
- if (iconKind == BeanInfo.ICON_MONO_16x16 ||
- iconKind == BeanInfo.ICON_COLOR_16x16) {
- java.awt.Image img = loadImage("ToolBarPanelC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("ToolBarPanelC32.gif");
- return img;
- }
-
- return null;
- }
-
- /**
- * 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("GroupPanel");
-
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setFolder(s);
- bd.setToolbar(s);
- bd.setWinHelp("0x123B6");
-
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.HORIZONTAL",
- conn.getString("HORIZONTAL")));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.VERTICAL",
- conn.getString("VERTICAL")));
-
- bd.addAdditionalConnections(getAdditionalBeanInfo());
-
- return (BeanDescriptor) bd;
- }
-
- /**
- * 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.Integer.TYPE;
- MethodDescriptor setOrientation = new MethodDescriptor(beanClass.getMethod("setOrientation", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setOrientation(%arg%);",
- conn.getString("setOrientation"));
- connections.addElement(connection);
-
- setOrientation.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setOrientation);
- } catch (Exception e) { throw new Error("setOrientation:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getOrientation = new MethodDescriptor(beanClass.getMethod("getOrientation", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getOrientation()",
- conn.getString("getOrientation"));
- connections.addElement(connection);
-
- getOrientation.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getOrientation);
- } catch (Exception e) { throw new Error("getOrientation:: " + 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 orientation = new PropertyDescriptor("orientation", beanClass);
- orientation.setBound(true);
- orientation.setConstrained(true);
- orientation.setDisplayName(prop.getString("orientation"));
- orientation.setValue("ENUMERATION", "HORIZONTAL=0, VERTICAL=1");
-
- PropertyDescriptor bevelStyle = new PropertyDescriptor("bevelStyle", beanClass);
- bevelStyle.setBound(true);
- bevelStyle.setConstrained(true);
- bevelStyle.setDisplayName(prop.getString("bevelStyle"));
- bevelStyle.setValue("ENUMERATION", "BEVEL_LOWERED=0, BEVEL_RAISED=1, BEVEL_LINE=2, BEVEL_NONE=3");
-
- PropertyDescriptor paddingTop = new PropertyDescriptor("paddingTop", beanClass);
- paddingTop.setBound(true);
- paddingTop.setConstrained(true);
- paddingTop.setDisplayName(prop.getString("paddingTop"));
-
- PropertyDescriptor paddingBottom = new PropertyDescriptor("paddingBottom", beanClass);
- paddingBottom.setBound(true);
- paddingBottom.setConstrained(true);
- paddingBottom.setDisplayName(prop.getString("paddingBottom"));
-
- PropertyDescriptor paddingLeft = new PropertyDescriptor("paddingLeft", beanClass);
- paddingLeft.setBound(true);
- paddingLeft.setConstrained(true);
- paddingLeft.setDisplayName(prop.getString("paddingLeft"));
-
- PropertyDescriptor paddingRight = new PropertyDescriptor("paddingRight", beanClass);
- paddingRight.setBound(true);
- paddingRight.setConstrained(true);
- paddingRight.setDisplayName(prop.getString("paddingRight"));
-
- PropertyDescriptor iPadTop = new PropertyDescriptor("iPadTop", beanClass);
- iPadTop.setBound(true);
- iPadTop.setConstrained(true);
- iPadTop.setDisplayName(prop.getString("iPadTop"));
-
- PropertyDescriptor iPadBottom = new PropertyDescriptor("iPadBottom", beanClass);
- iPadBottom.setBound(true);
- iPadBottom.setConstrained(true);
- iPadBottom.setDisplayName(prop.getString("iPadBottom"));
-
- PropertyDescriptor iPadSides = new PropertyDescriptor("iPadSides", beanClass);
- iPadSides.setBound(true);
- iPadSides.setConstrained(true);
- iPadSides.setDisplayName(prop.getString("iPadSides"));
-
- PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
- layout.setHidden(true);
-
- PropertyDescriptor[] rv = {
- orientation,
- bevelStyle,
- paddingTop,
- paddingBottom,
- paddingLeft,
- paddingRight,
- iPadTop,
- iPadBottom,
- iPadSides,
- layout};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = ToolBarPanel.class;
-
- } // end of class ToolBarPanelBeanInfo