home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 14.3 KB | 393 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 09/08/97 LAB Moved from Additional to Panels. Hid layout property.
- // 09/20/97 RKM Fixed getAdditionalBeanInfo override
-
- /**
- * BeanInfo for InfoTipPanel.
- *
- */
- public class InfoTipPanelBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a TextScrollingButtonBeanIn object.
- */
- public InfoTipPanelBeanInfo() {
- }
-
- /**
- * Gets an array of BeanInfo on the superclasses of this object.
- * The superclasses returned are all assignable from class Object
- * (see isAssignableFrom).
- * @return BeanInfo on this class's superclasses
- * @see java.lang.Class#isAssignableFrom
- */
- 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);
-
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
- s=conn.getString("");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.RIGHT_OF_COMPONENT",
- "RIGHT_OF_COMPONENT"));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.LEFT_OF_COMPONENT",
- "LEFT_OF_COMPONENT"));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.ABOVE_COMPONENT",
- "ABOVE_COMPONENT"));
-
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
- "%name%.BELOW_COMPONENT",
- "BELOW_COMPONENT"));
-
- 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("InfoTipPanelC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("InfoTipPanelC32.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 = new Class[1];
- args[0] = java.lang.String.class ;
- MethodDescriptor setText = new MethodDescriptor(beanClass.getMethod("setText", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "String", "",
- "%name%.setText(%arg%);",
- conn.getString("setText"));
- connections.addElement(connection);
-
- setText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setText);
- } catch (Exception e) { throw new Error("setText:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getText = new MethodDescriptor(beanClass.getMethod("getText", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "String", "",
- "%name%.getText()",
- conn.getString("getText"));
- connections.addElement(connection);
-
- getText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getText);
- } catch (Exception e) { throw new Error("getText:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setTextLocation = new MethodDescriptor(beanClass.getMethod("setTextLocation", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setTextLocation(%arg%);",
- conn.getString("setTextLocation"));
- connections.addElement(connection);
-
- setTextLocation.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setTextLocation);
- } catch (Exception e) { throw new Error("setTextLocation:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getTextLocation = new MethodDescriptor(beanClass.getMethod("getTextLocation", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getTextLocation()",
- conn.getString("getTextLocation"));
- connections.addElement(connection);
-
- getTextLocation.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getTextLocation);
- } catch (Exception e) { throw new Error("getTextLocation:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setTextDelay = new MethodDescriptor(beanClass.getMethod("setTextDelay", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setTextDelay(%arg%);",
- conn.getString("setTextDelay"));
- connections.addElement(connection);
-
- setTextDelay.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setTextDelay);
- } catch (Exception e) { throw new Error("setTextDelay:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getTextDelay = new MethodDescriptor(beanClass.getMethod("getTextDelay", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getTextDelay()",
- conn.getString("getTextDelay"));
- connections.addElement(connection);
-
- getTextDelay.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getTextDelay);
- } catch (Exception e) { throw new Error("getTextDelay:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getTextScrollsIn = new MethodDescriptor(beanClass.getMethod("getTextScrollsIn", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.getTextScrollsIn()",
- conn.getString("getTextScrollsIn"));
- connections.addElement(connection);
-
- getTextScrollsIn.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getTextScrollsIn);
- } catch (Exception e) { throw new Error("getTextScrollsIn:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setTextScrollsIn = new MethodDescriptor(beanClass.getMethod("setTextScrollsIn", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setTextScrollsIn(%arg%);",
- conn.getString("setTextScrollsIn"));
- connections.addElement(connection);
-
- setTextScrollsIn.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setTextScrollsIn);
- } catch (Exception e) { throw new Error("setTextScrollsIn:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getHighlightText = new MethodDescriptor(beanClass.getMethod("getHighlightText", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.getHighlightText()",
- conn.getString("getHighlightText"));
- connections.addElement(connection);
-
- getHighlightText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getHighlightText);
- } catch (Exception e) { throw new Error("getHighlightText:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setHighlightText = new MethodDescriptor(beanClass.getMethod("setHighlightText", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setHighlightText(%arg%);",
- conn.getString("setHighlightText"));
- connections.addElement(connection);
-
- setHighlightText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setHighlightText);
- } catch (Exception e) { throw new Error("setHighlightText:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getTextHighlightColor = new MethodDescriptor(beanClass.getMethod("getTextHighlightColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getTextHighlightColor()",
- conn.getString("getTextHighlightColor"));
- connections.addElement(connection);
-
- getTextHighlightColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getTextHighlightColor);
- } catch (Exception e) { throw new Error("getTextHighlightColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setTextHighlightColor = new MethodDescriptor(beanClass.getMethod("setTextHighlightColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setTextHighlightColor(%arg%);",
- conn.getString("setTextHighlightColor"));
- connections.addElement(connection);
-
- setTextHighlightColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setTextHighlightColor);
- } catch (Exception e) { throw new Error("setTextHighlightColor:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getTextColor = new MethodDescriptor(beanClass.getMethod("getTextColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getTextColor()",
- conn.getString("getTextColor"));
- connections.addElement(connection);
-
- getTextColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getTextColor);
- } catch (Exception e) { throw new Error("getTextColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setTextColor = new MethodDescriptor(beanClass.getMethod("setTextColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setTextColor(%arg%);",
- conn.getString("setTextColor"));
- connections.addElement(connection);
-
- setTextColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setTextColor);
- } catch (Exception e) { throw new Error("setTextColor:: " + e.toString()); }
-
-
- MethodDescriptor[] rv = new MethodDescriptor[md.size()];
- md.copyInto(rv);
-
- return rv;
- }
-
- /**
- * Returns desecriptions of this bean's properties.
- */
- public PropertyDescriptor[] getPropertyDescriptors() {
- ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
-
- try{
- PropertyDescriptor defProperty = new PropertyDescriptor("text", beanClass);
- defProperty.setBound(true);
- defProperty.setConstrained(true);
- defProperty.setDisplayName(prop.getString("text"));
-
- PropertyDescriptor textLocation = new PropertyDescriptor("textLocation", beanClass);
- textLocation.setBound(true);
- textLocation.setConstrained(true);
- textLocation.setDisplayName(prop.getString("textLocation"));
- textLocation.setValue("ENUMERATION", "RIGHT_OF_COMPONENT=0, LEFT_OF_COMPONENT=1, ABOVE_COMPONENT=2, BELOW_COMPONENT=3");
-
- PropertyDescriptor textDelay = new PropertyDescriptor("textDelay", beanClass);
- textDelay.setBound(true);
- textDelay.setConstrained(true);
- textDelay.setDisplayName(prop.getString("textDelay"));
-
- PropertyDescriptor textScrollsIn = new PropertyDescriptor("textScrollsIn", beanClass);
- textScrollsIn.setBound(true);
- textScrollsIn.setConstrained(true);
- textScrollsIn.setDisplayName(prop.getString("textScrollsIn"));
-
- PropertyDescriptor highlightText = new PropertyDescriptor("highlightText", beanClass);
- highlightText.setBound(true);
- highlightText.setConstrained(true);
- highlightText.setDisplayName(prop.getString("highlightText"));
-
- PropertyDescriptor textHighlightColor = new PropertyDescriptor("textHighlightColor", beanClass);
- textHighlightColor.setBound(true);
- textHighlightColor.setConstrained(true);
- textHighlightColor.setDisplayName(prop.getString("textHighlightColor"));
-
- PropertyDescriptor textColor = new PropertyDescriptor("textColor", beanClass);
- textColor.setBound(true);
- textColor.setConstrained(true);
- textColor.setDisplayName(prop.getString("textColor"));
-
- PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
- layout.setHidden(true);
-
- PropertyDescriptor[] rv = {
- defProperty,
- textLocation,
- textDelay,
- textScrollsIn,
- highlightText,
- textHighlightColor,
- textColor,
- layout
- };
-
- 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 = InfoTipPanel.class;
-
- } // end of class InfoTipPanelBeanInfo