home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 19.6 KB | 522 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 08/06/97 LAB Changed connection getInfoTipColor to getButtonColor.
- // 08/09/97 LAB Connection type was set to boolean when it should be void for toggle button
- // focus border and toggle notify while pressed.
- // 09/07/97 LAB Fixed misspelling of descriptions.
- // 10/06/97 LAB Added connection for simulateClick.
- // 10/07/97 LAB Moved connection for simulateClick before call to copy the vector so it will
- // show up properly (oops).
-
- /**
- * BeanInfo for ButtonBase.
- *
- */
-
- public class ButtonBaseBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a ButtonBaseBeanInfo object.
- */
- public ButtonBaseBeanInfo() {
- }
-
- /**
- * 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);
-
- 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 = null;
- MethodDescriptor getBevelHeight = new MethodDescriptor(beanClass.getMethod("getBevelHeight", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getBevelHeight()",
- conn.getString("getBevelHeight"));
- connections.addElement(connection);
-
- getBevelHeight.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getBevelHeight);
- } catch (Exception e) { throw new Error("getBevelHeight:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isShowURLStatus = new MethodDescriptor(beanClass.getMethod("isShowURLStatus", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isShowURLStatus()",
- conn.getString("isShowURLStatus"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isShowURLStatus()",
- conn.getString("isNotShowURLStatus"));
- connections.addElement(connection);
-
- isShowURLStatus.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isShowURLStatus);
- } catch (Exception e) { throw new Error("isShowURLStatus:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.net.URL.class ;
- MethodDescriptor setLinkURL = new MethodDescriptor(beanClass.getMethod("setLinkURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "RelativeURL", "",
- "%name%.setLinkURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
- conn.getString("setLinkURLRelative"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "URL", "",
- "%name%.setLinkURL(%arg%);",
- conn.getString("setLinkURL"));
- connections.addElement(connection);
-
- setLinkURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setLinkURL);
- } catch (Exception e) { throw new Error("setLinkURL:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getNotifyDelay = new MethodDescriptor(beanClass.getMethod("getNotifyDelay", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getNotifyDelay()",
- conn.getString("getNotifyDelay"));
- connections.addElement(connection);
-
- getNotifyDelay.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getNotifyDelay);
- } catch (Exception e) { throw new Error("getNotifyDelay:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setBevelHeight = new MethodDescriptor(beanClass.getMethod("setBevelHeight", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setBevelHeight(%arg%);",
- conn.getString("setBevelHeight"));
- connections.addElement(connection);
-
- setBevelHeight.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setBevelHeight);
- } catch (Exception e) { throw new Error("setBevelHeight:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setNotifyDelay = new MethodDescriptor(beanClass.getMethod("setNotifyDelay", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setNotifyDelay(%arg%);",
- conn.getString("setNotifyDelay"));
- connections.addElement(connection);
-
- setNotifyDelay.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setNotifyDelay);
- } catch (Exception e) { throw new Error("setNotifyDelay:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isShowFocus = new MethodDescriptor(beanClass.getMethod("isShowFocus", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isShowFocus()",
- conn.getString("isShowFocus"));
- connections.addElement(connection);
-
- isShowFocus.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isShowFocus);
- } catch (Exception e) { throw new Error("isShowFocus:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setUseOffset = new MethodDescriptor(beanClass.getMethod("setUseOffset", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setUseOffset(true);",
- conn.getString("UseOffset"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setUseOffset(false);",
- conn.getString("NotUseOffset"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setUseOffset(!%name%.isUseOffset());",
- conn.getString("ToggleUseOffset"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setUseOffset(%arg%);",
- conn.getString("UseOffsetValue"));
- connections.addElement(connection);
-
- setUseOffset.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setUseOffset);
- } catch (Exception e) { throw new Error("setUseOffset:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isNotifyWhilePressed = new MethodDescriptor(beanClass.getMethod("isNotifyWhilePressed", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isNotifyWhilePressed()",
- conn.getString("isNotifyWhilePressed"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isNotifyWhilePressed()",
- conn.getString("isNotNotifyWhilePressed"));
- connections.addElement(connection);
-
- isNotifyWhilePressed.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isNotifyWhilePressed);
- } catch (Exception e) { throw new Error("isNotifyWhilePressed:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getLinkURL = new MethodDescriptor(beanClass.getMethod("getLinkURL", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "URL", "",
- "%name%.getLinkURL()",
- conn.getString("getLinkURL"));
- connections.addElement(connection);
-
- getLinkURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getLinkURL);
- } catch (Exception e) { throw new Error("getLinkURL:: " + 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.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.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 = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setShowFocus = new MethodDescriptor(beanClass.getMethod("setShowFocus", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setShowFocus(%arg%);",
- conn.getString("setShowFocus"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setShowFocus(!%name%.isShowFocus());",
- conn.getString("ToggleShowFocus"));
- connections.addElement(connection);
-
- setShowFocus.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setShowFocus);
- } catch (Exception e) { throw new Error("setShowFocus:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setShowURLStatus = new MethodDescriptor(beanClass.getMethod("setShowURLStatus", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setShowURLStatus(true);",
- conn.getString("setShowURLStatus"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setShowURLStatus(false);",
- conn.getString("NotShowURLStatus"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setShowURLStatus(!%name%.isShowURLStatus());",
- conn.getString("ToggleShowURLStatus"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setShowURLStatus(%arg%);",
- conn.getString("ShowURLStatusValue"));
- connections.addElement(connection);
-
- setShowURLStatus.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setShowURLStatus);
- } catch (Exception e) { throw new Error("setShowURLStatus:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setButtonColor = new MethodDescriptor(beanClass.getMethod("setButtonColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setButtonColor(%arg%);",
- conn.getString("setButtonColor"));
- connections.addElement(connection);
-
- setButtonColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setButtonColor);
- } catch (Exception e) { throw new Error("setButtonColor:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isUseOffset = new MethodDescriptor(beanClass.getMethod("isUseOffset", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isUseOffset()",
- conn.getString("isUseOffset"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isUseOffset()",
- conn.getString("isNotUseOffset"));
- connections.addElement(connection);
-
- isUseOffset.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isUseOffset);
- } catch (Exception e) { throw new Error("isUseOffset:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setNotifyWhilePressed = new MethodDescriptor(beanClass.getMethod("setNotifyWhilePressed", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setNotifyWhilePressed(true);",
- conn.getString("setNotifyWhilePressed"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setNotifyWhilePressed(false);",
- conn.getString("NotNotifyWhilePressed"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setNotifyWhilePressed(!%name%.isNotifyWhilePressed());",
- conn.getString("ToggleNotifyWhilePressed"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setNotifyWhilePressed(%arg%);",
- conn.getString("NotifyWhilePressedValue"));
- connections.addElement(connection);
-
- setNotifyWhilePressed.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setNotifyWhilePressed);
- } catch (Exception e) { throw new Error("setNotifyWhilePressed:: " + 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 = null;
- MethodDescriptor getButtonColor = new MethodDescriptor(beanClass.getMethod("getButtonColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getButtonColor()",
- conn.getString("getButtonColor"));
- connections.addElement(connection);
-
- getButtonColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getButtonColor);
- } catch (Exception e) { throw new Error("getButtonColor:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor simulateClick = new MethodDescriptor(beanClass.getMethod("simulateClick", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.simulateClick();",
- conn.getString("simulateClick"));
- connections.addElement(connection);
-
- simulateClick.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(simulateClick);
- } catch (Exception e) { throw new Error("simulateClick:: " + 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");
- String s;
-
- try{
- PropertyDescriptor bevelHeight = new PropertyDescriptor("bevelHeight", beanClass);
- bevelHeight.setBound(true);
- bevelHeight.setConstrained(true);
- bevelHeight.setDisplayName(prop.getString("bevelHeight"));
-
- PropertyDescriptor notifyDelay = new PropertyDescriptor("notifyDelay", beanClass);
- notifyDelay.setBound(true);
- notifyDelay.setConstrained(true);
- notifyDelay.setDisplayName(prop.getString("notifyDelay"));
-
- PropertyDescriptor notifyWhilePressed = new PropertyDescriptor("notifyWhilePressed", beanClass);
- notifyWhilePressed.setBound(true);
- notifyWhilePressed.setConstrained(true);
- notifyWhilePressed.setDisplayName(prop.getString("notifyWhilePressed"));
-
- PropertyDescriptor showFocus = new PropertyDescriptor("showFocus", beanClass);
- showFocus.setBound(true);
- showFocus.setConstrained(true);
- showFocus.setDisplayName(prop.getString("showFocus"));
-
- PropertyDescriptor useOffset = new PropertyDescriptor("useOffset", beanClass);
- useOffset.setBound(true);
- useOffset.setConstrained(true);
- useOffset.setDisplayName(prop.getString("useOffset"));
-
- PropertyDescriptor showURLStatus = new PropertyDescriptor("showURLStatus", beanClass);
- showURLStatus.setBound(true);
- showURLStatus.setConstrained(true);
- showURLStatus.setDisplayName(prop.getString("showURLStatus"));
-
- PropertyDescriptor buttonColor = new PropertyDescriptor("buttonColor", beanClass);
- buttonColor.setBound(true);
- buttonColor.setConstrained(true);
- buttonColor.setDisplayName(prop.getString("buttonColor"));
-
- PropertyDescriptor borderColor = new PropertyDescriptor("borderColor", beanClass);
- borderColor.setBound(true);
- borderColor.setConstrained(true);
- borderColor.setDisplayName(prop.getString("borderColor"));
-
- PropertyDescriptor linkURL = new PropertyDescriptor("linkURL", beanClass);
- linkURL.setBound(true);
- linkURL.setConstrained(true);
- linkURL.setDisplayName(prop.getString("linkURL"));
- linkURL.setValue("URLFILTER", prop.getString("htmlURLFILTER"));
-
- PropertyDescriptor frame = new PropertyDescriptor("frame", beanClass);
- frame.setBound(true);
- frame.setConstrained(true);
- frame.setDisplayName(prop.getString("frame"));
-
- PropertyDescriptor[] rv = {
- bevelHeight,
- notifyDelay,
- notifyWhilePressed,
- showFocus,
- useOffset,
- showURLStatus,
- buttonColor,
- borderColor,
- linkURL,
- frame};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = ButtonBase.class;
-
- } // end of class ButtonBaseBeanInfo