📄 exporttag.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.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 String fileName; private String imageName; 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 TagUtils.evaluateExpressionAsString("fileName", fileName, this, pageContext); } public void setFileName(String fileName) { this.fileName = fileName; } /** * @jsp.attribute description="The image name. Example pdf" required="false" * rtexprvalue="true" */ public String getImageName() { if (StringUtils.isBlank(imageName)) { return getView(); } return TagUtils.evaluateExpressionAsString("image", imageName, this, pageContext); } public void setImageName(String imageName) { this.imageName = imageName; } /** * @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 TagUtils.evaluateExpressionAsString("view", view, this, pageContext); } 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() { return TagUtils.evaluateExpressionAsString("tooltip", this.tooltip, this, pageContext); } public void setTooltip(String tooltip) { this.tooltip = tooltip; } public int doEndTag() throws JspException { if (TagUtils.isIteratingBody(this)) { return EVAL_PAGE; } Export export = new Export(); export.addAttribute(Export.FILE_NAME, getFileName()); export.addAttribute(Export.IMAGE_NAME, getImageName()); export.addAttribute(Export.VIEW, getView()); export.addAttribute(Export.TOOLTIP, getTooltip()); addExtendedAttributes(export); TagUtils.getModel(this).getExportHandler().addExport(export); return EVAL_PAGE; } public void addExtendedAttributes(Attributes attributes) throws JspException { } public void release() { fileName = null; imageName = null; view = null; tooltip = null; super.release(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -