home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 19.3 KB | 495 lines |
- package symantec.itools.awt.util;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 08/26/97 LAB Updated connections for static values. Changed borderedColor to borderColor.
- // Changed english descriptions of properties to be consistant with property names
- // (Addresses Mac Bug #7500). Updated names of connections to be correct.
- // Removed connections associated with deprecated properties. Added connections
- // to support the BevelStyle property. Added connections for AlignStyle property.
-
- /**
- * BeanInfo for ProgressBar.
- *
- */
-
- public class ProgressBarBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a ProgressBarBeanInfo object.
- */
- public ProgressBarBeanInfo() {
- }
-
- /**
- * 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("GroupUtility");
-
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setFolder(s);
- bd.setToolbar(s);
- bd.setWinHelp("0x12395");
-
- ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.BEVEL_LOWERED", conn.getString("BEVEL_LOWERED")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.BEVEL_RAISED", conn.getString("BEVEL_RAISED")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.BEVEL_LINE", conn.getString("BEVEL_LINE")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.BEVEL_NONE", conn.getString("BEVEL_NONE")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.ALIGN_LEFT", conn.getString("ALIGN_LEFT")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.ALIGN_CENTERED",conn.getString("ALIGN_CENTERED")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.ALIGN_RIGHT",conn.getString("ALIGN_RIGHT")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.INDENT_ZERO", conn.getString("INDENT_ZERO")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.INDENT_ONE", conn.getString("INDENT_ONE")));
- bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "", "%name%.INDENT_TWO", conn.getString("INDENT_TWO")));
-
-
- 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("ProgressBarC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("ProgressBarC32.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 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 = null;
- MethodDescriptor getBoxWidth = new MethodDescriptor(beanClass.getMethod("getBoxWidth", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getBoxWidth()",
- conn.getString("getBoxWidth"));
- connections.addElement(connection);
-
- getBoxWidth.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getBoxWidth);
- } catch (Exception e) { throw new Error("getBoxWidth:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setBoxWidth = new MethodDescriptor(beanClass.getMethod("setBoxWidth", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setBoxWidth(%arg%);",
- conn.getString("setBoxWidth"));
- connections.addElement(connection);
-
- setBoxWidth.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setBoxWidth);
- } catch (Exception e) { throw new Error("setBoxWidth:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getBorderColor = new MethodDescriptor(beanClass.getMethod("getBorderColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getBorderColor()",
- conn.getString("getBorderColor"));
- connections.addElement(connection);
-
- getBorderColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getBorderColor);
- } catch (Exception e) { throw new Error("getBorderColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setShowProgress = new MethodDescriptor(beanClass.getMethod("setShowProgress", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setShowProgress(%arg%);",
- conn.getString("setShowProgress"));
- connections.addElement(connection);
-
- setShowProgress.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setShowProgress);
- } catch (Exception e) { throw new Error("setShowProgress:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isShowProgress = new MethodDescriptor(beanClass.getMethod("isShowProgress", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isShowProgress()",
- conn.getString("isShowProgress"));
- connections.addElement(connection);
-
- isShowProgress.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isShowProgress);
- } catch (Exception e) { throw new Error("isShowProgress:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getGapWidth = new MethodDescriptor(beanClass.getMethod("getGapWidth", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getGapWidth()",
- conn.getString("getGapWidth"));
- connections.addElement(connection);
-
- getGapWidth.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getGapWidth);
- } catch (Exception e) { throw new Error("getGapWidth:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setGapWidth = new MethodDescriptor(beanClass.getMethod("setGapWidth", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setGapWidth(%arg%);",
- conn.getString("setGapWidth"));
- connections.addElement(connection);
-
- setGapWidth.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setGapWidth);
- } catch (Exception e) { throw new Error("setGapWidth:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isDrawBoxes = new MethodDescriptor(beanClass.getMethod("isDrawBoxes", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isDrawBoxes()",
- conn.getString("isDrawBoxes"));
- connections.addElement(connection);
-
- isDrawBoxes.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isDrawBoxes);
- } catch (Exception e) { throw new Error("isDrawBoxes:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setValue = new MethodDescriptor(beanClass.getMethod("setValue", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setValue(%arg%);",
- conn.getString("setValueProgress"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setValue(%name%.getValue() + %arg%);",
- conn.getString("setValueProgressInc"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setValue(%name%.getValue() - %arg%);",
- conn.getString("setValueProgressDec"));
- connections.addElement(connection);
-
- setValue.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setValue);
- } catch (Exception e) { throw new Error("setValue:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setDrawBoxes = new MethodDescriptor(beanClass.getMethod("setDrawBoxes", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setDrawBoxes(%arg%);",
- conn.getString("setDrawBoxes"));
- connections.addElement(connection);
-
- setDrawBoxes.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setDrawBoxes);
- } catch (Exception e) { throw new Error("setDrawBoxes:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getProgressBarColor = new MethodDescriptor(beanClass.getMethod("getProgressBarColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getProgressBarColor()",
- conn.getString("getProgressBarColor"));
- connections.addElement(connection);
-
- getProgressBarColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getProgressBarColor);
- } catch (Exception e) { throw new Error("getProgressBarColor:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setBorderColor = new MethodDescriptor(beanClass.getMethod("setBorderColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setBorderColor(%arg%);",
- conn.getString("setBorderColor"));
- connections.addElement(connection);
-
- setBorderColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setBorderColor);
- } catch (Exception e) { throw new Error("setBorderColor:: " + 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 getValue = new MethodDescriptor(beanClass.getMethod("getValue", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getValue()",
- conn.getString("getValueProgress"));
- connections.addElement(connection);
-
- getValue.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getValue);
- } catch (Exception e) { throw new Error("getValue:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setProgressBarColor = new MethodDescriptor(beanClass.getMethod("setProgressBarColor", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setProgressBarColor(%arg%);",
- conn.getString("setProgressBarColor"));
- connections.addElement(connection);
-
- setProgressBarColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setProgressBarColor);
- } catch (Exception e) { throw new Error("setProgressBarColor:: " + e.toString()); }
-
- 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("getBevelStyle"));
- connections.addElement(connection);
-
- getBevelStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getBevelStyle);
- } catch (Exception e) { throw new Error("getBevelStyle:: " + 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()); }
-
- 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("setBevelStyle"));
- connections.addElement(connection);
-
- setBevelStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setBevelStyle);
- } catch (Exception e) { throw new Error("setBevelStyle:: " + 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("setAlignStyle"));
- connections.addElement(connection);
-
- setAlignStyle.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setAlignStyle);
- } catch (Exception e) { throw new Error("setAlignStyle:: " + 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 progressBarColor = new PropertyDescriptor("progressBarColor", beanClass);
- progressBarColor.setBound(true);
- progressBarColor.setConstrained(true);
- progressBarColor.setDisplayName(prop.getString("progressBarColor"));
-
- PropertyDescriptor borderColor = new PropertyDescriptor("borderColor", beanClass);
- borderColor.setBound(true);
- borderColor.setConstrained(true);
- borderColor.setDisplayName(prop.getString("borderColor"));
-
- PropertyDescriptor drawBoxes = new PropertyDescriptor("drawBoxes", beanClass);
- drawBoxes.setBound(true);
- drawBoxes.setConstrained(true);
- drawBoxes.setDisplayName(prop.getString("drawBoxes"));
-
- PropertyDescriptor boxWidth = new PropertyDescriptor("boxWidth", beanClass);
- boxWidth.setBound(true);
- boxWidth.setConstrained(true);
- boxWidth.setDisplayName(prop.getString("boxWidth"));
-
- PropertyDescriptor gapWidth = new PropertyDescriptor("gapWidth", beanClass);
- gapWidth.setBound(true);
- gapWidth.setConstrained(true);
- gapWidth.setDisplayName(prop.getString("gapWidth"));
-
- PropertyDescriptor showProgress = new PropertyDescriptor("showProgress", beanClass);
- showProgress.setBound(true);
- showProgress.setConstrained(true);
- showProgress.setDisplayName(prop.getString("showProgress"));
-
- 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 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 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 value = new PropertyDescriptor("value", beanClass);
- value.setBound(true);
- value.setConstrained(true);
- value.setDisplayName(prop.getString("value"));
-
- PropertyDescriptor[] rv = {
- progressBarColor,
- borderColor,
- drawBoxes,
- boxWidth,
- gapWidth,
- showProgress,
- bevelStyle,
- alignStyle,
- borderIndent,
- value};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = ProgressBar.class;
-
- } // end of class ProgressBarBeanInfo