home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 9.4 KB | 303 lines |
- /*
- * @(#QueryNavigatorBeanInfo.java
- *
- * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
- *
- */
-
- package symantec.itools.db.beans.binding;
-
- import java.beans.*;
- import symantec.itools.beans.*;
-
-
- /**
- * BeanInfo for QueryNavigator
- *
- */
-
- public class QueryNavigatorBeanInfo 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.setValue("VPO_Object", new Boolean(true));
-
- 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("DataSourceIconColor16.gif");
- return img;
- }
-
- if (iconKind == BeanInfo.ICON_MONO_32x32 ||
- iconKind == BeanInfo.ICON_COLOR_32x32) {
- java.awt.Image img = loadImage("DataSourceIconColor32.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 next = new MethodDescriptor(beanClass.getMethod("next", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.next();",
- "next");
- connections.addElement(connection);
-
- next.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(next);
- } catch (Exception e) { throw new Error("next:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor previous = new MethodDescriptor(beanClass.getMethod("previous", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.previous();",
- "previous");
- connections.addElement(connection);
-
- previous.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(previous);
- } catch (Exception e) { throw new Error("previous:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor insert = new MethodDescriptor(beanClass.getMethod("insert", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.insert();",
- "insert");
- connections.addElement(connection);
-
- insert.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(insert);
- } catch (Exception e) { throw new Error("insert:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor save = new MethodDescriptor(beanClass.getMethod("save", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.save();",
- "save");
- connections.addElement(connection);
-
- save.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(save);
- } catch (Exception e) { throw new Error("save:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor saveAll = new MethodDescriptor(beanClass.getMethod("saveAll", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.saveAll();",
- "saveAll");
- connections.addElement(connection);
-
- saveAll.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(saveAll);
- } catch (Exception e) { throw new Error("saveAll:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor saveAllLevels = new MethodDescriptor(beanClass.getMethod("saveAllLevels", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.saveAllLevels();",
- "saveAllLevels");
- connections.addElement(connection);
-
- saveAllLevels.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(saveAllLevels);
- } catch (Exception e) { throw new Error("saveAllLevels:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor undoChanges = new MethodDescriptor(beanClass.getMethod("undoChanges", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.undoChanges();",
- "undoChanges");
- connections.addElement(connection);
-
- undoChanges.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(undoChanges);
- } catch (Exception e) { throw new Error("save:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor first = new MethodDescriptor(beanClass.getMethod("first", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.first();",
- "first");
- connections.addElement(connection);
-
- first.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(first);
- } catch (Exception e) { throw new Error("save:: " + e.toString()); }
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE ;
- MethodDescriptor go_to = new MethodDescriptor(beanClass.getMethod("go_to", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "int", "",
- "%name%.go_to(%arg%);",
- "go_to");
- connections.addElement(connection);
-
- go_to.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(go_to);
- } catch (Exception e) { throw new Error("go_to:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor delete = new MethodDescriptor(beanClass.getMethod("delete", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.delete();",
- "delete");
- connections.addElement(connection);
-
- delete.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(delete);
- } catch (Exception e) { throw new Error("save:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor restart = new MethodDescriptor(beanClass.getMethod("restart", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.restart();",
- "restart");
- connections.addElement(connection);
-
- restart.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(restart);
- } catch (Exception e) { throw new Error("restart:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor startQueryByExample = new MethodDescriptor(beanClass.getMethod("startQueryByExample", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.startQueryByExample();",
- "startQueryByExample");
- connections.addElement(connection);
-
- startQueryByExample.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(startQueryByExample);
- } catch (Exception e) { throw new Error("startQueryByExample:: " + e.toString()); }
-
-
- try{
- args = null;
- MethodDescriptor executeQueryByExample = new MethodDescriptor(beanClass.getMethod("executeQueryByExample", args));
-
- connections = new java.util.Vector();
- connection = new ConnectionDescriptor("input", "void", "",
- "%name%.executeQueryByExample();",
- "executeQueryByExample");
- connections.addElement(connection);
-
- executeQueryByExample.setValue(ConnectionDescriptor.CONNECTIONS, connections);
- md.addElement(executeQueryByExample);
- } catch (Exception e) { throw new Error("executeQueryByExample:: " + e.toString()); }
-
- MethodDescriptor[] rv = new MethodDescriptor[md.size()];
- md.copyInto(rv);
-
- return rv;
- }
-
- public PropertyDescriptor[] getPropertyDescriptors() {
- try{
-
- PropertyDescriptor className = new PropertyDescriptor("className", beanClass);
- className.setBound(false);
- className.setConstrained(false);
- className.setDisplayName("Class Name");
-
- PropertyDescriptor aliasName = new PropertyDescriptor("aliasName", beanClass);
- aliasName.setBound(false);
- aliasName.setConstrained(false);
- aliasName.setDisplayName("Alias Name");
-
-
- PropertyDescriptor name = new PropertyDescriptor("name", beanClass);
- name.setBound(false);
- name.setConstrained(false);
- name.setDisplayName("Name");
-
- PropertyDescriptor autoStart = new PropertyDescriptor("autoStart", beanClass);
- autoStart.setBound(true);
- autoStart.setConstrained(true);
- autoStart.setDisplayName("AutoStart");
-
-
- PropertyDescriptor[] rv = {
- className,
- aliasName,
- name,
- autoStart
- };
-
- 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 = QueryNavigator.class;
-
- } // end of class QueryNavigatorBeanInfo