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

📄 treecolumntag.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.tree.tag;import javax.servlet.jsp.JspException;import org.apache.commons.lang.StringUtils;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;import org.extremecomponents.table.bean.Column;import org.extremecomponents.table.tag.ColumnTag;import org.extremecomponents.table.tag.TableTag;import org.extremecomponents.tree.bean.TreeNode;import org.extremecomponents.tree.core.TreeModel;import org.extremecomponents.util.ExceptionUtils;/** * @jsp.tag name="treecolumn" display-name="TreeColumnTag" body-content="JSP" *          description="The container which holds all the column specific *          information. A copy of each column will be fed to the Model." *  * @author phorn */public class TreeColumnTag extends ColumnTag {    private static final long serialVersionUID = -2134703529160375990L;    private static Log logger = LogFactory.getLog(TreeColumnTag.class);    public static final String NO_PROPERTY_SPECIFIED = "NO_PROPERTY_SPECIFIED";    public static final String CELL = "tree";    private Object extendedValue;    /**     * @jsp.attribute description="The value for the column. Typically this will     *                be the value of the property attribute. If the value     *                attribute is not specifed then it will be retrieved     *                automatically by using the property attribute."     *                required="false" rtexprvalue="true"     */    public Object getExtendedValue() {        return extendedValue;    }    public void setExtendedValue(Object extendedValue) {        this.extendedValue = extendedValue;    }    /**     * Get the value for the column. First look to see if it displayed in the     * body of the column. If it is not in the body, then use the value     * attribute. If the value attribute is not specified then use the property     * attribute to find the value in the bean.     */    public void setColumnValue()            throws JspException {        logger.debug("TreeColumnTag.setColumnValue()");        TableTag tableTag;        try {            tableTag = (TableTag) findAncestorWithClass(this, TableTag.class);            if (tableTag.getRowCount() == 0) {                //not going through the body for content yet...skip the first pass through                return;            }            if (this.bodyContent != null) {                //have a body                setExtendedValue(getBodyContent().getString());            }            if (getExtendedValue() != null) {                setExtendedValue((Object) ExpressionEvaluatorManager.evaluate("value", getExtendedValue().toString(),                        Object.class, this, pageContext));            }            TreeModel model = (TreeModel) tableTag.getModel();            model.setExtendedValue((String) getExtendedValue());            TreeNode node = (TreeNode) pageContext.getAttribute(tableTag.getCollection());            setValue(node);        } catch (Exception e) {            logger.error("TreeColumnTag.setColumnValue() Problem", e);            throw new JspException("TreeColumnTag.setColumnValue() Problem " + ExceptionUtils.formatStackTrace(e));        }    }    /**     * Must make a copy of the column because this tag may be reused. Send the     * copy up to the Model.     */    public int doEndTag()            throws JspException {        logger.debug("TreeColumnTag.doEndTag()");        try {            TreeTag treeTag = (TreeTag) findAncestorWithClass(this, TableTag.class);            if (StringUtils.isBlank(getProperty()))                setProperty(NO_PROPERTY_SPECIFIED);            if (treeTag.isIteratingBody()) {                setColumnValue();                treeTag.addColumnValue(getProperty(), getValue(), getColumnPropertyValue());            } else {                Column column = new Column();                                if (NO_PROPERTY_SPECIFIED.equals(getProperty())) {                    if (StringUtils.isBlank(getTitle())) {                        column.addAttribute(Column.TITLE, " ");                    }                    else {                        column.addAttribute(Column.TITLE, getTitle());                    }                    column.addAttribute(Column.FILTERABLE, "false");                    column.addAttribute(Column.SORTABLE, "false");                    column.addAttribute(Column.PROPERTY, NO_PROPERTY_SPECIFIED);                } else {                    column.addAttribute(Column.PROPERTY, getProperty());                    column.addAttribute(Column.TITLE, getTitle());                    column.addAttribute(Column.FILTERABLE, getFilterable());                    column.addAttribute(Column.SORTABLE, getSortable());                }                column.addAttribute(Column.VALUE, getValue());                column.addAttribute(Column.STYLE_CLASS, getStyleClass());                column.addAttribute(Column.HEADER_CLASS, getHeaderClass());                column.addAttribute(Column.CELL, CELL);                column.addAttribute(Column.HEADER_CELL, getHeaderCell());                column.addAttribute(Column.FORMAT, getFormat());                column.addAttribute(Column.PARSE, getParse());                column.addAttribute(Column.WIDTH, getWidth());                column.addAttribute(Column.STYLE, getStyle());                column.addAttribute(Column.EXPORTABLE, getExportable());                column.addAttribute(Column.FILTER_CELL, getFilterCell());                column.addAttribute(Column.SHOW_TOTAL, getShowTotal());                addExtendedAttributes(column);                treeTag.addColumn(column);            }        } catch (Exception e) {            throw new JspException("TreeColumnTag.doEndTag() Problem: " + ExceptionUtils.formatStackTrace(e));        }        setBodyContent(null);        return EVAL_PAGE;    }    public void release() {        super.release();    }}

⌨️ 快捷键说明

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