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.config.component.application.report;
 
 import java.util.List;
 import java.util.Map;
 
 
 public class ColBean extends AbsConfigBean
 {
     private String colid;
     
     private String property;
 
     private String column;
 
     private String datasetValueId;
     
     private String label;
     
     private Map<String,StringmDynLableParts;
 
     
     private String tagcontent;
     
     private boolean isI18n;
 
     private IDataType datatypeObj;
  
     private String labelstyleproperty;
     
     
     private String valuestyleproperty;
     
     
     private String labelalign;//配置的列标题对齐方式,不用配置,而是从labelstyleproperty中解析出来,以便数据导出或打印时使用
     
     private String valuealign;
     
     private float plainexcelwidth;
     
     private float pdfwidth;
     
     private String printwidth;
     
     private String printlabelstyleproperty;
     
     
     private String printvaluestyleproperty;
     
     
     private Method setMethod=null;
 
     private Method getMethod=null;
 
     public final static String NON_LABEL="{non-label}";
 
 
 
 
 
 //    private Map<String,String> mFormatParamsColProperties;//存放当前列的所有格式化方法参数中用到的其它<col/>的定义property(即@{}格式)和真正property
     
     public ColBean(AbsConfigBean parent)
     {
         super(parent);
         this.=String.valueOf(((DisplayBean)parent).generate_childid());
     }
 
    public ColBean(AbsConfigBean parent,int colid)
    {
        super(parent);
        this.=String.valueOf(colid);
    }
    
    public String getColid()
    {
        return ;
    }
    public void setColid(String colid)
    {
        this.=colid;
    }
    public String getDatasetValueId()
    {
        return ;
    }
    public void setDatasetValueId(String datasetid)
    {
        this.=datasetid;
    }
    public float getPlainexcelwidth()
    {
        return ;
    }
    public void setPlainexcelwidth(float plainexcelwidth)
    {
        this.=plainexcelwidth;
    }
    public float getPdfwidth()
    {
        return ;
    }
    public void setPdfwidth(float pdfwidth)
    {
        this.=pdfwidth;
    }
    public Method getGetMethod()
    {
        return ;
    }
    public void setGetMethod(Method getMethod)
    {
        this.=getMethod;
    }
    public Method getSetMethod()
    {
        return ;
    }
    public void setSetMethod(Method setMethod)
    {
        this.=setMethod;
    }
    public boolean isI18n()
    {
        return ;
    }
    public void setI18n(boolean isI18n)
    {
        this.=isI18n;
    }
    public String getPrintwidth()
    {
        return ;
    }
    public void setPrintwidth(String printwidth)
    {
        this.=printwidth;
    }
    public String getPrintlabelstyleproperty(ReportRequest rrequest,boolean isStaticPart)
    {
        if(isStaticPartreturn this.==null?"":this.;
        return WabacusAssistant.getInstance().getStylepropertyWithDynPart(rrequest,this.,this.,"");
    }
    
    public void setPrintlabelstyleproperty(String printlabelstyleproperty,boolean isStaticPart)
    {
        if(isStaticPart)
        {
            this.=printlabelstyleproperty;
        }else
        {
            Object[] objArr=WabacusAssistant.getInstance().parseStylepropertyWithDynPart(printlabelstyleproperty);
            this.=(String)objArr[0];
            this.=(List<String>)objArr[1];
        }
    }
    public String getPrintvaluestyleproperty(ReportRequest rrequest,boolean isStaticPart)
    {
        if(isStaticPartreturn this.==null?"":this.;
        return WabacusAssistant.getInstance().getStylepropertyWithDynPart(rrequest,this.,this.,"");
    }
    
    public void setPrintvaluestyleproperty(String printvaluestyleproperty,boolean isStaticPart)
    {
        if(isStaticPart)
        {
            this.=printvaluestyleproperty;
        }else
        {
            Object[] objArr=WabacusAssistant.getInstance().parseStylepropertyWithDynPart(printvaluestyleproperty);
            this.=(String)objArr[0];
            this.=(List<String>)objArr[1];
        }
    }
    public void setProperty(String property)
    {
        this.=property;
    }
    public void setColumn(String column)
    {
        if(Tools.isDefineKey("i18n",column))
        {
            String columnTemp=Tools.getRealKeyByDefine("i18n",column);
            if(columnTemp.trim().equals(""))
            {
                throw new WabacusConfigLoadingException("报表"+this.getReportBean().getPath()+"配置的列"
                        +column+"不合法");
            }
            setI18n(true);
            this.=columnTemp;
        }else
        {
            setI18n(false);
            this.=column;
        }
    }
    public void setLabel(String label)
    {
        Object[] objArr=WabacusAssistant.getInstance().parseStringWithDynPart(label);
        this.=(String)objArr[0];
        this.=(Map<String,String>)objArr[1];
    }
    public String getDisplaytype()
    {
        return ;
    }
    public void setDisplaytype(String displaytype)
    {
        displaytype=displaytype==null?"":displaytype.toLowerCase().trim();
        if(displaytype.equals(""))
        {
            this.=.;
        }else
        {
            if(!displaytype.equals(.)&&!displaytype.equals(.)
                    &&!displaytype.equals(.)&&!displaytype.equals(.))
            {
                throw new WabacusConfigLoadingException("加载报表"+this.getReportBean().getPath()+"的列"+this.+"失败,配置的displaytype属性"+displaytype
                        +"不支持");
            }
            this.=displaytype;
        }
    }
    public String getProperty()
    {
        return this.;
    }
    public String getColumn()
    {
        return this.;
    }
    public String getLabel(ReportRequest rrequest)
    {
        return WabacusAssistant.getInstance().getStringValueWithDynPart(rrequest,this.,this.,"");
    }
    public IDataType getDatatypeObj()
    {
        return ;
    }
    public void setDatatypeObj(IDataType datatypeObj)
    {
        this.=datatypeObj;
    }
    
    public String getLabelstyleproperty(ReportRequest rrequest,boolean isStaticPart)
    {
        if(rrequest!=null&&rrequest.getShowtype()==.return this.getPrintlabelstyleproperty(rrequest,isStaticPart);
        if(isStaticPartreturn this.==null?"":this.;
        String reallabelstyleproperty=WabacusAssistant.getInstance().getStylepropertyWithDynPart(rrequest,this.,
                this.,"");
        if(rrequest!=null&&rrequest.getShowtype()!=.&&this.getReportBean().isListReportType())
        {
            String stylevalue=Tools.getPropertyValueByName("style",reallabelstyleproperty,false);
            if(stylevalue==nullstylevalue="";
            if(!stylevalue.trim().equals("")&&!stylevalue.endsWith(";")) stylevalue=stylevalue+";";
            if(stylevalue.toLowerCase().indexOf("text-align")<0)
            {
                stylevalue=stylevalue+"text-align:center;";
            }
            if(stylevalue.toLowerCase().indexOf("vertical-align")<0)
            {
                stylevalue=stylevalue+"vertical-align:middle;";
            }
            reallabelstyleproperty=Tools.removePropertyValueByName("style",reallabelstyleproperty);
            reallabelstyleproperty=reallabelstyleproperty+" style=\""+stylevalue+"\"";
        }
        return reallabelstyleproperty;
    }
    
    public void setLabelstyleproperty(String labelstyleproperty,boolean isStaticPart)
    {
        if(isStaticPart)
        {
            this.=labelstyleproperty;
        }else
        {
            Object[] objArr=WabacusAssistant.getInstance().parseStylepropertyWithDynPart(labelstyleproperty);
            this.=(String)objArr[0];
            this.=(List<String>)objArr[1];
        }
    }
    
    public String getValuestyleproperty(ReportRequest rrequest,boolean isStaticPart)
    {
        if(rrequest!=null&&rrequest.getShowtype()==.return this.getPrintvaluestyleproperty(rrequest,isStaticPart);
        if(isStaticPartreturn this.==null?"":this.;
        return WabacusAssistant.getInstance().getStylepropertyWithDynPart(rrequest,this.,this.,"");
    }
    
    public void setValuestyleproperty(String valuestyleproperty,boolean isStaticPart)
    {
        if(isStaticPart)
        {
            this.=valuestyleproperty;
        }else
        {
            Object[] objArr=WabacusAssistant.getInstance().parseStylepropertyWithDynPart(valuestyleproperty);
            this.=(String)objArr[0];
            this.=(List<String>)objArr[1];
        }
    }
    public String getTagcontent()
    {
        return ;
    }
    public void setTagcontent(String tagcontent)
    {
        this.=tagcontent;
    }
    public String getLabelalign()
    {
        return ;
    }
    public void setLabelalign(String labelalign)
    {
        this.=labelalign;
    }
    public String getValuealign()
    {
        return ;
    }
    public void setValuealign(String valuealign)
    {
        this.=valuealign;
    }
    public boolean isMatchDataSet(ReportDataSetValueBean dsvbean)
    {
        if(this.isControlCol()||this.isSequenceCol()||this.isNonFromDbCol()||this.isNonValueCol()) return false;
        if((this.==null||this..trim().equals(""))&&!dsvbean.getReportBean().getSbean().isMultiDataSetCols()) return true;//没有配置datasetid属性的,且本报表没有提供横向多数据集
        return dsvbean.getId().equals(this.);
    }
    
    public boolean checkDisplayPermission(ReportRequest rrequest)
    {
        if(!rrequest.checkPermission(this.getReportBean().getId(),.,this.,.)) return false;
        if(this.!=null&&!this..trim().equals("")&&!this..equals(this.))
        {
            if(!rrequest.checkPermission(this.getReportBean().getId(),.,this.,.)) return false;
        }
        return true;
    }
    
    public boolean checkReadonlyPermission(ReportRequest rrequest)
    {
        if(rrequest.checkPermission(this.getReportBean().getId(),.,this.,.)) return true;
        if(this.!=null&&!this..trim().equals("")&&!this..equals(this.))
        {
            if(rrequest.checkPermission(this.getReportBean().getId(),.,this.,.)) return true;
        }
        return false;
    }
    
    public int getDisplaymode(ReportRequest rrequest,List<StringlstDisplayColIds)
    {
        if(rrequest!=null)
        {
            if(rrequest.getShowtype()!=.&&this.isControlCol()) return 0;
            if(!checkDisplayPermission(rrequest)) return -1;
        }
        if(..equals()) return 0;
        if(..equals()) return 2;
        DisplayBean dbean=(DisplayBean)this.getParent();
        if(!dbean.isColselect()) return 1;
        if(lstDisplayColIds==null||lstDisplayColIds.size()==0)
        {
            if(..equals()) return 1;
        }else if(lstDisplayColIds.contains())
        {
            return 1;
        }
        return 0;
    }
    
    public boolean isNonValueCol()
    {
        if(==null||.trim().equals("")) return false;
    }
    
    public boolean isSequenceCol()
    {
        if(==null||.trim().equals("")) return false;
        return .indexOf("{sequence")==0&&.indexOf("}")==.length()-1;
    }
    
    public boolean isNonFromDbCol()
    {
        if(==null||.trim().equals("")) return false;
    }
    
    public boolean isRowSelectCol()
    {
        if(==null||.trim().equals("")) return false;
    }
    
    public boolean isRoworderArrowCol()
    {
        if(==null||.trim().equals("")) return false;
    }
    
    public boolean isRoworderInputboxCol()
    {
        if(==null||.trim().equals("")) return false;
    }
    
    public boolean isRoworderTopCol()
    {
        if(==null||.trim().equals("")) return false;
    }
    
    public boolean isRoworderCol(String rowordertypeColumn)
    {
        if(==null||.trim().equals("")) return false;
        return .equalsIgnoreCase(rowordertypeColumn);
    }
    
    public boolean isRoworderCol()
    {
    }
    
    public boolean isEditableListEditCol()
    {
        if(this.==null||this..trim().equals("")) return false;
    }
    
    public boolean isControlCol()
    {
        {
            return true;
        }
        return false;
    }
    
    {
        ReportBean rb=this.getReportBean();
        String border=rb.getBorder();
        String borderstyle="";
        {
            borderstyle="border:none;";
        }else
        {
            String bordercolor=rb.getBordercolor();
            if(bordercolor!=null&&!bordercolor.trim().equals(""))
            {
                borderstyle="border-color:"+bordercolor+";";
            }
           {
               borderstyle=borderstyle+"border-left:none;border-right:none;";
           }else if(..equals(border))
           {
               borderstyle=borderstyle+"border-top:none;border-bottom:none;";
           }
        }
        return borderstyle;
    }
    
    public ColBean getUpdateColBeanDest(boolean isMust)
    {
        if(ercbean==null||ercbean.getUpdatecolDest()==null||ercbean.getUpdatecolDest().trim().equals(""))
        {
            if(!isMustreturn null;
            throw new WabacusConfigLoadingException("报表"+this.getReportBean().getPath()+"的column属性为"+this.getColumn()+"的<col/>没有配置updatecol更新其它列");
        }
        ColBean cbTemp=this.getReportBean().getDbean().getColBeanByColProperty(ercbean.getUpdatecolDest());
        if(cbTemp==null)
        {
            throw new WabacusConfigLoadingException("报表"+this.getReportBean().getPath()+"的column属性为"+this.getColumn()+"的<col/>通过updatecol为"
                    +ercbean.getUpdatecolDest()+"引用的列不存在");
        }
        if(!..equals(cbTemp.getDisplaytype()))
        {
            throw new WabacusConfigLoadingException("报表"+this.getReportBean().getPath()+"的column属性为"+this.getColumn()+"的<col/>通过updatecol为"
                    +ercbean.getUpdatecolDest()+"引用的列不是displaytype为hidden的列");
        }
        if(cbTemp.getProperty()==null||cbTemp.getProperty().trim().equals("")||cbTemp.isNonValueCol()||cbTemp.isSequenceCol()||cbTemp.isControlCol())
        {
            throw new WabacusConfigLoadingException("报表"+this.getReportBean().getPath()+"的column属性为"+this.getColumn()+"的<col/>通过updatecol为"
                    +ercbean.getUpdatecolDest()+"引用的列不是从数据库中获取数据,不能被引用");
        }
        return cbTemp;
    }
    
    public ColBean getUpdateColBeanSrc(boolean isMust)
    {
        if(ercbean==null||ercbean.getUpdatecolSrc()==null||ercbean.getUpdatecolSrc().trim().equals(""))
        {
            if(!isMustreturn null;
            throw new WabacusConfigLoadingException("报表"+this.getReportBean().getPath()+"的column属性为"+this.getColumn()+"的<col/>没有被其它列通过updatecol属性引用");
        }
        ColBean cbTemp=this.getReportBean().getDbean().getColBeanByColProperty(ercbean.getUpdatecolSrc());
        if(cbTemp==null)
        {
            throw new WabacusConfigLoadingException("在报表"+this.getReportBean().getPath()+"中没有取到property为"+ercbean.getUpdatecolSrc()+"的列");
        }
        return cbTemp;
    }
    
    public AbsConfigBean clone(AbsConfigBean parent)
    {
        ColBean cbNew=(ColBean)super.clone(parent);
        cloneExtendConfig(cbNew);
        return cbNew;
    }
    public void doPostLoad()
    {
        /*if(formatproperty!=null&&!formatproperty.trim().equals(""))
        {
            this.formatProperties=FormatPropertyBean.convertFormatStringToFormatBean(
                    formatproperty,this);
            this.formatproperty=null;
            mFormatParamsColProperties=new HashMap<String,String>();
            if(this.formatProperties!=null&&this.formatProperties.size()>0)
            {
                for(int i=0;i<this.formatProperties.size();i++)
                {
                    FormatPropertyBean fpropbean=this.formatProperties.get(i);
                    if(fpropbean==null) continue;
                    fpropbean.doPostLoad(mFormatParamsColProperties);
                }
            }
            if(mFormatParamsColProperties.size()==0) mFormatParamsColProperties=null;
        }*/
        if(this.isControlCol()||this.isSequenceCol()||this.isNonValueCol()) return;
        if(!this.isNonFromDbCol()&&this.getReportBean().getSbean().isMultiDataSetCols()&&(this.==null||this..trim().equals("")))
        {
            throw new WabacusConfigLoadingException("加载报表"+this.getReportBean().getPath()+"上的列"+this.
                    +"失败,此报表配置了多个横向数据集查询各列数据,因此必须在column中指定数据集ID");
        }
        if(ecolbean!=nullecolbean.doPostLoad();
    }
    
    public int hashCode()
    {
        final int prime=31;
        int result=1;
        result=prime*result+((==null)?0:.hashCode());
        result=prime*result+((==null)?0:.hashCode());
        result=prime*result+((==null)?0:.hashCode());
        return result;
    }
    public boolean equals(Object obj)
    {
        if(this==objreturn true;
        if(obj==nullreturn false;
        if(getClass()!=obj.getClass()) return false;
        final ColBean other=(ColBean)obj;
        if(==null)
        {
            if(other.colid!=nullreturn false;
        }else if(!.equals(other.colid)) return false;
        if(==null)
        {
            if(other.column!=nullreturn false;
        }else if(!.equals(other.column)) return false;
        if(==null)
        {
            if(other.property!=nullreturn false;
        }else if(!.equals(other.property)) return false;
        if(this.getReportBean()==null)
        {
            if(other.getReportBean()!=nullreturn false;
        }else if(!this.getReportBean().equals(other.getReportBean()))
        {
            return false;
        }
        return true;
    }
New to GrepCode? Check out our FAQ X