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.buttons;
public abstract class AbsEditableReportButton extends WabacusButton
    {
        super(ccbean);
    }
    protected boolean checkDisplayPermission(ReportRequest rrequest)
    {
        AbsReportType reportObj=(AbsReportType)rrequest.getComponentTypeObj(,null,true);
        if(reportObj!=null)
        {
            if(!(reportObj instanceof IEditableReportType)) return false;
            if(EditableReportAssistant.getInstance().isReadonlyAccessMode(((IEditableReportType)reportObj))) return false;
            if(!..equals(this.getButtonType()))
            {
                if(rrequest.checkPermission(reportObj.getReportBean().getId(),.,null,.)) return false;
            }
        }
        return super.checkDisplayPermission(rrequest);
    }
    public String showButton(ReportRequest rrequest,String params)
    {
        if(!shouldShowThisEditButton(rrequest)) return "";
        return super.showButton(rrequest,getClickEvent(rrequest,params));
    }
    public String showButton(ReportRequest rrequest,String params,String button)
    {
        if(!shouldShowThisEditButton(rrequest)) return "";
        return super.showButton(rrequest,getClickEvent(rrequest,params),button);
    }
    public String showMenu(ReportRequest rrequest,String params)
    {
        if(!shouldShowThisEditButton(rrequest)) return "";
        return super.showMenu(rrequest,getClickEvent(rrequest,params));
    }
    
    private boolean shouldShowThisEditButton(ReportRequest rrequest)
    {
        AbsReportType reportObj=(AbsReportType)rrequest.getComponentTypeObj(,null,true);
        if(!(reportObj instanceof IEditableReportType)) return false;
        if(!((IEditableReportType)reportObj).needCertainTypeButton(this)) return false;
        return true;
    }
    
    protected abstract String getClickEvent(ReportRequest rrequest,String params);
New to GrepCode? Check out our FAQ X