home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
Source.bin
/
Label3DBeanInfo.java
< prev
next >
Wrap
Text File
|
1998-03-18
|
14KB
|
374 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 Label3D.
*
*/
public class Label3DBeanInfo extends SimpleBeanInfo {
/**
* Constructs a Label3DBeanInfo object.
*/
public Label3DBeanInfo() {
}
/**
* 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.setFolder(s);
bd.setToolbar(s);
bd.setWinHelp("0x123AD");
ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
s=conn.getString("INDENT_ZERO");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.INDENT_ZERO",s));
s=conn.getString("INDENT_ONE");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.INDENT_ONE",s));
s=conn.getString("INDENT_TWO");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.INDENT_TWO",s));
s=conn.getString("ALIGN_LEFT");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.ALIGN_LEFT",s));
s=conn.getString("ALIGN_CENTERED");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.ALIGN_CENTERED",s));
s=conn.getString("ALIGN_RIGHT");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.ALIGN_RIGHT",s));
s=conn.getString("BEVEL_LOWERED");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.BEVEL_LOWERED",s));
s=conn.getString("BEVEL_RAISED");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.BEVEL_RAISED",s));
s=conn.getString("BEVEL_LINE");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.BEVEL_LINE",s));
s=conn.getString("BEVEL_NONE");
bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
"%name%.BEVEL_NONE",s));
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("Label3DC16.gif");
return img;
}
if (iconKind == BeanInfo.ICON_MONO_32x32 ||
iconKind == BeanInfo.ICON_COLOR_32x32) {
java.awt.Image img = loadImage("Label3DC32.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 getBevelStyle = new MethodDescriptor(beanClass.getMethod("getBevelStyle", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getBevelStyle()",
conn.getString("getBevelStyleLabel"));
connections.addElement(connection);
getBevelStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getBevelStyle);
} catch (Exception e) { throw new Error("getBevelStyle:: " + e.toString()); }
try{
args = null;
MethodDescriptor getBorderIndent = new MethodDescriptor(beanClass.getMethod("getBorderIndent", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getBorderIndent()",
conn.getString("getBorderIndent"));
connections.addElement(connection);
getBorderIndent.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getBorderIndent);
} catch (Exception e) { throw new Error("getBorderIndent:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.String.class ;
MethodDescriptor setText = new MethodDescriptor(beanClass.getMethod("setText", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "String", "",
"%name%.setText(%arg%);",
conn.getString("setText"));
connections.addElement(connection);
setText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setText);
} catch (Exception e) { throw new Error("setText:: " + e.toString()); }
try{
args = null;
MethodDescriptor getBorderedColor = new MethodDescriptor(beanClass.getMethod("getBorderedColor", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "Color", "",
"%name%.getBorderedColor()",
conn.getString("getBorderedColor"));
connections.addElement(connection);
getBorderedColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getBorderedColor);
} catch (Exception e) { throw new Error("getBorderedColor:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.awt.Color.class ;
MethodDescriptor setTextColor = new MethodDescriptor(beanClass.getMethod("setTextColor", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "Color", "",
"%name%.setTextColor(%arg%);",
conn.getString("setTextColor"));
connections.addElement(connection);
setTextColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setTextColor);
} catch (Exception e) { throw new Error("setTextColor:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE ;
MethodDescriptor setAlignStyle = new MethodDescriptor(beanClass.getMethod("setAlignStyle", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setAlignStyle(%arg%);",
conn.getString("setAlignStyleLabel"));
connections.addElement(connection);
setAlignStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setAlignStyle);
} catch (Exception e) { throw new Error("setAlignStyle:: " + e.toString()); }
try{
args = null;
MethodDescriptor getTextColor = new MethodDescriptor(beanClass.getMethod("getTextColor", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "Color", "",
"%name%.getTextColor()",
conn.getString("getTextColorLabel"));
connections.addElement(connection);
getTextColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getTextColor);
} catch (Exception e) { throw new Error("getTextColor:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE ;
MethodDescriptor setBevelStyle = new MethodDescriptor(beanClass.getMethod("setBevelStyle", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setBevelStyle(%arg%);",
conn.getString("setBevelStyleLabel"));
connections.addElement(connection);
setBevelStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setBevelStyle);
} catch (Exception e) { throw new Error("setBevelStyle:: " + e.toString()); }
try{
args = null;
MethodDescriptor getText = new MethodDescriptor(beanClass.getMethod("getText", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "String", "",
"%name%.getText()",
conn.getString("getText"));
connections.addElement(connection);
getText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getText);
} catch (Exception e) { throw new Error("getText:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.awt.Color.class ;
MethodDescriptor setBorderedColor = new MethodDescriptor(beanClass.getMethod("setBorderedColor", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "Color", "",
"%name%.setBorderedColor(%arg%);",
conn.getString("setBorderedColor"));
connections.addElement(connection);
setBorderedColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setBorderedColor);
} catch (Exception e) { throw new Error("setBorderedColor:: " + e.toString()); }
try{
args = new Class[1];
args[0] = java.lang.Integer.TYPE ;
MethodDescriptor setBorderIndent = new MethodDescriptor(beanClass.getMethod("setBorderIndent", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("input", "int", "",
"%name%.setBorderIndent(%arg%);",
conn.getString("setBorderIndent"));
connections.addElement(connection);
setBorderIndent.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(setBorderIndent);
} catch (Exception e) { throw new Error("setBorderIndent:: " + e.toString()); }
try{
args = null;
MethodDescriptor getAlignStyle = new MethodDescriptor(beanClass.getMethod("getAlignStyle", args));
connections = new java.util.Vector();
connection = new ConnectionDescriptor("output", "int", "",
"%name%.getAlignStyle()",
conn.getString("getAlignStyle"));
connections.addElement(connection);
getAlignStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
md.addElement(getAlignStyle);
} catch (Exception e) { throw new Error("getAlignStyle:: " + 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 defProperty = new PropertyDescriptor("text", beanClass);
defProperty.setBound(true);
defProperty.setConstrained(true);
defProperty.setDisplayName(prop.getString("text"));
PropertyDescriptor alignStyle = new PropertyDescriptor("alignStyle", beanClass);
alignStyle.setBound(true);
alignStyle.setConstrained(true);
alignStyle.setDisplayName(prop.getString("alignStyle"));
alignStyle.setValue("ENUMERATION", "ALIGN_LEFT=0, ALIGN_CENTERED=1, ALIGN_RIGHT=2");
PropertyDescriptor bevelStyle = new PropertyDescriptor("bevelStyle", beanClass);
bevelStyle.setBound(true);
bevelStyle.setConstrained(true);
bevelStyle.setDisplayName(prop.getString("bevelStyle"));
bevelStyle.setValue("ENUMERATION", "BEVEL_LOWERED=0, BEVEL_RAISED=1, BEVEL_LINE=2, BEVEL_NONE=3");
PropertyDescriptor borderIndent = new PropertyDescriptor("borderIndent", beanClass);
borderIndent.setBound(true);
borderIndent.setConstrained(true);
borderIndent.setDisplayName(prop.getString("borderIndent"));
borderIndent.setValue("ENUMERATION", "INDENT_ZERO, INDENT_ONE, INDENT_TWO");
PropertyDescriptor borderedColor = new PropertyDescriptor("borderedColor", beanClass);
borderedColor.setBound(true);
borderedColor.setConstrained(true);
borderedColor.setDisplayName(prop.getString("borderedColor"));
PropertyDescriptor textColor = new PropertyDescriptor("textColor", beanClass);
textColor.setBound(true);
textColor.setConstrained(true);
textColor.setDisplayName(prop.getString("textColor"));
PropertyDescriptor[] rv = {
defProperty,
alignStyle,
bevelStyle,
borderIndent,
borderedColor,
textColor};
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 = Label3D.class;
} // end of class Label3DBeanInfo