home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 21.0 KB | 569 lines |
- package symantec.itools.awt;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
- // 07/14/97 LAB Added allowSorting property and connections.
- // 07/29/97 CAR corrected typo in allowSorting property descriptor section
- // 08/07/97 RKM Removed color from property names
- // Changed BackGround/ForeGround to Background & Foreground respectively
- // 08/10/97 RKM Corrected allowSorting and multiMode to use custom getter and setter
- // 08/14/97 CAR commented out method descriptor for getColumnSize
- // 09/19/97 RKM Fixed Toggle Allow Sorting connection
- // Removed 08/10/97 "fix" - it wasn't a problem
- // Fixed Set Allow Sorting connection
- // Added setShortDescription for List Items
-
- /**
- * BeanInfo for MultiList.
- *
- */
-
- public class MultiListBeanInfo extends SimpleBeanInfo {
-
- /**
- * Constructs a MultiListBeanInfo object.
- */
- public MultiListBeanInfo() {
- }
-
- /**
- * 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.setCanAddChild(false);
- bd.setWinHelp("0x12393");
- bd.setFolder(s);
- bd.setToolbar(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("MultiListC16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("MultiListC32.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 = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setHeadingBg = new MethodDescriptor(beanClass.getMethod("setHeadingBg", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setHeadingBg(%arg%);",
- conn.getString("setHeadingBg"));
- connections.addElement(connection);
-
- setHeadingBg.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setHeadingBg);
- } catch (Exception e) { throw new Error("setHeadingBg:: " + e.toString()); }
-
- try{
- args = new Class[2];
- args[0] = java.lang.Integer.TYPE ;
- args[1] = java.lang.Integer.TYPE ;
- MethodDescriptor setColumnAlignment = new MethodDescriptor(beanClass.getMethod("setColumnAlignment", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setColumnAlignment(%arg%, %name%.LEFT);",
- conn.getString("setColumnAlignmentLeft"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setColumnAlignment(%arg%, %name%.CENTER);",
- conn.getString("setColumnAlignmentCenter"));
- connections.addElement(connection);
-
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setColumnAlignment(%arg%, %name%.RIGHT);",
- conn.getString("setColumnAlignmentRight"));
- connections.addElement(connection);
-
- setColumnAlignment.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setColumnAlignment);
- } catch (Exception e) { throw new Error("setColumnAlignment:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setCellFg = new MethodDescriptor(beanClass.getMethod("setCellFg", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setCellFg(%arg%);",
- conn.getString("setCellFg"));
- connections.addElement(connection);
-
- setCellFg.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setCellFg);
- } catch (Exception e) { throw new Error("setCellFg:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getCellFont = new MethodDescriptor(beanClass.getMethod("getCellFont", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Font", "",
- "%name%.getCellFont()",
- conn.getString("getCellFont"));
- connections.addElement(connection);
-
- getCellFont.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getCellFont);
- } catch (Exception e) { throw new Error("getCellFont:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Font.class ;
- MethodDescriptor setCellFont = new MethodDescriptor(beanClass.getMethod("setCellFont", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Font", "",
- "%name%.setCellFont(%arg%);",
- conn.getString("setCellFont"));
- connections.addElement(connection);
-
- setCellFont.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setCellFont);
- } catch (Exception e) { throw new Error("setCellFont:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setNumberOfCols = new MethodDescriptor(beanClass.getMethod("setNumberOfCols", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setNumberOfCols(%arg%);",
- conn.getString("setNumberOfCols"));
- connections.addElement(connection);
-
- setNumberOfCols.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setNumberOfCols);
- } catch (Exception e) { throw new Error("setNumberOfCols:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getHeadingFg = new MethodDescriptor(beanClass.getMethod("getHeadingFg", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getHeadingFg()",
- conn.getString("getHeadingFg"));
- connections.addElement(connection);
-
- getHeadingFg.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getHeadingFg);
- } catch (Exception e) { throw new Error("getHeadingFg:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getCellBg = new MethodDescriptor(beanClass.getMethod("getCellBg", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getCellBg()",
- conn.getString("getCellBg"));
- connections.addElement(connection);
-
- getCellBg.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getCellBg);
- } catch (Exception e) { throw new Error("getCellBg:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getHeadingFont = new MethodDescriptor(beanClass.getMethod("getHeadingFont", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Font", "",
- "%name%.getHeadingFont()",
- conn.getString("getHeadingFont"));
- connections.addElement(connection);
-
- getHeadingFont.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getHeadingFont);
- } catch (Exception e) { throw new Error("getHeadingFont:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setCellBg = new MethodDescriptor(beanClass.getMethod("setCellBg", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setCellBg(%arg%);",
- conn.getString("setCellBg"));
- connections.addElement(connection);
-
- setCellBg.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setCellBg);
- } catch (Exception e) { throw new Error("setCellBg:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Color.class ;
- MethodDescriptor setHeadingFg = new MethodDescriptor(beanClass.getMethod("setHeadingFg", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Color", "",
- "%name%.setHeadingFg(%arg%);",
- conn.getString("setHeadingFg"));
- connections.addElement(connection);
-
- setHeadingFg.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setHeadingFg);
- } catch (Exception e) { throw new Error("setHeadingFg:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.awt.Font.class ;
- MethodDescriptor setHeadingFont = new MethodDescriptor(beanClass.getMethod("setHeadingFont", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "Font", "",
- "%name%.setHeadingFont(%arg%);",
- conn.getString("setHeadingFont"));
- connections.addElement(connection);
-
- setHeadingFont.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setHeadingFont);
- } catch (Exception e) { throw new Error("setHeadingFont:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getNumberOfCols = new MethodDescriptor(beanClass.getMethod("getNumberOfCols", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getNumberOfCols()",
- conn.getString("getNumberOfCols"));
- connections.addElement(connection);
-
- getNumberOfCols.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getNumberOfCols);
- } catch (Exception e) { throw new Error("getNumberOfCols:: " + e.toString()); }
-
- /*
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor getColumnSize = new MethodDescriptor(beanClass.getMethod("getColumnSize", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getColumnSize(%arg%)",
- conn.getString("getColumnSize"));
- connections.addElement(connection);
-
- getColumnSize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getColumnSize);
- } catch (Exception e) { throw new Error("getColumnSize:: " + e.toString()); }
- */
-
- try{
- args = null;
- MethodDescriptor getHeadingBg = new MethodDescriptor(beanClass.getMethod("getHeadingBg", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getHeadingBg()",
- conn.getString("getHeadingBg"));
- connections.addElement(connection);
-
- getHeadingBg.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getHeadingBg);
- } catch (Exception e) { throw new Error("getHeadingBg:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor clear = new MethodDescriptor(beanClass.getMethod("clear", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.clear();",
- conn.getString("clearMList"));
- connections.addElement(connection);
-
- clear.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(clear);
- } catch (Exception e) { throw new Error("clear:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getSelectedRow = new MethodDescriptor(beanClass.getMethod("getSelectedRow", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "int", "",
- "%name%.getSelectedRow()",
- conn.getString("getSelectedRow"));
- connections.addElement(connection);
-
- getSelectedRow.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getSelectedRow);
- } catch (Exception e) { throw new Error("getSelectedRow:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getCellFg = new MethodDescriptor(beanClass.getMethod("getCellFg", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "Color", "",
- "%name%.getCellFg()",
- conn.getString("getCellFg"));
- connections.addElement(connection);
-
- getCellFg.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(getCellFg);
- } catch (Exception e) { throw new Error("getCellFg:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor createColumns = new MethodDescriptor(beanClass.getMethod("createColumns", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.createColumns(%arg%);",
- conn.getString("createColumns"));
- connections.addElement(connection);
-
- createColumns.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(createColumns);
- } catch (Exception e) { throw new Error("createColumns:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor setSelectedRow = new MethodDescriptor(beanClass.getMethod("setSelectedRow", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.setSelectedRow(%arg%);",
- conn.getString("setSelectedRow"));
- connections.addElement(connection);
-
- setSelectedRow.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setSelectedRow);
- } catch (Exception e) { throw new Error("setSelectedRow:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Boolean.TYPE ;
- MethodDescriptor setAllowSorting = new MethodDescriptor(beanClass.getMethod("setAllowSorting", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.setAllowSorting(!%name%.isAllowSorting());",
- conn.getString("setAllowSortingToggle"));
- connections.addElement(connection);
- connection = new ConnectionDescriptor("input", "boolean", "",
- "%name%.setAllowSorting(%arg%);",
- conn.getString("setAllowSortingValue"));
- connections.addElement(connection);
-
- setAllowSorting.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(setAllowSorting);
- } catch (Exception e) { throw new Error("setAllowSorting:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor isAllowSorting = new MethodDescriptor(beanClass.getMethod("isAllowSorting", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("output", "boolean", "",
- "%name%.isAllowSorting()",
- conn.getString("isAllowSorting"));
- connections.addElement(connection);
- connection = new ConnectionDescriptor("output", "boolean", "",
- "!%name%.isAllowSorting()",
- conn.getString("isNotAllowSorting"));
- connections.addElement(connection);
-
- isAllowSorting.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(isAllowSorting);
- } catch (Exception e) { throw new Error("isAllowSorting:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor selectAll = new MethodDescriptor(beanClass.getMethod("selectAll", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.selectAll();",
- conn.getString("selectAllMList"));
- connections.addElement(connection);
-
- selectAll.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(selectAll);
- } catch (Exception e) { throw new Error("selectAll:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor deselectAll = new MethodDescriptor(beanClass.getMethod("deselectAll", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.deselectAll();",
- conn.getString("deselectAllMList"));
- connections.addElement(connection);
-
- deselectAll.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(deselectAll);
- } catch (Exception e) { throw new Error("deselectAll:: " + 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 cellFont = new PropertyDescriptor("cellFont", beanClass);
- cellFont.setBound(true);
- cellFont.setConstrained(true);
- cellFont.setDisplayName(prop.getString("cellFont"));
-
- PropertyDescriptor cellBg = new PropertyDescriptor("cellBg", beanClass);
- cellBg.setBound(true);
- cellBg.setConstrained(true);
- cellBg.setDisplayName(prop.getString("cellBg"));
-
- PropertyDescriptor cellFg = new PropertyDescriptor("cellFg", beanClass);
- cellFg.setBound(true);
- cellFg.setConstrained(true);
- cellFg.setDisplayName(prop.getString("cellFg"));
-
- PropertyDescriptor headingBg = new PropertyDescriptor("headingBg", beanClass);
- headingBg.setBound(true);
- headingBg.setConstrained(true);
- headingBg.setDisplayName(prop.getString("headingBg"));
-
- PropertyDescriptor headingFg = new PropertyDescriptor("headingFg", beanClass);
- headingFg.setBound(true);
- headingFg.setConstrained(true);
- headingFg.setDisplayName(prop.getString("headingFg"));
-
- PropertyDescriptor headingFont = new PropertyDescriptor("headingFont", beanClass);
- headingFont.setBound(true);
- headingFont.setConstrained(true);
- headingFont.setDisplayName(prop.getString("headingFont"));
-
- PropertyDescriptor headings = new PropertyDescriptor("headings", beanClass);
- headings.setBound(true);
- headings.setConstrained(true);
- headings.setDisplayName(prop.getString("headings"));
-
- PropertyDescriptor listItems = new PropertyDescriptor("listItems", beanClass);
- listItems.setBound(true);
- listItems.setConstrained(true);
- listItems.setDisplayName(prop.getString("listItems"));
- listItems.setShortDescription(prop.getString("multiListSDescription"));
-
- PropertyDescriptor columnSizes = new PropertyDescriptor("columnSizes", beanClass);
- columnSizes.setBound(true);
- columnSizes.setConstrained(true);
- columnSizes.setDisplayName(prop.getString("columnSizes"));
-
- PropertyDescriptor columnAlignments = new PropertyDescriptor("columnAlignments", beanClass);
- columnAlignments.setBound(true);
- columnAlignments.setConstrained(true);
- columnAlignments.setDisplayName(prop.getString("columnAlignments"));
-
- PropertyDescriptor allowSorting = new PropertyDescriptor("allowSorting", beanClass);
- allowSorting.setBound(true);
- allowSorting.setConstrained(true);
- allowSorting.setDisplayName(prop.getString("allowSorting"));
-
- PropertyDescriptor multipleMode = new PropertyDescriptor("multipleMode", beanClass);
- multipleMode.setBound(true);
- multipleMode.setConstrained(true);
- multipleMode.setDisplayName(prop.getString("multipleMode"));
-
- PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
- layout.setHidden(true);
-
- PropertyDescriptor[] rv = {
- cellFont,
- cellBg,
- cellFg,
- headingBg,
- headingFg,
- headingFont,
- headings,
- listItems,
- columnSizes,
- columnAlignments,
- allowSorting,
- multipleMode,
- layout};
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- private final static Class beanClass = MultiList.class;
-
- } // end of class MultiListBeanInfo