home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 4.5 KB | 154 lines |
- /*
- * @(#MediatorBeanInfo.java
- *
- * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
- *
- */
-
- package symantec.itools.db.beans.binding;
-
- import java.beans.*;
- import symantec.itools.beans.*;
- import java.util.ResourceBundle;
-
-
- /**
- * BeanInfo for Mediator
- *
- */
-
- public class MediatorBeanInfo extends SimpleBeanInfo {
-
- 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());}
- }
-
- public BeanDescriptor getBeanDescriptor() {
- SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
- bd.setFolder("JDBC");
- bd.setToolbar("JDBC");
- bd.setWinHelp("0x123CD");
-
- return (BeanDescriptor) bd;
- }
-
- public java.awt.Image getIcon(int iconKind) {
- if (iconKind == BeanInfo.ICON_MONO_16x16 ||
- iconKind == BeanInfo.ICON_COLOR_16x16) {
- java.awt.Image img = loadImage("MediatorIconColor16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("MediatorIconColor32.gif");
- return img;
- }
-
- return null;
- }
-
- public MethodDescriptor[] getMethodDescriptors() {
- Class[] args;
- ConnectionDescriptor connection;
- java.util.Vector connections;
- java.util.Vector md = new java.util.Vector();
-
-
- try{
- args = null;
- MethodDescriptor commit = new MethodDescriptor(beanClass.getMethod("commit", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.commit();",
- "Commit Data Changes");
- connections.addElement(connection);
-
- commit.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(commit);
- } catch (Exception e) { throw new Error("commit:: " + e.toString()); }
-
- MethodDescriptor[] rv = new MethodDescriptor[md.size()];
- md.copyInto(rv);
-
- return rv;
- }
-
- public PropertyDescriptor[] getPropertyDescriptors() {
- ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.db.resources.PropBundle");
-
- try{
- PropertyDescriptor output = new PropertyDescriptor("output", beanClass);
- output.setBound(false);
- output.setConstrained(false);
- output.setDisplayName("Output");
- output.setPropertyEditorClass(OutputEditor.class);
-
- PropertyDescriptor setMethods = new PropertyDescriptor("setMethods", beanClass);
- setMethods.setBound(true);
- setMethods.setConstrained(true);
- setMethods.setDisplayName("Setter Methods");
-
- PropertyDescriptor getMethods = new PropertyDescriptor("getMethods", beanClass);
- getMethods.setBound(true);
- getMethods.setConstrained(true);
- getMethods.setDisplayName("Getter Methods");
-
- PropertyDescriptor dataBinding = new PropertyDescriptor("dataBinding", beanClass);
- dataBinding.setBound(false);
- dataBinding.setConstrained(false);
- dataBinding.setDisplayName("Data Binding");
- dataBinding.setPropertyEditorClass(NameEditorMultiRow.class);
-
- /*PropertyDescriptor booleanTrueValue = new PropertyDescriptor("booleanTrueValue", beanClass);
- booleanTrueValue.setBound(true);
- booleanTrueValue.setConstrained(true);
- booleanTrueValue.setDisplayName("Boolean True Value ");
-
- PropertyDescriptor booleanFalseValue = new PropertyDescriptor("booleanFalseValue", beanClass);
- booleanFalseValue.setBound(true);
- booleanFalseValue.setConstrained(true);
- booleanFalseValue.setDisplayName("Boolean False Value ");*/
-
- PropertyDescriptor emptyMeansNull = new PropertyDescriptor("emptyMeansNull", beanClass);
- emptyMeansNull.setBound(false);
- emptyMeansNull.setConstrained(false);
- emptyMeansNull.setDisplayName(prop.getString("emptyMeansNull"));
-
- PropertyDescriptor[] rv = {
- output,
- dataBinding,
- setMethods,
- getMethods,
- //booleanTrueValue,
- //booleanFalseValue,
- emptyMeansNull };
-
- return rv;
- } catch (IntrospectionException e) { throw new Error(e.toString()); }
- }
-
- public int getDefaultPropertyIndex() {
- return 0; // the index for our default property is always 0
- }
-
- private final static Class beanClass = Mediator.class;
-
- } // end of class MediatorBeanInfo