home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 21.1 KB | 571 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 09/07/97 LAB Fixed misspelling of descriptions.
- // 09/21/97 RKM Fixed bug in "getLabelColor" connection
- // 09/24/97 RKM Fixed bug in "getBorderColor" connection
-
- /**
- * BeanInfo for BorderPanel.
- */
- public class BorderPanelBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a BorderPanelBeanInfo object.
- */
- public BorderPanelBeanInfo() {
- }
-
- /**
- * 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());}
- }
-
- /**
- * 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("0x123B5");
-
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.ALIGN_LEFT",
- conn.getString("ALIGN_LEFT")));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.ALIGN_CENTERED",
- conn.getString("ALIGN_CENTERED")));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.ALIGN_RIGHT",
- conn.getString("ALIGN_RIGHT")));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.BEVEL_LOWERED",
- conn.getString("BEVEL_LOWERED")));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.BEVEL_RAISED",
- conn.getString("BEVEL_RAISED")));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.BEVEL_LINE",
- conn.getString("BEVEL_LINE")));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.BEVEL_NONE",
- conn.getString("BEVEL_NONE")));
-
-
- return (BeanDescriptor) bd;
- }
-
- /**
- * Gets an image that may be used to visually represent this bean
- * (in the toolbar, on a form, etc).
- * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
- * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
- * @return an image for this bean, always color even if requested monochrome
- * @see BeanInfo#ICON_MONO_16x16
- * @see BeanInfo#ICON_COLOR_16x16
- * @see BeanInfo#ICON_MONO_32x32
- * @see BeanInfo#ICON_COLOR_32x32
- */
- public java.awt.Image getIcon(int iconKind) {
- if (iconKind == BeanInfo.ICON_MONO_16x16 ||
- iconKind == BeanInfo.ICON_COLOR_16x16) {
- java.awt.Image img = loadImage("BorderPanelC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("BorderPanelC32.gif");
- return img;
- }
-
- return null;
- }
-
- /**
- * 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 = null;
- MethodDescriptor getBevelStyle = new MethodDescriptor(beanClass.getMethod("getBevelStyle", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getBevelStyle()",
- conn.getString("getBevelStyle"));
- connections.addElement(connection);
-
- getBevelStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getBevelStyle);
- } catch (Exception e) { throw new Error("getBevelStyle:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getIPadTop = new MethodDescriptor(beanClass.getMethod("getIPadTop", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getIPadTop()",
- conn.getString("getIPadTop"));
- connections.addElement(connection);
-
- getIPadTop.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getIPadTop);
- } catch (Exception e) { throw new Error("getIPadTop:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getIPadBottom = new MethodDescriptor(beanClass.getMethod("getIPadBottom", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getIPadBottom()",
- conn.getString("getIPadBottom"));
-
- getIPadBottom.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getIPadBottom);
- } catch (Exception e) { throw new Error("getIPadBottom:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getPaddingLeft = new MethodDescriptor(beanClass.getMethod("getPaddingLeft", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getPaddingLeft()",
- conn.getString("getPaddingLeft"));
- connections.addElement(connection);
-
- getPaddingLeft.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getPaddingLeft);
- } catch (Exception e) { throw new Error("getPaddingLeft:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setIPadSides = new MethodDescriptor(beanClass.getMethod("setIPadSides", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setIPadSides(%arg%);",
- conn.getString("setIPadSides"));
- connections.addElement(connection);
-
- setIPadSides.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setIPadSides);
- } catch (Exception e) { throw new Error("setIPadSides:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setPaddingLeft = new MethodDescriptor(beanClass.getMethod("setPaddingLeft", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setPaddingLeft(%arg%);",
- conn.getString("setPaddingLeft"));
- connections.addElement(connection);
-
- setPaddingLeft.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setPaddingLeft);
- } catch (Exception e) { throw new Error("setPaddingLeft:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getPaddingRight = new MethodDescriptor(beanClass.getMethod("getPaddingRight", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getPaddingRight()",
- conn.getString("getPaddingRight"));
- connections.addElement(connection);
-
- getPaddingRight.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getPaddingRight);
- } catch (Exception e) { throw new Error("getPaddingRight:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setPaddingRight = new MethodDescriptor(beanClass.getMethod("setPaddingRight", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setPaddingRight(%arg%);",
- conn.getString("setPaddingRight"));
- connections.addElement(connection);
-
- setPaddingRight.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setPaddingRight);
- } catch (Exception e) { throw new Error("setPaddingRight:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getIPadSides = new MethodDescriptor(beanClass.getMethod("getIPadSides", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getIPadSides()",
- conn.getString("getIPadSides"));
- connections.addElement(connection);
-
- getIPadSides.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getIPadSides);
- } catch (Exception e) { throw new Error("getIPadSides:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setLabelColor = new MethodDescriptor(beanClass.getMethod("setLabelColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setLabelColor(%arg%);",
- conn.getString("setLabelColor"));
- connections.addElement(connection);
-
- setLabelColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setLabelColor);
- } catch (Exception e) { throw new Error("setLabelColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setPaddingTop = new MethodDescriptor(beanClass.getMethod("setPaddingTop", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setPaddingTop(%arg%);",
- conn.getString("setPaddingTop"));
- connections.addElement(connection);
-
- setPaddingTop.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setPaddingTop);
- } catch (Exception e) { throw new Error("setPaddingTop:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getPaddingBottom = new MethodDescriptor(beanClass.getMethod("getPaddingBottom", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getPaddingBottom()",
- conn.getString("getPaddingBottom"));
- connections.addElement(connection);
-
- getPaddingBottom.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getPaddingBottom);
- } catch (Exception e) { throw new Error("getPaddingBottom:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.String.class ;
- MethodDescriptor setLabel = new MethodDescriptor(beanClass.getMethod("setLabel", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "String", "",
- "%name%.setLabel(%arg%);",
- conn.getString("setLabel"));
- connections.addElement(connection);
-
- setLabel.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setLabel);
- } catch (Exception e) { throw new Error("setLabel:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setAlignStyle = new MethodDescriptor(beanClass.getMethod("setAlignStyle", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setAlignStyle(%arg%);",
- conn.getString("setAlignStyle"));
- connections.addElement(connection);
-
- setAlignStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setAlignStyle);
- } catch (Exception e) { throw new Error("setAlignStyle:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getBorderColor = new MethodDescriptor(beanClass.getMethod("getBorderColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getBorderColor()",
- conn.getString("getBorderColor"));
- connections.addElement(connection);
-
- getBorderColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getBorderColor);
- } catch (Exception e) { throw new Error("getBorderColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setIPadTop = new MethodDescriptor(beanClass.getMethod("setIPadTop", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setIPadTop(%arg%);",
- conn.getString("setIPadTop"));
- connections.addElement(connection);
-
- setIPadTop.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setIPadTop);
- } catch (Exception e) { throw new Error("setIPadTop:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getLabel = new MethodDescriptor(beanClass.getMethod("getLabel", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "String", "",
- "%name%.getLabel()",
- conn.getString("getLabel"));
- connections.addElement(connection);
-
- getLabel.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getLabel);
- } catch (Exception e) { throw new Error("getLabel:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setBorderColor = new MethodDescriptor(beanClass.getMethod("setBorderColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setBorderColor(%arg%);",
- conn.getString("setBorderColor"));
- connections.addElement(connection);
-
- setBorderColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setBorderColor);
- } catch (Exception e) { throw new Error("setBorderColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setBevelStyle = new MethodDescriptor(beanClass.getMethod("setBevelStyle", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setBevelStyle(%arg%);",
- conn.getString("setBevelStyle"));
- connections.addElement(connection);
-
- setBevelStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setBevelStyle);
- } catch (Exception e) { throw new Error("setBevelStyle:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setPaddingBottom = new MethodDescriptor(beanClass.getMethod("setPaddingBottom", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setPaddingBottom(%arg%);",
- conn.getString("setPaddingBottom"));
- connections.addElement(connection);
-
- setPaddingBottom.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setPaddingBottom);
- } catch (Exception e) { throw new Error("setPaddingBottom:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getLabelColor = new MethodDescriptor(beanClass.getMethod("getLabelColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getLabelColor()",
- conn.getString("getLabelColor"));
- connections.addElement(connection);
-
- getLabelColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getLabelColor);
- } catch (Exception e) { throw new Error("getLabelColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setIPadBottom = new MethodDescriptor(beanClass.getMethod("setIPadBottom", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setIPadBottom(%arg%);",
- conn.getString("setIPadBottom"));
- connections.addElement(connection);
-
- setIPadBottom.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setIPadBottom);
- } catch (Exception e) { throw new Error("setIPadBottom:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getPaddingTop = new MethodDescriptor(beanClass.getMethod("getPaddingTop", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getPaddingTop()",
- conn.getString("getPaddingTop"));
- connections.addElement(connection);
-
- getPaddingTop.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getPaddingTop);
- } catch (Exception e) { throw new Error("getPaddingTop:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getAlignStyle = new MethodDescriptor(beanClass.getMethod("getAlignStyle", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getAlignStyle()",
- conn.getString("getAlignStyle"));
- connections.addElement(connection);
-
- getAlignStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getAlignStyle);
- } catch (Exception e) { throw new Error("getAlignStyle:: " + 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 defProperty = new PropertyDescriptor("label", beanClass);
- defProperty.setBound(true);
- defProperty.setConstrained(true);
- defProperty.setDisplayName(prop.getString("Label"));
-
- PropertyDescriptor labelColor = new PropertyDescriptor("labelColor", beanClass);
- labelColor.setBound(true);
- labelColor.setConstrained(true);
- labelColor.setDisplayName(prop.getString("LabelColor"));
-
- PropertyDescriptor alignStyle = new PropertyDescriptor("alignStyle", beanClass);
- alignStyle.setBound(true);
- alignStyle.setConstrained(true);
- alignStyle.setDisplayName(prop.getString("LabelAlignment"));
- alignStyle.setValue("ENUMERATION", "ALIGN_LEFT, ALIGN_CENTERED, ALIGN_RIGHT");
-
- 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("InsetPaddingTop"));
-
- PropertyDescriptor iPadBottom = new PropertyDescriptor("iPadBottom", beanClass);
- iPadBottom.setBound(true);
- iPadBottom.setConstrained(true);
- iPadBottom.setDisplayName(prop.getString("InsetPaddingBottom"));
-
- PropertyDescriptor iPadSides = new PropertyDescriptor("iPadSides", beanClass);
- iPadSides.setBound(true);
- iPadSides.setConstrained(true);
- iPadSides.setDisplayName(prop.getString("InsetPaddingSides"));
-
- PropertyDescriptor borderColor = new PropertyDescriptor("borderColor", beanClass);
- borderColor.setBound(true);
- borderColor.setConstrained(true);
- borderColor.setDisplayName(prop.getString("BorderColor"));
-
- PropertyDescriptor bevelStyle = new PropertyDescriptor("bevelStyle", beanClass);
- bevelStyle.setBound(true);
- bevelStyle.setConstrained(true);
- bevelStyle.setDisplayName(prop.getString("style"));
- bevelStyle.setValue("ENUMERATION", "BEVEL_LOWERED=0, BEVEL_RAISED=1, BEVEL_LINE=2, BEVEL_NONE=3");
-
- PropertyDescriptor[] rv = {
- defProperty,
- labelColor,
- alignStyle,
- paddingTop,
- paddingBottom,
- paddingLeft,
- paddingRight,
- iPadTop,
- iPadBottom,
- iPadSides,
- borderColor,
- bevelStyle};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- /**
- * Returns the index of the property expected to be changed most often by the designer.
- */
- public int getDefaultPropertyIndex() {
- return 0; // the index for our default property is always 0
- }
-
- private final static Class beanClass = BorderPanel.class;
-
- } // end of class BorderPanelBeanInfo