home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / prosrc.bin / ConnectionManagerBeanInfo.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  3.1 KB  |  118 lines

  1. /*
  2.  * @(#ConnectionManagerBeanInfo.java
  3.  *
  4.  * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
  5.  *
  6.  */
  7.  
  8. package symantec.itools.db.beans.jdbc;
  9.  
  10. import java.beans.*;
  11. import symantec.itools.beans.SymantecBeanDescriptor;
  12.  
  13.  
  14. /**
  15.  * BeanInfo for ConnectionManager
  16.  *
  17.  */
  18.  
  19. public class ConnectionManagerBeanInfo extends SimpleBeanInfo {
  20.  
  21.     public BeanInfo[] getAdditionalBeanInfo() {
  22.         try {
  23.             java.util.Vector v = new java.util.Vector();
  24.             BeanInfo[] rv;
  25.             BeanInfo b;
  26.             Class c = beanClass.getSuperclass();
  27.  
  28.             while (c.isAssignableFrom(Object.class) != true) {
  29.                 b = Introspector.getBeanInfo(c);
  30.                 v.addElement(b);
  31.                 c = c.getSuperclass();
  32.             }
  33.             rv = new BeanInfo[v.size()];
  34.             v.copyInto(rv);
  35.  
  36.             return rv;
  37.         }
  38.         catch (IntrospectionException e) { throw new Error(e.toString());}
  39.     }
  40.  
  41.     public BeanDescriptor getBeanDescriptor() {
  42.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  43.         bd.setFolder("JDBC");
  44.         bd.setToolbar("JDBC");
  45.         bd.setValue("VPO_Object", new Boolean(true));
  46.         bd.setRootTemplate(getTemplate());
  47.         bd.setWinHelp("0x123D0");
  48.  
  49.         return (BeanDescriptor) bd;
  50.     }
  51.  
  52.  
  53.     public static String getTemplate()
  54.     {
  55.         String template = "";
  56.         // System.out.println("getTemplate() nono pppp \n");
  57.         String EOL = "\n";
  58.         String TAB="\t";
  59.  
  60.         template += EOL + "import symantec.itools.db.beans.jdbc.*;";
  61.         template += EOL + "import java.sql.*;";
  62.         template += EOL;
  63.         template += EOL + "public class ConnectionManager1 extends ConnectionManager";
  64.         template += EOL + "{";
  65.         template += EOL;
  66.         template += EOL + "    public ConnectionManager1()";
  67.         template += EOL + "    {";
  68.         template += EOL + "        super();";
  69.         template += EOL + "        init();";
  70.         template += EOL + "    }";
  71.         template += EOL;
  72.         template += EOL + "    public void init()";
  73.         template += EOL + "    {";
  74.         template += EOL + "        //{{INIT_CONTROLS";
  75.         template += EOL + "        //}}";
  76.         template += EOL + "    }";
  77.         template += EOL;
  78.         template += EOL + "//{{DECLARE_CONTROLS";
  79.         template += EOL + "//}}";
  80.         template += EOL;
  81.         template += EOL + "}";
  82.         template += EOL;
  83.         template += EOL;
  84.  
  85.         return template;
  86.     }
  87.  
  88.     public java.awt.Image getIcon(int iconKind) {
  89.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  90.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  91.             java.awt.Image img = loadImage("ConnectionManagerIconColor16.gif");
  92.             return img;
  93.         }
  94.  
  95.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  96.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  97.             java.awt.Image img = loadImage("ConnectionManagerIconColor32.gif");
  98.             return img;
  99.         }
  100.  
  101.         return null;
  102.     }
  103.  
  104.     public MethodDescriptor[] getMethodDescriptors() {
  105.         return null;
  106.     }
  107.  
  108.     public PropertyDescriptor[] getPropertyDescriptors() {
  109.         return new PropertyDescriptor[0];
  110.     }
  111.  
  112.     public int getDefaultPropertyIndex() {
  113.         return 0;    //  the index for our default property is always 0
  114.     }
  115.  
  116.     private final static Class beanClass = ConnectionManager.class;
  117.  
  118. }    //  end of class ConnectionManagerBeanInfo