home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
prosrc.bin
/
ImageViewerBeanInfo.java
< prev
next >
Wrap
Text File
|
1998-03-18
|
5KB
|
169 lines
/*
* @(#ImageViewerBeanInfo.java
*
* Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
*
*/
package symantec.itools.db.awt;
import java.beans.*;
import symantec.itools.beans.*;
import java.util.ResourceBundle;
/**
* BeanInfo for the ImageViewer component.
*
*/
public class ImageViewerBeanInfo extends SimpleBeanInfo {
/**
* Constructs a ImageViewerBeanInfo object.
*/
public ImageViewerBeanInfo() {
}
/**
* Gets BeanInfo for the superclass of this bean.
* @return BeanInfo[] containing this bean's superclass BeanInfo
*/
public BeanInfo[] getAdditionalBeanInfo() {
try {
java.util.Vector v = new java.util.Vector();
BeanInfo[] rv;
BeanInfo b;
Class c = beanClass.getSuperclass();
while (c.isAssignableFrom(Object.class) != true) {
b = Introspector.getBeanInfo(c);
v.addElement(b);
c = c.getSuperclass();
}
rv = new BeanInfo[v.size()];
v.copyInto(rv);
return rv;
}
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);
bd.setFolder("dbAWARE");
bd.setToolbar("dbAWARE");
// bd.setValue("VPO_Object", new Boolean(true));
bd.setWinHelp("0x123CA");
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("ImageViewerC16.gif");
return img;
}
if (iconKind == BeanInfo.ICON_MONO_32x32 ||
iconKind == BeanInfo.ICON_COLOR_32x32) {
java.awt.Image img = loadImage("ImageViewerC32.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();
try{
args = new Class[1];
args[0] = java.lang.String.class ;
MethodDescriptor fetchImage = new MethodDescriptor(beanClass.getMethod("fetchImage", args));
connections = new java.util.Vector();
{
connection = new ConnectionDescriptor();
connection.setForm("input");
connection.setType("String");
StringBuffer code = new StringBuffer();
code.append("%name%.fetchImage(%arg%);\n");
connection.setExpr(code.toString());
connection.setShortDescription("Fetch an image from");
connections.addElement(connection);
}
fetchImage.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(fetchImage);
} catch (Exception e) { throw new Error("setFileName:: " + e.toString()); }
MethodDescriptor[] rv = new MethodDescriptor[md.size()];
md.copyInto(rv);
return rv;
}
/**
* Gets an array of descriptions of this bean's properties.
* @return property descriptions for this bean
*/
public PropertyDescriptor[] getPropertyDescriptors() {
ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.db.resources.PropBundle");
try{
PropertyDescriptor dataBinding = new PropertyDescriptor("dataBinding", beanClass);
dataBinding.setBound(false);
dataBinding.setConstrained(false);
dataBinding.setDisplayName(prop.getString("dataBinding"));
dataBinding.setPropertyEditorClass(symantec.itools.db.beans.binding.NameEditor.class);
PropertyDescriptor[] rv = {
dataBinding,
};
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 = ImageViewer.class;
} // end of class ImageViewerBeanInfo|