home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 7.1 KB | 206 lines |
- package symantec.itools.awt.shape;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 09/07/97 LAB Removed font as property (Addresses Mac Bug #7687).
-
- /**
- * BeanInfo for Shape.
- *
- */
- public class ShapeBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a ShapeBeanInfo object.
- */
- public ShapeBeanInfo() {
- }
-
- /**
- * 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() {
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
-
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
- 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 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.Boolean.TYPE ;
- MethodDescriptor setFillMode = new MethodDescriptor(beanClass.getMethod("setFillMode", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setFillMode(%arg%);",
- conn.getString("setFillMode"));
- connections.addElement(connection);
-
- setFillMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setFillMode);
- } catch (Exception e) { throw new Error("setFillMode:: " + e.toString()); }
-
- 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 isFillMode = new MethodDescriptor(beanClass.getMethod("isFillMode", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isFillMode()",
- conn.getString("isFillMode"));
- connections.addElement(connection);
-
- isFillMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isFillMode);
- } catch (Exception e) { throw new Error("isFillMode:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getFillColor = new MethodDescriptor(beanClass.getMethod("getFillColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getFillColor()",
- conn.getString("getFillColor"));
- connections.addElement(connection);
-
- getFillColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getFillColor);
- } catch (Exception e) { throw new Error("getFillColor:: " + 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.awt.Color.class ;
- MethodDescriptor setFillColor = new MethodDescriptor(beanClass.getMethod("setFillColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setFillColor(%arg%);",
- conn.getString("setFillColor"));
- connections.addElement(connection);
-
- setFillColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setFillColor);
- } catch (Exception e) { throw new Error("setFillColor:: " + 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 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 fillMode = new PropertyDescriptor("fillMode", beanClass);
- fillMode.setBound(true);
- fillMode.setConstrained(true);
- fillMode.setDisplayName(prop.getString("fillMode"));
-
- PropertyDescriptor fillColor = new PropertyDescriptor("fillColor", beanClass);
- fillColor.setBound(true);
- fillColor.setConstrained(true);
- fillColor.setDisplayName(prop.getString("fillColor"));
-
- PropertyDescriptor font = new PropertyDescriptor("font", beanClass);
- font.setHidden(true);
-
- PropertyDescriptor[] rv = {
- bevelStyle,
- fillMode,
- fillColor,
- font};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = Shape.class;
-
- } // end of class ShapeBeanInfo