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.component.application.report;
 
 import java.util.List;
 
 
 public class BlockListReportType extends AbsListReportType
 {
     private final static String KEY=BlockListReportType.class.getName();
 
     public BlockListReportType(AbsContainerType parentContainerType,IComponentConfigBean comCfgBean,ReportRequest rrequest)
     {
         super(parentContainerType,comCfgBean,rrequest);
     }
 
     public String showReportData()
     {
         StringBuffer resultBuf=new StringBuffer();
         ReportDataBean reportDataObjFromInterceptor=null;
         if(.getInterceptor()!=null)
         {
             reportDataObjFromInterceptor=new ReportDataBean(this,.getDbean().getLstCols());
             .getInterceptor().beforeDisplayReportData(,,reportDataObjFromInterceptor);
         }
         if(reportDataObjFromInterceptor!=null&&reportDataObjFromInterceptor.getBeforeDisplayString()!=null)
         {
             resultBuf.append(reportDataObjFromInterceptor.getBeforeDisplayString());
         }
         if(reportDataObjFromInterceptor==null||reportDataObjFromInterceptor.isShouldDisplayReportData())
         {
             resultBuf.append(showReportScrollStartTag());
             resultBuf.append("<ul id=\""+.getGuid()+"_data\" class=\"cls-blocklist\"");
             resultBuf.append(" style=\"");
             resultBuf.append(" width:"+getReportDataWidthOnPage()+";");
             if(.getHeight()!=null&&!.getHeight().trim().equals(""))
             {
                 resultBuf.append("height:").append(.getHeight()).append(";");
             }
             resultBuf.append("\"");
             if(.shouldShowContextMenu())
             {
                 resultBuf.append(" oncontextmenu=\"try{showcontextmenu('contextmenu_"+.getGuid()
                         +"',event);}catch(e){logErrorsAsJsFileLoad(e);}\"");
             }
             resultBuf.append(">");
             if(this.==null||this..size()==0)
             {
                 resultBuf.append("<li class=\"cls-blocklist-block\"><div class=\"cls-blocklist-item\">");
                 if(this.isLazyDataLoad()&&.getShowtype()==.)
                 {
                     resultBuf.append(.getStringAttribute(.getId()+"_lazyloadmessage",""));
                 }else
                 {
                     resultBuf.append(.getI18NStringValue((Config.getInstance().getResources().getString(,.getPageBean(),
                             .,true))));
                 }
                 resultBuf.append("</div></li></ul>");
                 return resultBuf.toString();
            }
            if(.getShowtype()!=.)
            {
                resultBuf.append("<table border='1'");
                if(.getShowtype()==.)
                {
                    resultBuf.append(" style=\"");
                    if(!.getWidth().trim().equals(""))
                    {
                        resultBuf.append(" width:"+.getWidth()+";");
                    }else
                    {
                        resultBuf.append("width:100%;");
                    }
                    resultBuf
                            .append("border-collapse:collapse;border:none;mso-border-alt:solid windowtext .25pt;mso-border-insideh:.5pt solid windowtext;mso-border-insidev:.5pt solid windowtext");
                    resultBuf.append("\"");
                }else
                {
                    resultBuf.append(" width=\"100%\"");
                }
                resultBuf.append(">");
            }
            resultBuf.append(showDataPart());
            if(.getShowtype()!=.)
            {
                resultBuf.append("</table>");
            }
            resultBuf.append("</ul>");
            resultBuf.append(showReportScrollEndTag());
        }
        if(reportDataObjFromInterceptor!=null&&reportDataObjFromInterceptor.getAfterDisplayString()!=null)
        {
            resultBuf.append(reportDataObjFromInterceptor.getAfterDisplayString());
        }
        return resultBuf.toString();
    }
    private String showDataPart()
    {
        StringBuffer resultBuf=new StringBuffer();
        int startNum=0;
        {
            startNum=(this..getFinalPageno()-1)*this..getPagesize();
        }else
        {
            resultBuf.append("<tr>");
        }
        List<ColBeanlstColBeans=.getDbean().getLstCols();
        RowDataBean rowInterceptorObjTmp;
        ColDisplayData colDisplayData;
        String col_displayvaluetrstylepropertyTmp;
        AbsReportDataPojo rowDataObjTmp;
        int colsinexportfile=blrdbean.getColsinexportfile();
        int n=1;
        for(int i=0,size=.size();i<size;i++)
        {
            rowDataObjTmp=this..get(i);
            trstylepropertyTmp=rowDataObjTmp.getRowValuestyleproperty();
            if(.getInterceptor()!=null)
            {
                rowInterceptorObjTmp=new RowDataBean(this,trstylepropertyTmp,lstColBeans,rowDataObjTmp,i,-1);
                .getInterceptor().beforeDisplayReportDataPerRow(this.,this.,rowInterceptorObjTmp);
                if(rowInterceptorObjTmp.getInsertDisplayRowHtml()!=nullresultBuf.append(rowInterceptorObjTmp.getInsertDisplayRowHtml());
                if(!rowInterceptorObjTmp.isShouldDisplayThisRow()) continue;
                trstylepropertyTmp=rowInterceptorObjTmp.getRowstyleproperty();
            }
            if(trstylepropertyTmp==nulltrstylepropertyTmp="";
            if(.getShowtype()==.)
            {
                resultBuf.append("<li class=\"cls-blocklist-block\" "+trstylepropertyTmp+">");
            }else
            {
                resultBuf.append("<td "+trstylepropertyTmp+">");
            }
            for(ColBean cbean:lstColBeans)
            {
                if(this.isHiddenCol(cbean)) continue;
                
                col_displayvalue=getColDisplayValue(cbean,rowDataObjTmp,startNum);
                resultBuf.append("<div class=\"cls-blocklist-item\"");
                colDisplayData=ColDisplayData.getColDataFromInterceptor(this,cbean,rowDataObjTmp,i,rowDataObjTmp.getColValuestyleproperty(cbean
                        .getProperty()),col_displayvalue);
                resultBuf.append(colDisplayData.getStyleproperty());
                resultBuf.append(">").append(colDisplayData.getValue());
                resultBuf.append("</div>");
            }
            if(.getShowtype()==.)
            {
                resultBuf.append("</li>");
            }else
            {
                resultBuf.append("</td>");
                if(colsinexportfile>0&&n++%colsinexportfile==0) resultBuf.append("</tr><tr>");
            }
        }
        {
            resultBuf.toString().endsWith("</tr>");
        }
        if(.getInterceptor()!=null)
        {
            rowInterceptorObjTmp=new RowDataBean(this,.getDbean().getValuestyleproperty(,false),lstColBeans,null,.,-1);
            .getInterceptor().beforeDisplayReportDataPerRow(this.,this.,rowInterceptorObjTmp);
            if(rowInterceptorObjTmp.getInsertDisplayRowHtml()!=nullresultBuf.append(rowInterceptorObjTmp.getInsertDisplayRowHtml());
        }
        return resultBuf.toString();
    }
    private String getColDisplayValue(ColBean cbean,AbsReportDataPojo dataObj,int startNum)
    {
        String col_displayvalue;
        if(cbean.isControlCol())
        {
            throw new WabacusRuntimeException("显示报表"+.getPath()+"失败,此报表不能配置行选中列或行排序列");
        }else if(cbean.isSequenceCol())
        {
            col_displayvalue=String.valueOf(startNum+alrcbean.getSequenceStartNum());
        }else
        {
            col_displayvalue=dataObj.getColStringValue(cbean);
            if(col_displayvalue==nullcol_displayvalue="";
        }
        return col_displayvalue;
    }
    {
        if(.getShowtype()!=.return "";
        boolean isShowScrollX=.getScrollwidth()!=null&&!.getScrollwidth().trim().equals("");
        boolean isShowScrollY=.getScrollheight()!=null&&!.getScrollheight().trim().equals("");
        return ComponentAssistant.getInstance().showComponentScrollStartPart(,isShowScrollX,isShowScrollY,.getScrollwidth(),
                .getScrollheight(),.getScrollstyle());
    }
    private String showReportScrollEndTag()
    {
        if(.getShowtype()!=.return "";
        boolean isShowScrollX=.getScrollwidth()!=null&&!.getScrollwidth().trim().equals("");
        boolean isShowScrollY=.getScrollheight()!=null&&!.getScrollheight().trim().equals("");
        return ComponentAssistant.getInstance().showComponentScrollEndPart(isShowScrollX,isShowScrollY);
    }
    public String showReportData(boolean showtype)
    {
        if(showtypereturn showReportData();
        return "";
    }
    {
        return "";
    }
    public int afterDisplayLoading(DisplayBean disbean,List<XmlElementBeanlstEleDisplayBeans)
    {
        super.beforeDisplayLoading(disbean,lstEleDisplayBeans);
        BlockListReportDisplayBean blrdbean=new BlockListReportDisplayBean(disbean);
        disbean.setExtendConfigDataForReportType(,blrdbean);
        XmlElementBean eleDisplayBean=lstEleDisplayBeans.get(0);
        String blockwidth=eleDisplayBean.attributeValue("blockwidth");
        String blockheight=eleDisplayBean.attributeValue("blockheight");
        String colsinexportfile=eleDisplayBean.attributeValue("colsinexportfile");
        if(colsinexportfile==null||colsinexportfile.trim().equals("")) colsinexportfile="5";
        try
        {
            blrdbean.setColsinexportfile(Integer.parseInt(colsinexportfile.trim()));
        }catch(NumberFormatException e)
        {
            throw new WabacusConfigLoadingException("加载报表"+disbean.getReportBean().getPath()+"失败,为<display/>配置的colsinexportfile属性值"+colsinexportfile
                    +"不是有效数字",e);
        }
        String blockstyleproperty=disbean.getValuestyleproperty(null,true);
        if(blockstyleproperty==nullblockstyleproperty="";
        String style=Tools.getPropertyValueByName("style",blockstyleproperty,false);
        style=style==null?"":style.trim();
        String widthinstyle=Tools.getPropertyValueFromStyle("width",style);
        if((widthinstyle==null||widthinstyle.trim().equals(""))&&blockwidth!=null&&!blockwidth.trim().equals(""))
        {//没有在blockstyleproperty的style中指定width,但在<display/>中配置了blockwidth
            if(!style.equals("")&&!style.endsWith(";")) style=style+";";
            style=style+"width:"+blockwidth+";";
        }
        String heightinstyle=Tools.getPropertyValueFromStyle("height",style);
        if((heightinstyle==null||heightinstyle.trim().equals(""))&&blockheight!=null&&!blockheight.trim().equals(""))
        {//没有在blockstyleproperty的style中指定height,但在<display/>中配置了blockheight
            if(!style.equals("")&&!style.endsWith(";")) style=style+";";
            style=style+"height:"+blockheight+";";
        }
        blockstyleproperty=Tools.removePropertyValueByName("style",blockstyleproperty);
        if(style!=null&&!style.trim().equals(""))
        {
            blockstyleproperty=blockstyleproperty+" style=\""+style+"\"";
        }
        disbean.setValuestyleproperty(blockstyleproperty.trim(),true);
        return 1;
    }
    public int doPostLoad(ReportBean reportbean)
    {
        DisplayBean disbean=reportbean.getDbean();
        disbean.setColselect(false);
        alrbean.setRowSelectType(.);
        return super.doPostLoad(reportbean);
    }
    protected void processReportScrollConfig(ReportBean reportbean)
    {
        
        alrbean.setFixedcols(null,0);
        alrbean.setFixedrows(0);
        boolean isShowScrollX=reportbean.getScrollwidth()!=null&&!reportbean.getScrollwidth().trim().equals("");
        boolean isShowScrollY=reportbean.getScrollheight()!=null&&!reportbean.getScrollheight().trim().equals("");
        if(..equals(reportbean.getScrollstyle())&&isShowScrollY)
        {
            String[] htmlsizeArr=WabacusAssistant.getInstance().parseHtmlElementSizeValueAndType(reportbean.getHeight());
            if(htmlsizeArr==null||htmlsizeArr[0].equals("")||htmlsizeArr[0].equals("0"))
            {
                throw new WabacusConfigLoadingException("加载报表"+reportbean.getPath()
                        +"失败,blocklist报表类型要显示图片垂直滚动条时,必须配置height属性,否则在firefox/chrome等浏览器上显示不出垂直滚动条");
            }else
            {
                if(htmlsizeArr[1]!=null&&htmlsizeArr[1].equals("%"))
                {//如果配置的为百分比
                    throw new WabacusConfigLoadingException("加载报表"+reportbean.getPath()
                            +"失败,blocklist报表类型要显示图片垂直滚动条时,必须配置height属性,且不能配置为百分比,否则在firefox/chrome等浏览器上显示不出垂直滚动条");
                }
            }
        }
        ComponentAssistant.getInstance().doPostLoadForComponentScroll(reportbean,isShowScrollX,isShowScrollY,reportbean.getScrollwidth(),
                reportbean.getScrollheight(),reportbean.getScrollstyle());
    }
New to GrepCode? Check out our FAQ X