home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 7.2 KB | 219 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 09/07/97 LAB Fixed misspelling of descriptions.
-
- /**
- * BeanInfo for InvisibleHTMLLink.
- *
- */
- public class InvisibleHTMLLinkBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a InvisibleHTMLLinkBeanInfo object.
- */
- public InvisibleHTMLLinkBeanInfo() {
- }
-
- /**
- * 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.setWinHelp("0x12392");
- bd.setFolder(s);
- bd.setToolbar(s);
-
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
- s=conn.getString("currentFrame");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
- "\"_self\"",s));
-
- s=conn.getString("parentFrame");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
- "\"_parent\"",s));
-
- s=conn.getString("topmostFrame");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
- "\"_top\"",s));
-
- s=conn.getString("unnamedFrame");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
- "\"_blank\"",s));
-
- bd.addAdditionalConnections(getAdditionalBeanInfo());
-
- 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("InvisibleHTMLLinkC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("InvisibleHTMLLinkC32.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");
- String s;
-
- try{
- args = null;
- MethodDescriptor getURL = new MethodDescriptor(beanClass.getMethod("getURL", args));
-
- connections = new java.util.Vector();
- s=conn.getString("getURL");
- connection = new ConnectionDescriptor("output", "URL", "",
- "%name%.getURL()",s);
- 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();
- s=conn.getString("setURLRelative");
- connection = new ConnectionDescriptor("input", "RelativeURL", "",
- "%name%.setURL(symantec.itools.net.RelativeURL.getURL(%arg%));",s);
- connections.addElement(connection);
-
- s=conn.getString("setURL");
- connection = new ConnectionDescriptor("input", "URL", "",
- "%name%.setURL(%arg%);",s);
- 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();
- s=conn.getString("setFrame");
- connection = new ConnectionDescriptor("input", "String", "",
- "%name%.setFrame(%arg%);",s);
- connections.addElement(connection);
-
- setFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setFrame);
- } catch (Exception e) { throw new Error("setFrame:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getFrame = new MethodDescriptor(beanClass.getMethod("getFrame", args));
-
- connections = new java.util.Vector();
- s=conn.getString("getFrame");
- connection = new ConnectionDescriptor("output", "String", "",
- "%name%.getFrame()",s);
- connections.addElement(connection);
-
- getFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getFrame);
- } catch (Exception e) { throw new Error("getFrame:: " + 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 defProperty = new PropertyDescriptor("uRL", beanClass);
- defProperty.setBound(true);
- defProperty.setConstrained(true);
- s=prop.getString("linkURL");
- defProperty.setDisplayName(s);
- s=prop.getString("htmlURLFILTER");
- defProperty.setValue("URLFILTER", s);
-
- PropertyDescriptor frame = new PropertyDescriptor("frame", beanClass);
- frame.setBound(true);
- frame.setConstrained(true);
- s=prop.getString("frame");
- frame.setDisplayName(s);
-
- PropertyDescriptor[] rv = {
- defProperty,
- frame};
- 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 = InvisibleHTMLLink.class;
-
- } // end of class InvisibleHTMLLinkBeanInfo