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

📄 basecell.java

📁 分页查询控件 分页查询控件
💻 JAVA
字号:
/* * Copyright 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.cell;import org.apache.commons.lang.StringUtils;import org.extremecomponents.base.BaseModel;import org.extremecomponents.table.bean.Column;import org.extremecomponents.util.HtmlBuilder;/** * Some of the common things that a cell needs to do. Most of the time this * class should be extended for convenience *  * @author Jeff Johnston */public abstract class BaseCell implements Cell {    /**     * An even row in the table.     */    public final static String EVEN = "even";    /**     * An odd row in the table.     */    public final static String ODD = "odd";        protected BaseModel model;    protected Column column;    protected Integer rowcount;    public BaseCell() {    }    /**     * Set the Model, Column and current rowcount.     */    public void init(BaseModel model, Column column, Integer rowcount) {        this.model = model;        this.column = column;        this.rowcount = rowcount;    }    /**     * Destroy the objects set up in the init() method.     */    public void destroy() {        this.model = null;        this.column = null;        this.rowcount = null;    }    /**     * Find out if the column is sitting on an even row.     */    public boolean isRowEven() {        if (rowcount != null && (rowcount.intValue() % 2) == 0) {            return true;        }        return false;    }    /**     * Find out if the column is sitting on an odd row.     */    public boolean isRowOdd() {        if (rowcount != null && (rowcount.intValue() % 2) == 0) {            return false;        }        return true;    }    /**     * Get the HTML for the td     * <td>tag. If the style is defined then it will try to use that first. If     * no style is defined then will use the alternating even and odd styles.     */    public String startTD() {        HtmlBuilder html = new HtmlBuilder();        html.td(2);        if (StringUtils.isNotEmpty(column.getStyleClass())) {            html.styleClass(column.getStyleClass());        } else if (isRowEven()) {            html.styleClass(EVEN);        } else if (isRowOdd()) {            html.styleClass(ODD);        }        if (StringUtils.isNotEmpty(column.getWidth())) {            html.width(column.getWidth());        }        if (StringUtils.isNotEmpty(column.getStyle())) {            html.style(column.getStyle());        }        html.close();        return html.toString();    }    /**     * Get the HTML for the end td</td>     * tag.     */    public String endTD() {        return new HtmlBuilder().tdEnd().toString();    }    /**     * Get the cell specific HTML     */    public abstract String html();}

⌨️ 快捷键说明

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