home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
prosrc.bin
/
DBTstampBeanInfo.java
< prev
next >
Wrap
Text File
|
1998-03-18
|
10KB
|
300 lines
/*
* @(#DBTstampBeanInfo.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 DBTstamp component.
*
*/
public class DBTstampBeanInfo extends SimpleBeanInfo {
/**
* Constructs a DBTstampBeanInfo object.
*/
public DBTstampBeanInfo() {
}
/**
* 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.setWinHelp("0x12584");
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("DBTstampC16.gif");
return img;
}
if (iconKind == BeanInfo.ICON_MONO_32x32 ||
iconKind == BeanInfo.ICON_COLOR_32x32) {
java.awt.Image img = loadImage("DBTstampC16.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.db.resources.ConnBundle");
try{
args = new Class[1];
args[0] = java.awt.event.ActionEvent.class ;
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("actionPerformed", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "ActionEvent", "",
"%name%.actionPerformed(%arg%);",
conn.getString("actionPerformed"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("actionPerformed:: " + e.toString()); }
try{
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("printTstamp", null));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.printTstamp();",
conn.getString("printTstamp"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("actionPerformed:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.String.class ;
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("setDisplayFormat", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "String", "",
"%name%.setDisplayFormat(%arg%);",
conn.getString("setDisplayFormat"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("actionPerformed:: " + e.toString()); }
try{
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("getDisplayFormat", null));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "String", "",
"%name%.getDisplayFormat()",
conn.getString("getDisplayFormat"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("actionPerformed:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.String.class ;
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("setEntryFormat", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "String", "",
"%name%.setEntryFormat(%arg%);",
conn.getString("setEntryFormat"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("setEntryFormat:: " + e.toString()); }
try{
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("getEntryFormat", null));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "String", "",
"%name%.getEntryFormat()",
conn.getString("getEntryFormat"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("getEntryFormat:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.String.class ;
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("setTstamp", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "String", "",
"%name%.setTstamp(%arg%);",
conn.getString("setTstampString"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("setTstamp:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.util.Date.class ;
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("setTstamp", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "Date", "",
"%name%.setTstamp(%arg%);",
conn.getString("setTstampDate"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("setTstamp:: " + e.toString()); }
try{
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("setinequalout", null));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "void", "",
"%name%.setinequalout();",
conn.getString("setinequalout"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("setTstamp:: " + e.toString()); }
try{
MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("getDate", null));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "Date", "",
"%name%.getDate()",
conn.getString("getDate"));
connections.addElement(connection);
setStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setStyle);
} catch (Exception e) { throw new Error("getDate:: " + 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 type = new PropertyDescriptor("type", beanClass);
type.setBound(true);
type.setConstrained(false);
type.setDisplayName("Data Type");
type.setValue("ENUMERATION", "Timestamp=0,Date=1,Time=2");*/
PropertyDescriptor displayFormat = new PropertyDescriptor("displayFormat", beanClass);
displayFormat.setBound(true);
displayFormat.setConstrained(false);
displayFormat.setDisplayName(prop.getString("displayFormat"));
PropertyDescriptor entryFormat = new PropertyDescriptor("entryFormat", beanClass);
entryFormat.setBound(true);
entryFormat.setConstrained(false);
entryFormat.setDisplayName(prop.getString("entryFormat"));
PropertyDescriptor emptyData = new PropertyDescriptor("emptyMeansNull", beanClass);
emptyData.setBound(false);
emptyData.setConstrained(false);
emptyData.setDisplayName(prop.getString("emptyMeansNull"));
PropertyDescriptor pd1 = new PropertyDescriptor("dataBinding", beanClass);
pd1.setBound(false);
pd1.setConstrained(false);
pd1.setDisplayName(prop.getString("dataBinding"));
pd1.setPropertyEditorClass(symantec.itools.db.beans.binding.NameEditor.class);
PropertyDescriptor[] rv = {
emptyData,
displayFormat,
entryFormat,
pd1
};
return rv;
} catch (IntrospectionException e) { throw new Error(e.toString()); }
}
private final static Class beanClass = DBTstamp.class;
} // end of class DBTstampBeanInfo|