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;
 
 import java.util.List;
 import java.util.Map;
 
 
 
 public abstract class AbsComponentConfigBean implements IComponentConfigBean,Cloneable
 {
     protected String id;
 
     protected String refreshid;
     
     protected String refreshGuid;
     
     protected String top;
     
     protected String bottom;
 
     protected String left;
     
     protected String right;
 
     protected String width;
     
     protected String height;
     
     protected String align;
     
     protected String valign="top";
     
     protected String scrollstyle;
     
     protected String title;
     
     protected Map<String,StringmDynTitleParts;
 
     protected String titlealign="left";
     
     protected String subtitle;
     
     protected Map<String,StringmDynSubtitleParts;
     
     protected String parenttitle;
     
     protected Map<String,StringmDynParenttitleParts;
     
     protected String parentSubtitle;
     
     protected Map<String,StringmDynParentSubtitleParts;
     
     private ButtonsBean buttonsBean=null;
     
     private boolean showContextMenu=true;
     
     private TemplateBean headerTplBean;//<header/>配置的静态模板对象
     
     private TemplateBean footerTplBean;//<footer/>配置的静态模板对象
     
     
     
    private PDFExportBean pdfPrintBean;//PDF打印配置,与pdf导出配置完全一样,但与其它打印方式不同,所以单独做为一个成员变量存放
    
    
    public AbsComponentConfigBean(AbsContainerConfigBean parentContainer)
    {
        this.=parentContainer;
    }
    
    public String getId()
    {
        return ;
    }
    public String getGuid()
    {
        if(this.==nullreturn this.;//没有父容器,即是顶层<page/>
        return this.getPageBean().getId()+.+this.;
    }
    
    public String getPath()
    {
        if(this.getParentContainer()==null)
        {
            return this.;
        }else
        {
            return this.getParentContainer().getPath()+.+this.;
        }
    }
    
    public void setId(String id)
    {
        this.=id;
    }
    public String getRefreshid()
    {
        return ;
    }
    public void setRefreshid(String refreshid)
    {
        this.=refreshid;
    }
    public String getRefreshGuid()
    {
        if(this..equals(this.getPageBean().getId())) return this.;
        if(this.==null)
        {
            this.=ComponentConfigLoadAssistant.getInstance().createComponentRefreshGuidByRefreshId(this.getPageBean(),this.,this.);
        }
        return ;
    }
    public String getTop()
    {
        return ;
    }
    public void setTop(String top)
    {
        this.=top;
    }
    public String getBottom()
    {
        return ;
    }
    public void setBottom(String bottom)
    {
        this.=bottom;
    }
    public String getRight()
    {
        return ;
    }
    public void setRight(String right)
    {
        this.=right;
    }
    public String getLeft()
    {
        return ;
    }
    public void setLeft(String left)
    {
        this.=left;
    }
    public String getAlign()
    {
        return ;
    }
    public void setAlign(String align)
    {
        this.=align;
    }
    public String getValign()
    {
        return ;
    }
    public void setValign(String valign)
    {
        this.=valign;
    }
    {
        return ;
    }
    public void setDataExportsBean(DataExportsConfigBean dataExportsBean)
    {
        this.=dataExportsBean;
    }
    public String getScrollstyle()
    {
        if(==null||.trim().equals(""))
        {
            String scrollstyleTmp=Config.getInstance().getSystemConfigValue("default-scrollstyle",.).toLowerCase();
            if(!..contains(scrollstyleTmp))
            {
                throw new WabacusRuntimeException("在wabacus.cfg.xml的default-scrollstyle属性中配置的值"+scrollstyleTmp+"不支持");
            }
            return scrollstyleTmp;
        }
        return ;
    }
    public void setScrollstyle(String scrollstyle)
    {
        this.=scrollstyle;
    }
    public String getTitle(ReportRequest rrequest)
    {
        return WabacusAssistant.getInstance().getStringValueWithDynPart(rrequest,this.,this.,"");
    }
    public void setTitle(String title)
    {
        Object[] objArr=WabacusAssistant.getInstance().parseStringWithDynPart(title);
        this.=(String)objArr[0];
        this.=(Map<String,String>)objArr[1];
    }
    public String getSubtitle(ReportRequest rrequest)
    {
       return WabacusAssistant.getInstance().getStringValueWithDynPart(rrequest,this.,this.,"");
    }
    public void setSubtitle(String subtitle)
    {
        Object[] objArr=WabacusAssistant.getInstance().parseStringWithDynPart(subtitle);
        this.=(String)objArr[0];
        this.=(Map<String,String>)objArr[1];
    }
    public String getParenttitle(ReportRequest rrequest)
    {
        return WabacusAssistant.getInstance().getStringValueWithDynPart(rrequest,this.,this.,"");
    }
    public void setParenttitle(String parenttitle)
    {
        Object[] objArr=WabacusAssistant.getInstance().parseStringWithDynPart(parenttitle);
        this.=(String)objArr[0];
        this.=(Map<String,String>)objArr[1];
    }
    public String getParentSubtitle(ReportRequest rrequest)
    {
        return WabacusAssistant.getInstance().getStringValueWithDynPart(rrequest,this.,this.,"");
    }
    public void setParentSubtitle(String parentSubtitle)
    {
        Object[] objArr=WabacusAssistant.getInstance().parseStringWithDynPart(parentSubtitle);
        this.=(String)objArr[0];
        this.=(Map<String,String>)objArr[1];
    }
    public void setMDynTitleParts(Map<String,StringdynTitleParts)
    {
        this.=dynTitleParts;
    }
    public void setMDynSubtitleParts(Map<String,StringdynSubtitleParts)
    {
        this.=dynSubtitleParts;
    }
    public void setMDynParenttitleParts(Map<String,StringdynParenttitleParts)
    {
        this.=dynParenttitleParts;
    }
    public void setMDynParentSubtitleParts(Map<String,StringdynParentSubtitleParts)
    {
        this.=dynParentSubtitleParts;
    }
    public String getTitlealign()
    {
        return ;
    }
    public void setTitlealign(String titlealign)
    {
        this.=titlealign;
    }
    public String getWidth()
    {
        return ;
    }
    public void setWidth(String width)
    {
        this.=width;
    }
    public String getHeight()
    {
        return ;
    }
    public void setHeight(String height)
    {
        this.=height;
    }
    
    public boolean shouldShowContextMenu()
    {
        if(!return false;
        if(this.==nullreturn false;
                ||this..getButtonsByPosition(.).size()==0) return false;
        return true;
    }
    
    public void setShowContextMenu(boolean showContextMenu)
    {
        this.=showContextMenu;
    }
    
    {
        return ;
    }
    public void setHeaderTplBean(TemplateBean headerTplBean)
    {
        ComponentAssistant.getInstance().validComponentHeaderTpl(this,headerTplBean);
        this.=headerTplBean;
    }
    {
        return ;
    }
    public void setFooterTplBean(TemplateBean footerTplBean)
    {
        ComponentAssistant.getInstance().validComponentFooterTpl(this,footerTplBean);
        this.=footerTplBean;
    }
    
    public ButtonsBean getButtonsBean()
    {
        return ;
    }
    public void setButtonsBean(ButtonsBean buttonsBean)
    {
        this.=buttonsBean;
    }
    
    public void setPrintBean(AbsPrintProviderConfigBean printBean)
    {
        this.=printBean;
    }
    
    {
        return this.;
    }
    
    {
        return ;
    }
    public void setPdfPrintBean(PDFExportBean pdfPrintBean)
    {
        this.=pdfPrintBean;
    }
    
    public void addOnloadMethod(OnloadMethodBean onLoadMethodBean)
    {
        if(this.==nullthis.=new ArrayList<OnloadMethodBean>();
        .add(onLoadMethodBean);
    }
    
    public void removeOnloadMethodByType(String type)
    {
        if(==null||.size()==0) return;
        for(int i=.size()-1;i>=0;i--)
        {
            if(type.equalsIgnoreCase(.get(i).getType()))
            {
                .remove(i);
            }
        }
    }
    
    {
        return ;
    }
    public String getOnloadMethodName()
    {
        if(==null||.size()==0) return "''";
        return this.getGuid()+"_onload";
    }
    
    {
        return ;
    }
    public void setParentContainer(AbsContainerConfigBean parentContainer)
    {
        this.=parentContainer;
    }
    public PageBean getPageBean()
    {
        if(this instanceof PageBean)
        {
            return (PageBean)this;
        }
        AbsContainerConfigBean bean=this.getParentContainer();
        if(bean==nullreturn null;
        while(!(bean instanceof PageBean))
        {
            bean=bean.getParentContainer();
            if(bean==nullreturn null;
            continue;
        }
        return (PageBean)bean;
    }
    public void doPostLoad()
    {
        if(this.!=nullthis..doPostLoad();
        if(this.!=nullthis..doPostLoad();
        if(!=null.doPostLoad();
        if(this.!=nullthis..doPostLoad();
    }
    public void doPostLoadFinally()
    {
        
    }
    
    public IComponentConfigBean clone(AbsContainerConfigBean parentContainer)
    {
        try
        {
            AbsComponentConfigBean configBeanNew=(AbsComponentConfigBean)super.clone();
            configBeanNew.setParentContainer(parentContainer);
            configBeanNew.setRefreshid(null);
            if(this.!=null)
            {
                configBeanNew.setDataExportsBean(.clone(configBeanNew));
            }
            if(this.!=null)
            {
                AbsPrintProviderConfigBean newPrintBean=(AbsPrintProviderConfigBean)this..clone();
                newPrintBean.setOwner(configBeanNew);
                configBeanNew.setPrintBean(newPrintBean);
            }
            if(!=null)
            {
                configBeanNew.setPdfPrintBean((PDFExportBean).clone(configBeanNew)); 
            }
            if(this.!=null)
            {
                configBeanNew.setMDynTitleParts((Map<String,String>)((HashMap<String,String>)this.).clone());
            }
            if(this.!=null)
            {
                configBeanNew.setMDynSubtitleParts((Map<String,String>)((HashMap<String,String>)this.).clone());
            }
            if(this.!=null)
            {
                configBeanNew.setMDynParenttitleParts((Map<String,String>)((HashMap<String,String>)this.).clone());
            }
            if(this.!=null)
            {
                configBeanNew.setMDynParentSubtitleParts((Map<String,String>)((HashMap<String,String>)this.).clone());
            }
            return configBeanNew;
        }catch(CloneNotSupportedException e)
        {
            e.printStackTrace();
            return null;
        }
    }
    
    
    //$ByQXO 所有属性列表Map,以便扩展类中使用
    private Map<String,Stringattrs;
    public Map<String,StringgetAttrs()
    {
        return  == null ? . : ;
    }
    public void setAttrs(Map<String,Stringattrs)
    {
        this.=attrs;
    }
    
    public void mergeAttrs(Map<String,StringoverrideAttrs){
        if(overrideAttrs == null || overrideAttrs.isEmpty()){
            return;
        }
        if( == null){
             = new HashMap<String,String>();
        }
        .putAll(overrideAttrs);
    }    
    //ByQXO$
    
New to GrepCode? Check out our FAQ X