⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exporttag.java

📁 分页查询控件 分页查询控件
💻 JAVA
字号:
/* * Copyright 2004 original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *    http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.extremecomponents.table.tag;import javax.servlet.jsp.JspException;import javax.servlet.jsp.tagext.TagSupport;import org.apache.commons.lang.StringUtils;import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;import org.extremecomponents.table.bean.Attributes;import org.extremecomponents.table.bean.Export;/** * @jsp.tag name="export" display-name="ExportTag" body-content="JSP" *          description="Export data to a given view. For example pdf or xls." *  * @author Jeff Johnston */public class ExportTag extends TagSupport implements ExtendedAttributes {    private static final long serialVersionUID = -1873036948474547010L;    private String fileName;    private String view;    private String tooltip;    /**     * @jsp.attribute description="The name of the export file. Example     *                presidents.pdf" required="true" rtexprvalue="true"     */    public String getFileName() {        return fileName;    }    public void setFileName(String fileName) {        this.fileName = fileName;    }    /**     * @jsp.attribute description="The type of the export. Types are pdf, xls,     *                or csv. Works with the View interface." required="false"     *                rtexprvalue="true"     */    public String getView() {        return view;    }    public void setView(String view) {        this.view = view;    }    /**     * @jsp.attribute description="The tooltip that shows up when you mouseover     *                the export image." required="false" rtexprvalue="true"     */    public String getTooltip() {        if (StringUtils.isBlank(tooltip)) {            return fileName;        }        return tooltip;    }    public void setTooltip(String tooltip) {        this.tooltip = tooltip;    }    public int doEndTag()            throws JspException {        TableTag tableTag = (TableTag) findAncestorWithClass(this, TableTag.class);        if (tableTag.getRowCount() > 0) //only go through the first pass        {            return EVAL_PAGE;        }        if (fileName != null) {            setFileName((String) ExpressionEvaluatorManager.evaluate("fileName", fileName, java.lang.String.class, pageContext));        }        if (tooltip != null) {            setTooltip((String) ExpressionEvaluatorManager.evaluate("tooltip", tooltip, java.lang.String.class, pageContext));        }        Export export = new Export();        export.addAttribute(Export.FILE_NAME, getFileName());        export.addAttribute(Export.VIEW, getView());        export.addAttribute(Export.TOOLTIP, getTooltip());        addExtendedAttributes(export);        tableTag.addExport(export);        return EVAL_PAGE;    }    public void addExtendedAttributes(Attributes attributes)            throws JspException {    }    public void release() {        fileName = null;        view = null;        tooltip = null;        super.release();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -