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 / OutputComponentForProj.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  2.9 KB  |  108 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 OutputComponentForProj extends OutputComponent
  7. {
  8.     boolean isProj=false;
  9.  
  10.     public OutputComponentForProj(Object component)
  11.     {
  12.         super(component);
  13.  
  14.     }
  15.  
  16.     public boolean setSetMethods(String[] methods)
  17.     {
  18.         if(methods[0].equals("setData(Value)"))
  19.         {
  20.             isProj=true;
  21.             setMethFullName=methods;
  22.             numberOfInvocationsForSet=methods.length;
  23.             setMethodsParam=new String[numberOfInvocationsForSet][];
  24.             setMethods=new Method[numberOfInvocationsForSet];
  25.             return true;
  26.         }
  27.         else{
  28.              isProj=false;
  29.             return super.setSetMethods(methods);
  30.         }
  31.     }
  32.  
  33.     public boolean setGetMethods(String[] methods)
  34.     {
  35.         if(methods[0].equals("getData()"))
  36.         {
  37.             isProj=true;
  38.             return true;
  39.         }
  40.         else
  41.         {
  42.             isProj=false;
  43.             return super.setGetMethods(methods);
  44.         }
  45.     }
  46.  
  47.     public void setPrintOut(Object Value,int Row,int Col)
  48.     {
  49.         if(!isProj)
  50.         super.setPrintOut(Value,Row,Col);
  51.  
  52.         else
  53.         {
  54.             if(Col>=0 )
  55.             {
  56.                 if(InputClass== null && Value==null)
  57.                 {
  58.                    /* if(Component instanceof symantec.itools.db.awt.Checkbox)
  59.                     {
  60.                         InputClass=(new Object()).getClass();
  61.                     }
  62.                     else */try{
  63.                     ((ProjectionBean)Component).setData("");
  64.                     
  65.                     InputClass=((ProjectionBean)Component).getData().getClass();
  66.                     }catch(Exception e){InputClass=(new Object()).getClass();}
  67.                 }
  68.                 if(InputClass!= null && InputClass.toString().equals("class java.lang.String"))
  69.                 {
  70.                     if(Value!=null) Value=((Object)Value.toString());
  71.                     else Value="";
  72.  
  73.                 }
  74.                 ((ProjectionBean)Component).setData(Value);
  75.  
  76.             }
  77.         }
  78.     }
  79.  
  80.     public Object getPrintOut(int Row,int Col)
  81.     {
  82.  
  83.         if(isProj)
  84.         {
  85.             Object Out=new Object();
  86.             if(Col==Name.ColumnNotFoundField)
  87.             {
  88.                 return(ColumnNotFoundString);
  89.             }
  90.             Out=(Object)((ProjectionBean)Component).getData();
  91.             if(Out!=null && InputClass==null)
  92.             {
  93.                 InputClass=Out.getClass();
  94.             }
  95.             if(Out==null || Out.equals(""))
  96.             {
  97.                 if(getEmptyMeansNull()){
  98.                     Out=null;
  99.                 }
  100.                 else{
  101.                     Out=new String();
  102.                 }
  103.             }
  104.               return Out;
  105.         }
  106.         else return super.getPrintOut(Row,Col);
  107.     }
  108. }