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

📄 tablemodel.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.core;import java.util.ArrayList;import java.util.Collection;import javax.servlet.jsp.PageContext;import org.extremecomponents.base.BaseModel;import org.extremecomponents.base.BaseProperties;import org.extremecomponents.base.BaseResourceBundle;import org.extremecomponents.base.BaseSortHandler;import org.extremecomponents.base.BaseViewHandler;import org.extremecomponents.table.callback.RetrieveRowsCallback;import org.extremecomponents.table.handler.SortHandler;import org.extremecomponents.table.handler.TotalHandler;import org.extremecomponents.table.handler.ViewHandler;/** * Build up a Model that represents the table. This is the main reference point * to all objects that are needed to build the table display up. *  * @author Jeff Johnston */public class TableModel extends BaseModel {    private TableProperties properties = new TableProperties(this);    private TableResourceBundle resourceBundle = new TableResourceBundle(this);    private SortHandler sortHandler = new SortHandler(this);    private ViewHandler viewHandler = new ViewHandler(this);    private TotalHandler totalHander = new TotalHandler(this);    public TableModel(PageContext pageContext) {        super(pageContext);    }    public BaseSortHandler getSortHandler() {        return sortHandler;    }    public TotalHandler getTotalHandler() {        return totalHander;    }    public BaseViewHandler getViewHandler() {        return viewHandler;    }    public BaseProperties getProperties() {        return properties;    }        public BaseResourceBundle getResourceBundle() {        return resourceBundle;    }    /**     * Do all the filtering and sorting and return the rows of the table that     * need to be displayed.     */    public Collection execute()            throws Exception {        RetrieveRowsCallback retrieveRowsCallback = (RetrieveRowsCallback) getCallback(getTableHandler().getTable()                .getRetrieveRowsCallback());        getTableHandler().setCollectionOfBeans(retrieveRowsCallback.retrieveRows(this));        //make a copy for thread safety        Collection rows = new ArrayList(getTableHandler().getCollectionOfBeans());        rows = getFilterHandler().filterRows(this, rows);        getTotalHandler().buildTotals(rows);        rows = getSortHandler().sortRows(rows);        getTableHandler().setTableSections(rows.size());        viewHandler.setView();        return getTableHandler().splitIntoTableSectionRows(rows);    }    public void destroy() {        properties = null;        resourceBundle = null;        sortHandler = null;        viewHandler = null;        totalHander = null;        super.destroy();    }}

⌨️ 快捷键说明

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