home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 16.0 KB | 437 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 08/25/97 LAB Obeject name was left out of some interactions (Addresses Mac Bug #7253)
- // 09/07/97 LAB Fixed misspelling of descriptions.
- // 09/19/97 RKM Fixed connections that called deprecated methods
-
- /**
- * BeanInfo for RollOverButton.
- *
- */
- public class RollOverButtonBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a RollOverButtonBeanInfo object.
- */
- public RollOverButtonBeanInfo() {
- }
-
- /**
- * 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("GroupAdditional");
-
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setFolder(s);
- bd.setToolbar(s);
- bd.setWinHelp("0x123B1");
-
- 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("RollOverButtonC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("RollOverButtonC32.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.net.URL.class ;
- MethodDescriptor setOverURL = new MethodDescriptor(beanClass.getMethod("setOverURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "RelativeURL", "",
- "%name%.setOverURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
- conn.getString("setOverURL"));
- connections.addElement(connection);
-
- setOverURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setOverURL);
- } catch (Exception e) { throw new Error("setOverURL:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Image.class ;
- MethodDescriptor setDownImage = new MethodDescriptor(beanClass.getMethod("setDownImage", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Image", "",
- "%name%.setDownImage(%arg%);",
- conn.getString("setDownImage"));
- connections.addElement(connection);
-
- setDownImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setDownImage);
- } catch (Exception e) { throw new Error("setDownImage:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.net.URL.class ;
- MethodDescriptor setStandardURL = new MethodDescriptor(beanClass.getMethod("setStandardURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "RelativeURL", "",
- "%name%.setStandardURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
- conn.getString("setStandardURL"));
- connections.addElement(connection);
-
- setStandardURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setStandardURL);
- } catch (Exception e) { throw new Error("setStandardURL:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.net.URL.class ;
- MethodDescriptor setDownURL = new MethodDescriptor(beanClass.getMethod("setDownURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "RelativeURL", "",
- "%name%.setDownURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
- conn.getString("setDownURL"));
- connections.addElement(connection);
-
- setDownURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setDownURL);
- } catch (Exception e) { throw new Error("setDownURL:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setClearFrame = new MethodDescriptor(beanClass.getMethod("setClearFrame", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setClearFrame(true);",
- conn.getString("setClearFrameTrue"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setClearFrame(false);",
- conn.getString("setClearFrameFalse"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setClearFrame(!%name%.isClearFrame());",
- conn.getString("setClearFrameToggle"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setClearFrame(%arg%);",
- conn.getString("setClearFrameValue"));
- connections.addElement(connection);
-
- setClearFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setClearFrame);
- } catch (Exception e) { throw new Error("setClearFrame:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getOverImage = new MethodDescriptor(beanClass.getMethod("getOverImage", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Image", "",
- "%name%.getOverImage()",
- conn.getString("getOverImage"));
- connections.addElement(connection);
-
- getOverImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getOverImage);
- } catch (Exception e) { throw new Error("getOverImage:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Image.class ;
- MethodDescriptor setOverImage = new MethodDescriptor(beanClass.getMethod("setOverImage", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Image", "",
- "%name%.setOverImage(%arg%);",
- conn.getString("setOverImage"));
- connections.addElement(connection);
-
- setOverImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setOverImage);
- } catch (Exception e) { throw new Error("setOverImage:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setCenterMode = new MethodDescriptor(beanClass.getMethod("setCenterMode", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setCenterMode(true);",
- conn.getString("setCenterModeTrue"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setCenterMode(false);",
- conn.getString("setCenterModeFalse"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setCenterMode(!%name%.isCenterMode());",
- conn.getString("setCenterModeToggle"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setCenterMode(%arg%);",
- conn.getString("setCenterModeValue"));
- connections.addElement(connection);
-
- setCenterMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setCenterMode);
- } catch (Exception e) { throw new Error("setCenterMode:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getURL = new MethodDescriptor(beanClass.getMethod("getURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "URL", "",
- "%name%.getURL()",
- conn.getString("getURL"));
- connections.addElement(connection);
-
- getURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getURL);
- } catch (Exception e) { throw new Error("getURL:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.net.URL.class ;
- MethodDescriptor setURL = new MethodDescriptor(beanClass.getMethod("setURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "RelativeURL", "",
- "%name%.setURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
- conn.getString("setURLRelative"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "URL", "",
- "%name%.setURL(%arg%);",
- conn.getString("setURL"));
- connections.addElement(connection);
-
- setURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setURL);
- } catch (Exception e) { throw new Error("setURL:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.String.class ;
- MethodDescriptor setFrame = new MethodDescriptor(beanClass.getMethod("setFrame", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "String", "",
- "%name%.setFrame(%arg%);",
- conn.getString("setFrame"));
- connections.addElement(connection);
-
- setFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setFrame);
- } catch (Exception e) { throw new Error("setFrame:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isClearFrame = new MethodDescriptor(beanClass.getMethod("isClearFrame", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isClearFrame()",
- conn.getString("isClearFrame"));
- connections.addElement(connection);
-
- isClearFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isClearFrame);
- } catch (Exception e) { throw new Error("isClearFrame:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isCenterMode = new MethodDescriptor(beanClass.getMethod("isCenterMode", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isCenterMode()",
- conn.getString("isCenterMode"));
- connections.addElement(connection);
-
- isCenterMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isCenterMode);
- } catch (Exception e) { throw new Error("isCenterMode:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getDownImage = new MethodDescriptor(beanClass.getMethod("getDownImage", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Image", "",
- "%name%.getDownImage()",
- conn.getString("getDownImage"));
- connections.addElement(connection);
-
- getDownImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getDownImage);
- } catch (Exception e) { throw new Error("getDownImage:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getFrame = new MethodDescriptor(beanClass.getMethod("getFrame", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "String", "",
- "%name%.getFrame()",
- conn.getString("getFrame"));
- connections.addElement(connection);
-
- getFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getFrame);
- } catch (Exception e) { throw new Error("getFrame:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Image.class ;
- MethodDescriptor setStandardImage = new MethodDescriptor(beanClass.getMethod("setStandardImage", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Image", "",
- "%name%.setStandardImage(%arg%);",
- conn.getString("setStandardImage"));
- connections.addElement(connection);
-
- setStandardImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setStandardImage);
- } catch (Exception e) { throw new Error("setStandardImage:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getStandardImage = new MethodDescriptor(beanClass.getMethod("getStandardImage", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Image", "",
- "%name%.getStandardImage()",
- conn.getString("getStandardImage"));
- connections.addElement(connection);
-
- getStandardImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getStandardImage);
- } catch (Exception e) { throw new Error("getStandardImage:: " + 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 centerMode = new PropertyDescriptor("centerMode", beanClass);
- centerMode.setBound(true);
- centerMode.setConstrained(true);
- centerMode.setDisplayName(prop.getString("centerMode"));
-
- PropertyDescriptor clearFrame = new PropertyDescriptor("clearFrame", beanClass);
- clearFrame.setBound(true);
- clearFrame.setConstrained(true);
- clearFrame.setDisplayName(prop.getString("clearFrame"));
-
- PropertyDescriptor standardURL = new PropertyDescriptor("standardURL", beanClass);
- standardURL.setBound(true);
- standardURL.setConstrained(true);
- standardURL.setDisplayName(prop.getString("standardURL"));
- standardURL.setValue("URLFILTER", prop.getString("imageURLFILTER"));
-
- PropertyDescriptor overURL = new PropertyDescriptor("overURL", beanClass);
- overURL.setBound(true);
- overURL.setConstrained(true);
- overURL.setDisplayName(prop.getString("overURL"));
- overURL.setValue("URLFILTER", prop.getString("imageURLFILTER"));
-
- PropertyDescriptor downURL = new PropertyDescriptor("downURL", beanClass);
- downURL.setBound(true);
- downURL.setConstrained(true);
- downURL.setDisplayName(prop.getString("downURL"));
- downURL.setValue("URLFILTER", prop.getString("imageURLFILTER"));
-
- PropertyDescriptor uRL = new PropertyDescriptor("uRL", beanClass);
- uRL.setBound(true);
- uRL.setConstrained(true);
- uRL.setDisplayName(prop.getString("uRL"));
- uRL.setValue("URLFILTER", prop.getString("htmlURLFILTER"));
-
- PropertyDescriptor[] rv = {
- centerMode,
- clearFrame,
- standardURL,
- overURL,
- downURL,
- uRL};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = RollOverButton.class;
-
- } // end of class RollOverButtonBeanInfo