/**
* @author Roedy Green of Canadian Mind Products
* version 1 1977 December 10
* 1977 December 11 - added Symantec Folder/Component lib
*/
package business.awt;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
public class Date_CABeanInfo extends SimpleBeanInfo
{
/**
* Standard boilerplate provides caller with additional bean information
* on properties that our bean inherited,
* e.g. setForeground, setBackground.
* Any information our getPropertyDescriptors provides
* will take precedence over this.
*/
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() );
}
}
/**
* returns an Image for use in the component library or toolbar
* to represent this bean.
* Icon images are in GIF format. 16x16 or 32x32.
* *.gif files live in the same directory as this class.
* Ideally you should support all 4 flavours,
* but colour 16x16 would suffice, at least for Symantec.
* To get icons, design your own with transparent backgrounds
* using a program like JASC Paint Shop Pro.
* In a pinch just a coloured square will do.
* Steal some from Symantec's D:/VCP/bin/components.symbeans.jar
* using WinZip and modify them.
* Capture some off the screen with JASC's Paint Shop Pro capture.
* Then crop and modify.
*/
public java.awt.Image getIcon( int iconKind )
{
if ( iconKind == BeanInfo.ICON_COLOR_16x16 ||
iconKind == BeanInfo.ICON_MONO_16x16 )
{
java.awt.Image img = loadImage( "Date_CAC16.gif" );
return img;
}
if ( iconKind == BeanInfo.ICON_COLOR_32x32 ||
iconKind == BeanInfo.ICON_MONO_32x32 )
{
java.awt.Image img = loadImage( "Date_CAC32.gif" );
return img;
}
return null;
}
/**
* returns an array of PropertyDescriptors which describe
* the editable properties of this bean.
* In addition to those specified here,
* there will be the inherited properties, provided by
* getAdditionalBeanInfo.
* We are allowed to override BeanInfo of
* inherited properties. Most commonly you hide an
* inherited property so it won't be exposed to the editor.
* We don't describe the type of each Property.
* That is discovered by introspection of the
* corresponding bean class file.
*/
public PropertyDescriptor[] getPropertyDescriptors()
{
try
{
PropertyDescriptor aid =
new PropertyDescriptor( "Aid", beanClass );
aid.setHidden( true );
PropertyDescriptor highest =
new PropertyDescriptor( "Highest", beanClass );
PropertyDescriptor lowest =
new PropertyDescriptor( "Lowest", beanClass );
PropertyDescriptor label =
new PropertyDescriptor( "Label", beanClass );
PropertyDescriptor mask =
new PropertyDescriptor( "Mask", beanClass );
mask.setHidden( true );
PropertyDescriptor mustEnter =
new PropertyDescriptor( "MustEnter", beanClass );
mustEnter.setDisplayName( "Must Enter" ) ;
PropertyDescriptor prompt =
new PropertyDescriptor( "Prompt", beanClass );
PropertyDescriptor text =
new PropertyDescriptor( "Text", beanClass );
text.setHidden( true );
PropertyDescriptor value =
new PropertyDescriptor("Value", beanClass );
PropertyDescriptor rv[] = {
aid, highest, label,
lowest, mask, mustEnter,
prompt, text, value};
return rv;
}
catch ( IntrospectionException e )
{
throw new Error( e.toString() );
}
}
/**
* Symantec extensions to allow control over folder and toolbar placement and help.
* Leave this out for other IDEs.
*/
public java.beans.BeanDescriptor getBeanDescriptor()
{
SymantecBeanDescriptor bd = new SymantecBeanDescriptor( beanClass );
bd.setFolder( "CMP" );
bd.setToolbar( "CMP" );
return bd;
}
private final static Class beanClass = business.awt.Date_CA.class;
}