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 / OutputComponentForDS.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  2.4 KB  |  93 lines

  1. package symantec.itools.db.beans.binding;
  2.  
  3. import symantec.itools.db.awt.ProjectionBean;
  4. import java.lang.reflect.*;
  5.  
  6. public class OutputComponentForDS extends OutputComponent
  7. {
  8.     boolean isBDS=false;
  9.  
  10.     public OutputComponentForDS(Object component)
  11.     {
  12.         super(component);
  13.     }
  14.  
  15.     public boolean setSetMethods(String[] methods)
  16.     {
  17.         if(methods[0].equals("setValue(Value,Row,Col)"))
  18.         {
  19.             isBDS=true;
  20.             setMethFullName=methods;
  21.             numberOfInvocationsForSet=methods.length;
  22.             setMethodsParam=new String[numberOfInvocationsForSet][];
  23.             setMethods=new Method[numberOfInvocationsForSet];
  24.             return true;
  25.         }
  26.         else{
  27.              isBDS=false;
  28.             return super.setSetMethods(methods);
  29.         }
  30.     }
  31.  
  32.     public boolean setGetMethods(String[] methods)
  33.     {
  34.         if(methods[0].equals("getValue(Row,Col)"))
  35.         {
  36.             isBDS=true;
  37.             return true;
  38.         }
  39.         else
  40.         {
  41.             isBDS=false;
  42.             return super.setGetMethods(methods);
  43.         }
  44.     }
  45.  
  46.     public void setPrintOut(Object Value,int Row,int Col)
  47.     {
  48.         if(!isBDS)
  49.         super.setPrintOut(Value,Row,Col);
  50.  
  51.         else
  52.         {
  53.             if(Col>=0 )
  54.             {
  55.                /*  if(InputClass!= null && InputClass.toString().equals("class java.lang.String"))
  56.                 {
  57.                     if(Value!=null) Value=((Object)Value.toString());
  58.                     else Value="";
  59.                 }*/
  60.                 ((BasicDataSource)Component).setValue(Value,Row,Col);
  61.             }
  62.         }
  63.     }
  64.  
  65.     public Object getPrintOut(int Row,int Col)
  66.     {
  67.  
  68.         if(isBDS)
  69.         {
  70.             Object Out=new Object();
  71.             if(Col==Name.ColumnNotFoundField)
  72.             {
  73.                 return(ColumnNotFoundString);
  74.             }
  75.             Out=(Object)((BasicDataSource)Component).getValue(Row, Col);
  76.             if(Out!=null && InputClass==null)
  77.             {
  78.                 InputClass=Out.getClass();
  79.             }
  80.             /* if(Out==null || Out.equals(""))
  81.             {
  82.                 if(getEmptyMeansNull()){
  83.                     Out=null;
  84.                 }
  85.                 else{
  86.                     Out=new String();
  87.                 }
  88.             }*/
  89.              return Out;
  90.         }
  91.         else return super.getPrintOut(Row,Col);
  92.     }
  93. }