Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* 
   * Copyright (C) 2010---2013 星星(wuweixing)<349446658@qq.com>
   * 
   * This file is part of Wabacus 
   * 
   * Wabacus is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 package com.wabacus.system.inputbox.option;
 
 import java.util.List;
 import java.util.Map;
 
 
 public class TypepromptOptionBean extends AbsOptionBean
 {
     private Map<String,StringmPromptcolValues;//各联想列<promptcol/>上label和value列对应的值,只有是常量选项时才会在<option/>中指定这些列的值,如果是其它选项数据类型,则此变量为空
     
     public TypepromptOptionBean(AbsInputBox ownerInputboxObj)
     {
         super(ownerInputboxObj);
     }
 
     public void setMPromptcolValues(Map<String,StringpromptcolValues)
     {
         =promptcolValues;
     }
 
     public List<Map<String,String>> getLstRuntimeOptions(ReportRequest rrequest,String txtValue)
     {
         List<Map<String,String>> lstResults=null;
         if(this.==null)
         {//没有指定动态获取选项数据的数据源对象,则说明此<option/>就是一个常量选项的配置
             lstResults=new ArrayList<Map<String,String>>();
             lstResults.add((Map<String,String>)((HashMap<String,String>)).clone());
         }else
         {
             lstResults=this..getLstTypePromptOptions(rrequest,txtValue);
         }
         if(!(this. instanceof SQLOptionDatasource))
         {
             TypePromptBean typePromptBean=((TextBox)this.getOwnerInputboxObj()).getTypePromptBean();
             ITypePromptOptionMatcher matcherObj=typePromptBean.getTypePromptMatcherObj();
             if(matcherObj==nullmatcherObj=.;
             int count=0;
             List<Map<String,String>> lstTmp=new ArrayList<Map<String,String>>();
             for(Map<String,StringmOptionTmp:lstResults)
             {
                 if(matcherObj.isMatch(rrequest,typePromptBean,mOptionTmp,txtValue))
                 {
                     lstTmp.add(mOptionTmp);
                     if(++count>typePromptBean.getResultcount()) break;
                 }
             }
             lstResults=lstTmp;
         }
         return lstResults;
     }
     
     public void doPostLoad()
     {
         
       
         if(this. instanceof SQLOptionDatasource)
         {
             //$ByQXO
             dbType.doPostLoadSQLOptionDatasource(this);
             //ByQXO$
             
         }
         super.doPostLoad();
     }
 
    {
        TypePromptBean typePromptBean=((TextBox)this.).getTypePromptBean();
        List<TypePromptColBeanlstPromptColBeans=typePromptBean.getLstPColBeans();
        StringBuffer resultBuf=new StringBuffer();
        String labelcolTmp,expressionTmp;
        for(TypePromptColBean tpColbeanTmp:lstPromptColBeans)
        {
            if(tpColbeanTmp.getMatchmode()<=0) continue;
            expressionTmp=tpColbeanTmp.getMatchexpression();
            if(expressionTmp==null||expressionTmp.trim().equals(""))
            {
                labelcolTmp=tpColbeanTmp.getLabel();
                if(!typePromptBean.isCasesensitive()) labelcolTmp=dbtype.getLowerMethodname()+"("+labelcolTmp+")";
                expressionTmp=labelcolTmp+" like ";
                if(!typePromptBean.isCasesensitive()) expressionTmp+=dbtype.getLowerMethodname()+"(";
                expressionTmp+="'";
                if(tpColbeanTmp.getMatchmode()==2) expressionTmp+="%";
                expressionTmp+="#data#%'";
                if(!typePromptBean.isCasesensitive()) expressionTmp+=")"
            }
            resultBuf.append(expressionTmp).append(" or ");
        }
        if(resultBuf.toString().trim().endsWith(" or")) resultBuf.delete(resultBuf.length()-" or".length(),resultBuf.length());
        return "("+resultBuf.toString()+")";
    }
    
    public TypepromptOptionBean clone(AbsInputBox newOwnerInputboxObj)
    {
        TypepromptOptionBean newOptionBean=(TypepromptOptionBean)super.clone(newOwnerInputboxObj);
        if(!=null)
        {
            newOptionBean.mPromptcolValues=(Map<String,String>)((HashMap<String,String>)this.).clone();
        }
        return newOptionBean;
    }
New to GrepCode? Check out our FAQ X