📄 tabletag.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 java.util.Iterator;import javax.servlet.jsp.JspException;import javax.servlet.jsp.tagext.TagSupport;import javax.servlet.jsp.tagext.TryCatchFinally;import org.extremecomponents.table.bean.Attributes;import org.extremecomponents.table.bean.Table;import org.extremecomponents.table.core.BaseModel;import org.extremecomponents.table.core.TableModel;import org.extremecomponents.table.handler.ExportHandler;import org.extremecomponents.util.ExceptionUtils;/** * @jsp.tag name="table" display-name="TableTag" body-content="JSP" * description="The container which holds all the main table * information. Will also hold global information if needed. The table * tag is copied into the Table and encapsulated in the Model." * * @author Jeff Johnston */public class TableTag extends TagSupport implements ExtendedAttributes, TryCatchFinally { protected final static String ROWCOUNT = "ROWCOUNT"; private String id; private String collection; private String action; private String tableId; private Object items; private String var; private String scope; private String styleClass; private String border; private String cellpadding; private String cellspacing; private String rowsDisplayed; private String imagePath; private String title; private String style; private String width; private String saveFilterSort; private String autoIncludeParameters; private String totalTitle; private String filterable; private String sortable; private String showPagination; private String showExports; private String showStatusBar; private String retrieveRowsCallback; private String filterRowsCallback; private String sortRowsCallback; private String view; private String locale; protected BaseModel model; private Iterator iterator; public BaseModel getModel() { return model; } /** * @jsp.attribute description="The table id attribute." required="false" * rtexprvalue="true" */ public String getId() { return TagUtils.evaluateExpressionAsString("id", id, this, pageContext); } public void setId(String id) { this.id = id; } /** * @jsp.attribute description="Identify the List of Beans or the List of * Maps for the table." required="false" rtexprvalue="true" * * @deprecated Use the tableId, items, and var attributes instead. */ public String getCollection() { return TagUtils.evaluateExpressionAsString("collection", collection, this, pageContext); } /** * @deprecated Use the tableId, items, and var attributes instead. */ public void setCollection(String collection) { this.collection = collection; } /** * @jsp.attribute description="The action is the URI that will be called * when the filter, sort and pagination is used." * required="false" rtexprvalue="true" */ public String getAction() { return TagUtils.evaluateExpressionAsString("action", action, this, pageContext); } public void setAction(String action) { this.action = action; } /** * @jsp.attribute description="The unique identifier for the table." * required="false" rtexprvalue="true" */ public String getTableId() { String tableId = TagUtils.evaluateExpressionAsString("tableId", this.tableId, this, pageContext); return TableTagUtils.getTableId(tableId, getCollection()); } public void setTableId(String tableId) { this.tableId = tableId; } /** * @jsp.attribute description="The collection that will be retrieved." * required="false" rtexprvalue="true" */ public Object getItems() { Object items = TagUtils.evaluateExpressionAsObject("items", this.items, this, pageContext); return TableTagUtils.getItems(items, getCollection()); } public void setItems(Object items) { this.items = items; } /** * @jsp.attribute description="The name of the variable to hold the current * bean." required="false" rtexprvalue="true" */ public String getVar() { String var = TagUtils.evaluateExpressionAsString("var", this.var, this, pageContext); return TableTagUtils.getVar(var, getTableId()); } public void setVar(String var) { this.var = var; } /** * @jsp.attribute description="The scope (page, request, session, * application) to find the List of beans or List of Maps * defined by the collection attribute." required="false" * rtexprvalue="true" */ public String getScope() { return TagUtils.evaluateExpressionAsString("scope", scope, this, pageContext); } public void setScope(String scope) { this.scope = scope; } /** * @jsp.attribute description="The css class style sheet." required="false" * rtexprvalue="true" */ public String getStyleClass() { String styleClass = TagUtils.evaluateExpressionAsString("styleClass", this.styleClass, this, pageContext); return TableTagUtils.getStyleClass(model, styleClass); } public void setStyleClass(String styleClass) { this.styleClass = styleClass; } /** * @jsp.attribute description="The table border attribute." required="false" * rtexprvalue="true" */ public String getBorder() { String border = TagUtils.evaluateExpressionAsString("border", this.border, this, pageContext); return TableTagUtils.getBorder(model, border); } public void setBorder(String border) { this.border = border; } /** * @jsp.attribute description="The table cellpadding attribute." * required="false" rtexprvalue="true" */ public String getCellpadding() { String cellpadding = TagUtils.evaluateExpressionAsString("cellpadding", this.cellpadding, this, pageContext); return TableTagUtils.getCellpadding(model, cellpadding); } public void setCellpadding(String cellpadding) { this.cellpadding = cellpadding; } /** * @jsp.attribute description="The table cellspacing attribute." * required="false" rtexprvalue="true" */ public String getCellspacing() { String cellspacing = TagUtils.evaluateExpressionAsString("cellspacing", this.cellspacing, this, pageContext); return TableTagUtils.getCellspacing(model, cellspacing); } public void setCellspacing(String cellspacing) { this.cellspacing = cellspacing; } /** * @jsp.attribute description="The number of rows to show in the table. * required="false" rtexprvalue="true" */ public String getRowsDisplayed() { String rowsDisplayed = TagUtils.evaluateExpressionAsString("rowsDisplayed", this.rowsDisplayed, this, pageContext); return TableTagUtils.getRowsDisplayed(model, rowsDisplayed); } public void setRowsDisplayed(String rowsDisplayed) { this.rowsDisplayed = rowsDisplayed; } /** * @jsp.attribute description="Specify whether or not the table is * filterable. Acceptable values are true or false." * required="false" rtexprvalue="true" */ public String getFilterable() { String filterable = TagUtils.evaluateExpressionAsString("filterable", this.filterable, this, pageContext); return TableTagUtils.getFilterable(model, filterable); } public void setFilterable(String filterable) { this.filterable = filterable; } /** * @jsp.attribute description="Specify whether or not the table should use * pagination. Acceptable values are true or false." * required="false" rtexprvalue="true" */ public String getShowPagination() { String showPagination = TagUtils.evaluateExpressionAsString("showPagination", this.showPagination, this, pageContext); return TableTagUtils.getShowPagination(model, showPagination); } public void setShowPagination(String showPagination) { this.showPagination = showPagination; } /** * @jsp.attribute description="Specify whether or not the table should use * the exports. Acceptable values are true or false." * required="false" rtexprvalue="true" */ public String getShowExports() { String showExports = TagUtils.evaluateExpressionAsString("showExports", this.showExports, this, pageContext); return TableTagUtils.getShowExports(model, showExports); } public void setShowExports(String showExports) { this.showExports = showExports; } /** * @jsp.attribute description="Specify whether or not the table should use * the status bar. Acceptable values are true or false." * required="false" rtexprvalue="true" */ public String getShowStatusBar() { String showStatusBar = TagUtils.evaluateExpressionAsString("showStatusBar", this.showStatusBar, this, pageContext); return TableTagUtils.getShowStatusBar(model, showStatusBar); } public void setShowStatusBar(String showStatusBar) { this.showStatusBar = showStatusBar; } /** * @jsp.attribute description="A convenience method look in one place for * the images, but use the default image names. The syntax * will look like imagePath=/extremesite/images/*.png, where * *.png is saying that will use all .png images." * required="false" rtexprvalue="true" */ public String getImagePath() { String imagePath = TagUtils.evaluateExpressionAsString("imagePath", this.imagePath, this, pageContext); return TableTagUtils.getImagePath(model, imagePath); } public void setImagePath(String imagePath) { this.imagePath = imagePath; } /** * @jsp.attribute description="Specify whether or not the table is sortable. * Acceptable values are true or false." required="false" * rtexprvalue="true" */ public String getSortable() { String sortable = TagUtils.evaluateExpressionAsString("sortable", this.sortable, this, pageContext); return TableTagUtils.getSortable(model, sortable); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -