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.dataexport;
 
 import java.util.List;
 
 
 public class PDFExportBean extends AbsDataExportBean
 {
     private String pdftemplate;
     
     private int pagesize=.;
     
     private Rectangle pdfpagesizeObj;
 
     private float width;
     
     private boolean fullpagesplit;
     
     private int titlefontsize;
     
     private int dataheaderfontsize;
     
     private int datafontsize;
     
     private boolean isPrint;
     
     private AbsPdfInterceptor interceptorObj;
     
     public PDFExportBean(IComponentConfigBean owner,String type)
     {
         super(owner,type);
     }
 
     public int getPagesize()
     {
         return ;
     }
 
     public Rectangle getPdfpagesizeObj()
     {
         return ;
     }
 
     public String getPdftemplate()
     {
         return ;
     }
 
     public void setPdftemplate(String pdftemplate)
     {
         this.=pdftemplate;
     }
 
     public float getWidth()
     {
         return ;
     }
 
     public boolean isPrint()
     {
         return ;
     }
 
     public void setPrint(boolean isPrint)
     {
         this.=isPrint;
     }
 
    public boolean isFullpagesplit()
    {
        return ;
    }
    public int getTitlefontsize()
    {
        return ;
    }
    public int getDataheaderfontsize()
    {
        return ;
    }
    public int getDatafontsize()
    {
        return ;
    }
    {
        return ;
    }
    public void setInterceptorObj(AbsPdfInterceptor interceptorObj)
    {
        this.=interceptorObj;
    }
    public void loadConfig(XmlElementBean eleDataExport)
    {
        super.loadConfig(eleDataExport);
        if(this.)
        {
            =eleDataExport.getContent();
        }else
        {
            =eleDataExport.attributeValue("template");
        }
        if(!=null=.trim();
        String strpagesize=eleDataExport.attributeValue("pagesize");
        if(strpagesize!=null&&!strpagesize.trim().equals(""))
        {
            this.=Integer.parseInt(strpagesize);
        }
        String pdfpagesize=eleDataExport.attributeValue("printpagesize");
        if(pdfpagesize==null||pdfpagesize.trim().equals("")) pdfpagesize="A3";
        try
        {
            =(Rectangle)PageSize.class.getDeclaredField(pdfpagesize).get(null);
            if(==null)
            {
                =.;
            }
        }catch(Exception e)
        {
            throw new WabacusConfigLoadingException("加载组件"+this..getPath()+"数据导出功能失败,配置的pagesize属性"+pdfpagesize+"不支持",e);
        }
        String strwidth=eleDataExport.attributeValue("width");
        if(strwidth!=null&&!strwidth.trim().equals(""))
        {
            =Float.parseFloat(strwidth);
        }
        String fullpagesplit=eleDataExport.attributeValue("fullpagesplit");
        if(fullpagesplit!=null&&!fullpagesplit.trim().equals(""))
        {
            this.=!fullpagesplit.toLowerCase().trim().equals("false");
        }else
        {
            this.=true;
        }
        String titlefontsize=eleDataExport.attributeValue("titlefontsize");
        if(titlefontsize!=null&&!titlefontsize.trim().equals("")) this.=Integer.parseInt(titlefontsize);
        String dataheaderfontsize=eleDataExport.attributeValue("dataheaderfontsize");
        if(dataheaderfontsize!=null&&!dataheaderfontsize.trim().equals("")) this.=Integer.parseInt(dataheaderfontsize);
        String datafontsize=eleDataExport.attributeValue("datafontsize");
        if(datafontsize!=null&&!datafontsize.trim().equals("")) this.=Integer.parseInt(datafontsize);
        String interceptor=eleDataExport.attributeValue("interceptor");
        if(interceptor!=null)
        {
            interceptor=interceptor.trim();
            if(interceptor.equals(""))
            {
                this.=null;
            }else
            {
                Object objTmp=null;
                try
                {
                    objTmp=..loadClassByCurrentLoader(interceptor).newInstance();
                }catch(Exception e)
                {
                    throw new WabacusConfigLoadingException("为组件"+this..getPath()+"配置的导出到PDF文件中指定的拦截器类"+interceptor+"无法实例化",e);
                }
                if(!(objTmp instanceof AbsPdfInterceptor))
                {
                    throw new WabacusConfigLoadingException("为组件"+this..getPath()+"配置的导出到PDF文件中指定的拦截器类"+interceptor+"没有继承框架父类"
                            +AbsPdfInterceptor.class.getName());
                }
                this.=(AbsPdfInterceptor)objTmp;
            }
        }
    }
    public void doPostLoad()
    {
        super.doPostLoad();
        if(this.==.&&this. instanceof ReportBean)
        {
            this.=((ReportBean)this.).getLstPagesize().get(0);
        }
        if(this.)
        {
            List<AbsButtonTypelstPrintButtons=null;
            if(this..getButtonsBean()!=nulllstPrintButtons=this..getButtonsBean().getLstPrintTypeButtons(.);
            if(lstPrintButtons==null||lstPrintButtons.size()==0)
            {
                AbsButtonType buttonObj=Config.getInstance().getResourceButton(null,this.,
                        ..get(.),PrintButton.class);
                if(buttonObj.getName()==null||buttonObj.getName().trim().equals(""))
                {
                    buttonObj.setName(PrintButton.class.getName()+"."+(int)(Math.random()*10000));
                }
                if(this. instanceof AbsContainerConfigBean)
                {
                    buttonObj.setPosition("top");//对于容器,默认位置在顶部
                }
                ComponentConfigLoadManager.addButtonToPositions(this.,buttonObj);
            }
            lstPrintButtons=this..getButtonsBean().getLstPrintTypeButtons(.);
            for(int j=0;j<lstPrintButtons.size();j++)
            {
                ((PrintButton)lstPrintButtons.get(j)).setPdfPrint(true);
            }
        }
    }
New to GrepCode? Check out our FAQ X