亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tablemodelimpl.java

?? ecside jsp前途分頁的標簽 實現ajax 增刪改查等
?? JAVA
字號:
?/*
 * Copyright 2006-2007 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.ecside.core;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ecside.core.bean.Column;
import org.ecside.core.bean.Export;
import org.ecside.core.bean.Row;
import org.ecside.core.bean.Table;
import org.ecside.core.context.WebContext;
import org.ecside.preferences.TableProperties;
import org.ecside.table.handler.ColumnHandler;
import org.ecside.table.handler.ExportHandler;
import org.ecside.table.handler.RowHandler;
import org.ecside.table.handler.TableHandler;
import org.ecside.table.handler.ViewHandler;
import org.ecside.table.limit.Limit;
import org.ecside.table.limit.LimitFactory;
import org.ecside.table.limit.ModelLimitFactory;
import org.ecside.table.limit.TableLimit;

/**
 * @author Wei Zijun
 *
 */

public final class TableModelImpl implements TableModel {
    private Log logger = LogFactory.getLog(TableModel.class);

    // model interfaces
    private WebContext context;
    private Preferences preferences;
    private Messages messages;
    private Registry registry;

    // model handlers
    private TableHandler tableHandler = new TableHandler(this);
    private RowHandler rowHandler = new RowHandler(this);
    private ColumnHandler columnHandler = new ColumnHandler(this);
    private ViewHandler viewHandler = new ViewHandler(this);
    private ExportHandler exportHandler = new ExportHandler(this);

    // model objects
    private Object currentRowBean;
//    private Object previousRowBean;
    private Collection collectionOfBeans;
    private Collection collectionOfFilteredBeans;
    private Collection collectionOfPageBeans;
    private Limit limit;
    private Locale locale;

    public TableModelImpl(WebContext context) {
        this(context, null);
    }

    public TableModelImpl(WebContext context, String locale) {
        this.context = context;

        Preferences preferences = new TableProperties();
        preferences.init(context, TableModelUtils.getPreferencesLocation(context));
        this.preferences = preferences;

        this.locale = TableModelUtils.getLocale(context, preferences, locale);

        Messages messages = TableModelUtils.getMessages(this);
        messages.init(context, this.locale);
        this.messages = messages;
    }

    public WebContext getContext() {
        return context;
    }

    public Preferences getPreferences() {
        return preferences;
    }

    public Messages getMessages() {
        return messages;
    }

    public Registry getRegistry() {
        return registry;
    }

    public Table getTableInstance() {
        return new Table(this);
    }

    public Export getExportInstance() {
        return new Export(this);
    }

    public Row getRowInstance() {
        return new Row(this);
    }

    public Column getColumnInstance() {
        return new Column(this);
    }

    public void addTable(Table table) {
        tableHandler.addTable(table);

        // now set the registry
        this.registry = new TableRegistry(this);
        
        //then set the limit
        LimitFactory limitFactory = new ModelLimitFactory(this);
        this.limit = new TableLimit(limitFactory);
    }

    public void addExport(Export export) {
        exportHandler.addExport(export);
    }

    public void addRow(Row row) {
        rowHandler.addRow(row);
    }

    public void addColumn(Column column) {
        columnHandler.addAutoGenerateColumn(column);
    }

    public void addColumns(String autoGenerateColumns) {
        autoGenerateColumns = TableModelUtils.getAutoGenerateColumnsPreference(this, autoGenerateColumns);
        TableCache.getInstance().getAutoGenerateColumns(autoGenerateColumns).addColumns(this);
    }

    /**
     * The parameter value can be null, String, String[], or a List. The
     * parameter value will be converted to a String[] internally.
     * 
     * @param name The parameter name
     * @param value The parameter value
     */
    public void addParameter(String name, Object value) {
        registry.addParameter(name, value);
    }

    public TableHandler getTableHandler() {
        return tableHandler;
    }

    public RowHandler getRowHandler() {
        return rowHandler;
    }

    public ColumnHandler getColumnHandler() {
        return columnHandler;
    }

    public ViewHandler getViewHandler() {
        return viewHandler;
    }

    public ExportHandler getExportHandler() {
        return exportHandler;
    }

//    
//    public Object getPreviousRowBean() {
//        return previousRowBean;
//    }
//    
//    public void setPreviousRowBean(Object bean) {
//    	this.previousRowBean=bean;
//    }
    
    public Object getCurrentRowBean() {
        return currentRowBean;
    }

    public void setCurrentRowBean(Object bean) {
        int rowcount = rowHandler.increaseRowCount();
        this.currentRowBean = bean;
        context.setPageAttribute(TableConstants.ROWCOUNT, String.valueOf(rowcount));
        
        int globalRowcount = rowcount+limit.getRowStart();
        context.setPageAttribute(TableConstants.GLOBALROWCOUNT, String.valueOf(globalRowcount));
        context.setPageAttribute("TOTALROWCOUNT", String.valueOf(globalRowcount));
        
        context.setPageAttribute(tableHandler.getTable().getVar(), bean);
    }
    


    public Collection getCollectionOfBeans() {
        return collectionOfBeans;
    }

    public void setCollectionOfBeans(Collection collectionOfBeans) {
        this.collectionOfBeans = collectionOfBeans;
    }

    public Collection getCollectionOfFilteredBeans() {
        return collectionOfFilteredBeans;
    }

    public void setCollectionOfFilteredBeans(Collection collectionOfFilteredBeans) {
        this.collectionOfFilteredBeans = collectionOfFilteredBeans;
    }

    public Collection getCollectionOfPageBeans() {
        return collectionOfPageBeans;
    }

    public void setCollectionOfPageBeans(Collection collectionOfPageBeans) {
        this.collectionOfPageBeans = collectionOfPageBeans;
    }

    public Limit getLimit() {
        return limit;
    }

    public void setLimit(Limit limit) {
        this.limit = limit;
    }

    public Locale getLocale() {
        return locale;
    }

	private boolean hasExcuteQueryResult=false;
    public void queryResultExecute() throws Exception {

    	if (hasExcuteQueryResult) {
    		return ;
    	}

        Integer totalRows = getTableHandler().getTotalRows();
        int defaultRowsDisplayed = getTable().getRowsDisplayed();
        int totalRowsNum=0;
        if (totalRows != null) {
        	totalRowsNum=totalRows.intValue();
        } else {
        	totalRowsNum=0;
        }
        if (defaultRowsDisplayed<0) defaultRowsDisplayed=totalRowsNum;
        
        context.setPageAttribute(TableConstants.GLOBALROWCOUNT, String.valueOf(totalRowsNum));

        
        limit.setRowAttributes(totalRowsNum, defaultRowsDisplayed);

        if (logger.isDebugEnabled()) {
            logger.debug(limit.toString());
        }

        viewHandler.setView();
    	hasExcuteQueryResult=true;
    }
    
    public Collection execute() throws Exception {
        Collection rows = TableModelUtils.retrieveRows(this);


        
        if (!(rows instanceof List)) {
            rows = new ArrayList(rows); // copy for thread safety  ???
		}


        this.collectionOfBeans = rows;

        rows = TableModelUtils.filterRows(this, rows);

        rows = TableModelUtils.sortRows(this, rows);

        this.collectionOfFilteredBeans = rows;

        Integer totalRows = getTableHandler().getTotalRows();
        int defaultRowsDisplayed = getTable().getRowsDisplayed();
        int totalRowsNum=0;
        if (totalRows != null) {
        	totalRowsNum=totalRows.intValue();
        } else {
        	totalRowsNum=rows.size();
        }
        if (defaultRowsDisplayed<0) defaultRowsDisplayed=totalRowsNum;
        
        context.setPageAttribute(TableConstants.GLOBALROWCOUNT, String.valueOf(totalRowsNum));

        
        limit.setRowAttributes(totalRowsNum, defaultRowsDisplayed);

        if (logger.isDebugEnabled()) {
            logger.debug(limit.toString());
        }

        rows = TableModelUtils.getCurrentRows(this, rows);

        this.collectionOfPageBeans = rows;

        viewHandler.setView();

        return rows;
    }

    public void setColumnValues() throws Exception {
        List columns = columnHandler.getColumns();
        Iterator iter = columns.iterator();
        
    	String[] cellValues = (String[])getTable().getAttribute(ECSideConstants.TABLE_CELL_VALUES_KEY);   
//    	String[] cellNames = (String[])getTable().getAttribute(ECSideConstants.TABLE_CELLNAMES_KEY);   
    	
    	String[] editEvents = (String[])getTable().getAttribute(ECSideConstants.TABLE_EDIT_EVENTS_KEY);   
    	String[] editTemplates = (String[])getTable().getAttribute(ECSideConstants.TABLE_EDIT_TEMPLATES_KEY);
    	String[] editables=(String[])getTable().getAttribute(ECSideConstants.TABLE_EDITABLES_KEY);
    	
    	int i=0;
        while (iter.hasNext()) {
            Column column = (Column) iter.next();
            if ("true".equals(column.getAttribute(TableConstants.IS_AUTO_GENERATE_COLUMN))) {
                String property = column.getProperty();
                Object propertyValue = TableModelUtils.getColumnPropertyValue(currentRowBean, property);
                column.setValue(propertyValue);
                column.setPropertyValue(propertyValue);
                
                if (cellValues!=null && i<cellValues.length && StringUtils.isNotBlank(cellValues[i]) ){
                	column.setCellValue(cellValues[i].trim());
                }
//                if (cellNames!=null && i<cellNames.length && StringUtils.isNotBlank(cellNames[i]) ){
//                	column.setCellName(cellNames[i].trim());
//                }
                
                if (editEvents!=null && i<editEvents.length && StringUtils.isNotBlank(editEvents[i]) ){
                	column.setEditEvent(editEvents[i].trim());
                }
                if (editTemplates!=null && i<editTemplates.length && StringUtils.isNotBlank(editTemplates[i]) ){
                	column.setEditTemplate(editTemplates[i].trim());
                }
                if (editables!=null && i<editables.length && StringUtils.isNotBlank(editables[i]) ){
                	column.setEditable(Boolean.valueOf(editables[i].trim()));    
                }
                String propertyValueString=propertyValue+"";
                if (propertyValueString.length()>ECSideConstants.SHOW_TITLE_MIN_LENGTH){
                	column.setAttribute(TableConstants.EXTEND_ATTRIBUTES, " title=\""+propertyValue+"\" ");
                }
                columnHandler.modifyColumnAttributes(column);
                viewHandler.addColumnValueToView(column);
                i++;
            }
        }
    }

    public Object getViewData() throws Exception {
        Object viewData = viewHandler.getView().afterBody(this);

        if (limit.isExported()) {
            context.setRequestAttribute(TableConstants.VIEW_DATA, viewData);
            context.setRequestAttribute(TableConstants.VIEW_RESOLVER, exportHandler.getCurrentExport().getViewResolver());
            context.setRequestAttribute(TableConstants.EXPORT_FILE_NAME, exportHandler.getCurrentExport().getFileName());
            if (!exportHandler.getCurrentExport().getView().equals(TableConstants.VIEW_PRINT) ){
            	return "";
            }
        }

        return viewData;
    }

    /**
     * Will execute the model and interate over the rows. Very useful for
     * assembling a table using java code.
     */
    public Object assemble() throws Exception {
        Iterator iterator = execute().iterator();
        for (Iterator iter = iterator; iter.hasNext();) {
            Object bean = iterator.next();
            setCurrentRowBean(bean);

            // call to modify attributes
            getRowHandler().modifyRowAttributes();

            // call columns to set values
            setColumnValues();
        }

        return getViewData();
    }
    
    List propertyNameList=new ArrayList();
	public void addPropertyName(String propertyName){
		propertyNameList.add(propertyName);		
	}

	public String getPropertyName(int idx) {
		return (String)propertyNameList.get(idx);
	}

	public List getPropertyNameList() {
		return propertyNameList;
	}

	public Table getTable() {
		return this.getTableHandler().getTable();
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品影音先锋| 日韩三级伦理片妻子的秘密按摩| 久久电影国产免费久久电影| 午夜视频一区在线观看| 亚洲成人中文在线| 偷拍一区二区三区| 免费观看成人av| 美国毛片一区二区| 国产老女人精品毛片久久| 高清视频一区二区| 99国产精品久久久久久久久久久| 成人免费视频播放| 在线中文字幕一区| 欧美美女一区二区三区| 欧美一区二区国产| 国产日韩成人精品| 亚洲欧美日韩国产成人精品影院| 亚洲三级电影全部在线观看高清| 一区二区三区四区在线免费观看| 亚洲成av人片一区二区| 麻豆精品久久久| 波多野结衣欧美| 在线看日本不卡| 精品日韩99亚洲| 国产精品第13页| 日韩国产在线一| 国产精品综合一区二区| 色综合天天综合给合国产| 欧美日韩免费一区二区三区视频| 日韩精品综合一本久道在线视频| 国产女人18毛片水真多成人如厕 | 91精品国产色综合久久| 日韩亚洲欧美综合| 国产精品人成在线观看免费| 一区二区三区在线观看视频| 国产一区二区三区免费观看| 欧洲亚洲精品在线| 日本一区二区视频在线| 日韩精品一级中文字幕精品视频免费观看 | 亚洲美女区一区| 美脚の诱脚舐め脚责91| 色噜噜狠狠色综合欧洲selulu| 日韩欧美一卡二卡| 亚洲精品久久久蜜桃| 精品一二三四在线| 欧美肥妇毛茸茸| 一区精品在线播放| 韩国精品在线观看| 在线综合亚洲欧美在线视频| 亚洲天堂av一区| 国产成人午夜高潮毛片| 欧美日韩精品久久久| 亚洲乱码精品一二三四区日韩在线| 激情六月婷婷久久| 欧美一区二区三区喷汁尤物| 亚洲综合在线电影| 99久久国产免费看| 国产精品沙发午睡系列990531| 美女网站在线免费欧美精品| 欧美人与z0zoxxxx视频| 一区二区久久久| 成人黄色av网站在线| 26uuu久久综合| 日本成人在线网站| 欧美日韩国产高清一区二区三区| 亚洲黄色尤物视频| 91九色02白丝porn| 亚洲精品国产高清久久伦理二区| www.日韩在线| 国产精品人成在线观看免费 | 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 久久精品久久精品| 欧美videossexotv100| 三级久久三级久久久| 欧美高清视频一二三区| 亚洲r级在线视频| 欧美日韩一区二区三区在线| 午夜精品福利一区二区三区蜜桃| 在线观看视频一区| 樱花影视一区二区| 91高清视频免费看| 日韩高清在线电影| 91精品啪在线观看国产60岁| 日韩二区在线观看| 精品美女在线观看| 国产成人无遮挡在线视频| 国产喂奶挤奶一区二区三区| 成人一二三区视频| 最新国产精品久久精品| 欧美视频在线一区二区三区| 日本成人在线不卡视频| 国产亚洲欧美中文| 99精品视频一区二区三区| 亚洲国产欧美日韩另类综合| 亚洲国产高清aⅴ视频| 成人黄色国产精品网站大全在线免费观看 | 日韩高清欧美激情| 精品三级在线观看| 成人av在线资源网| 亚洲一区二区三区三| 欧美视频一二三区| 国产人伦精品一区二区| 69久久99精品久久久久婷婷 | 大胆欧美人体老妇| 狠狠狠色丁香婷婷综合久久五月| 无吗不卡中文字幕| 偷偷要91色婷婷| 婷婷成人激情在线网| 亚洲一区二区视频在线| 亚洲蜜臀av乱码久久精品蜜桃| 亚洲人成在线观看一区二区| 亚洲品质自拍视频| 亚洲欧美一区二区三区孕妇| 亚洲精选一二三| 一区二区日韩av| 婷婷综合在线观看| 久久精品国产99国产精品| 国精产品一区一区三区mba视频| 狠狠色丁香久久婷婷综合丁香| 麻豆极品一区二区三区| 国产乱子伦视频一区二区三区| 国产精品亚洲一区二区三区在线| 国产精品一卡二卡| av在线综合网| 欧美午夜理伦三级在线观看| 欧美人与z0zoxxxx视频| 欧美一级国产精品| 国产女主播在线一区二区| 国产精品久久久久aaaa樱花| 一区二区三区在线免费| 日本视频中文字幕一区二区三区| 麻豆国产一区二区| 成人黄页毛片网站| 欧美优质美女网站| 欧美一区二区久久| 国产精品少妇自拍| 午夜伊人狠狠久久| 麻豆freexxxx性91精品| 成人综合婷婷国产精品久久免费| 一本一道久久a久久精品| 制服丝袜亚洲精品中文字幕| 久久久久九九视频| 亚洲精品高清在线| 精品在线播放免费| 色婷婷久久99综合精品jk白丝 | 国产精品午夜在线观看| 亚洲日韩欧美一区二区在线| 日欧美一区二区| 国产精品一级片| 欧美日韩激情一区二区| 久久久久一区二区三区四区| 一二三区精品视频| 国产乱码字幕精品高清av| 在线免费观看日本欧美| 国产无一区二区| 日韩电影一二三区| av亚洲精华国产精华精华| 欧美日韩国产高清一区二区| 欧美国产精品v| 久久精品国产99国产| 色www精品视频在线观看| 久久久久久久久一| 日本va欧美va瓶| 91麻豆高清视频| 久久精品亚洲精品国产欧美kt∨ | 亚洲一区二区成人在线观看| 国产精品一区二区果冻传媒| 欧美精品精品一区| 17c精品麻豆一区二区免费| 久久超碰97中文字幕| 欧美午夜一区二区三区| 中文字幕国产一区| 久99久精品视频免费观看| 欧美日韩夫妻久久| 亚洲免费在线观看视频| 国产ts人妖一区二区| 欧美一级黄色大片| 午夜精品福利一区二区三区蜜桃| 色综合久久88色综合天天免费| 国产欧美va欧美不卡在线| 精品一区二区三区在线观看国产| 欧美精品tushy高清| 亚洲欧美日韩一区二区| 不卡一区中文字幕| 国产精品伦理在线| 国产成人av资源| 久久久精品人体av艺术| 久久成人精品无人区| 欧美一级理论片| 日韩专区在线视频| 欧美精品一二三| 午夜精品久久久久| 欧美日韩成人高清| 亚洲成av人片在线| 欧美绝品在线观看成人午夜影视| 亚洲美女视频一区| 欧美亚洲动漫另类| 日韩精品成人一区二区三区| 欧美日本高清视频在线观看| 亚洲一区二区三区中文字幕|