home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
TreeViewBeanInfo.java
< prev
next >
Wrap
Text File
|
1998-08-21
|
7KB
|
198 lines
package symantec.itools.awt;
import java.beans.*;
import symantec.itools.beans.*;
import java.util.ResourceBundle;
// 09/07/97 LAB Fixed misspelling of descriptions.
// 10/09/97 LAB Added setShortDescription for treeStructure.
// 08/19/98 LAB Moved to GroupAWTAdditions folder.
/**
* BeanInfo for TreeView.
*
*/
public class TreeViewBeanInfo extends SimpleBeanInfo {
/**
* Constructs a TreeViewBeanInfo object.
*/
public TreeViewBeanInfo() {
}
/**
* 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("GroupAWTAdditions");
SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
bd.setCanAddChild(false);
bd.setFolder(s);
bd.setWinHelp("0x12398");
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("TreeViewC16.gif");
return img;
}
if (iconKind == BeanInfo.ICON_MONO_32x32 ||
iconKind == BeanInfo.ICON_COLOR_32x32) {
java.awt.Image img = loadImage("TreeViewC32.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 = null;
MethodDescriptor getCount = new MethodDescriptor(beanClass.getMethod("getCount", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getCount()",
conn.getString("getCount"));
connections.addElement(connection);
getCount.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getCount);
} catch (Exception e) { throw new Error("getCount:: " + e.toString()); }
try{
args = null;
MethodDescriptor getSelectedText = new MethodDescriptor(beanClass.getMethod("getSelectedText", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "String", "",
"%name%.getSelectedText()",
conn.getString("getSelectedText"));
connections.addElement(connection);
getSelectedText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getSelectedText);
} catch (Exception e) { throw new Error("getSelectedText:: " + e.toString()); }
try{
args = null;
MethodDescriptor getViewCount = new MethodDescriptor(beanClass.getMethod("getViewCount", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getViewCount()",
conn.getString("getViewCount"));
connections.addElement(connection);
getViewCount.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getViewCount);
} catch (Exception e) { throw new Error("getViewCount:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.String.class ;
MethodDescriptor remove = new MethodDescriptor(beanClass.getMethod("remove", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "String", "",
"%name%.remove(%arg%);",
conn.getString("remove"));
connections.addElement(connection);
remove.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(remove);
} catch (Exception e) { throw new Error("remove:: " + e.toString()); }
try{
args = new Class[2];
args[0] = symantec.itools.awt.TreeNode.class ;
args[1] = java.lang.Boolean.TYPE ;
MethodDescriptor printTree = new MethodDescriptor(beanClass.getMethod("printTree", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.printTree(%name%.getRootNode(), true);",
conn.getString("printTree"));
connections.addElement(connection);
printTree.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(printTree);
} catch (Exception e) { throw new Error("printTree:: " + 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 treeStructure = new PropertyDescriptor("treeStructure", beanClass);
treeStructure.setBound(true);
treeStructure.setConstrained(false);
treeStructure.setDisplayName(prop.getString("treeStructure"));
treeStructure.setShortDescription(prop.getString("TVSDescription"));
PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
layout.setHidden(true);
PropertyDescriptor[] rv = {
treeStructure,
layout};
return rv;
} catch (IntrospectionException e) { throw new Error(e.toString()); }
}
private final static Class beanClass = TreeView.class;
} // end of class TreeViewBeanInfo