standardgridbean.java

来自「OperaMasks是一种基于J2EE的Web开发技术」· Java 代码 · 共 65 行

JAVA
65
字号
/*
 * $Id: StandardGridBean.java,v 1.3 2008/07/28 02:44:27 libin Exp $
 *
 * Copyright (C) 2006 Operamasks Community.
 * Copyright (C) 2000-2006 Apusic Systems, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses.
 */
package demo.grid.dynamic;

import org.operamasks.faces.annotation.BeforeRender;
import org.operamasks.faces.annotation.Bind;
import org.operamasks.faces.annotation.ManagedBean;
import org.operamasks.faces.annotation.ManagedBeanScope;
import org.operamasks.faces.annotation.ManagedProperty;
import org.operamasks.faces.annotation.SaveState;
import org.operamasks.faces.component.grid.CheckboxSelectionModel;
import org.operamasks.faces.component.grid.GridColumn;
import org.operamasks.faces.component.grid.GridColumnModel;
import org.operamasks.faces.component.grid.GridHeaderModel;
import org.operamasks.faces.component.grid.GridSelectionModel;
import org.operamasks.faces.component.grid.provider.GridRowDataProvider;
import org.operamasks.faces.component.grid.provider.GridViewProvider;

import demo.StockBean.Quote;
import demo.grid.GridBeanHelper;

@ManagedBean(scope = ManagedBeanScope.REQUEST)
@SuppressWarnings( { "unused", "serial" })
public class StandardGridBean {
	@Bind(id = "grid", attribute = "value")
	@SaveState
	private Quote[] data = GridBeanHelper.stockData;

	@Bind(id = "grid", attribute = "viewProvider")
	private GridViewProvider provider = new GridViewProvider() {
		public GridColumnModel getColumnModel(Object input) {
			return GridBeanHelper.createStockColumnModel();
		}

		public GridHeaderModel getHeaderModel(Object input) {
			return GridBeanHelper.createStandardStockHeader();
		}

		public GridSelectionModel getSelectionModel(Object input) {
			return new CheckboxSelectionModel();
		}
	};

	@Bind(id = "grid", attribute = "rowDataProvider")
	private GridRowDataProvider rowProvider = GridBeanHelper
			.getStockRowProvider();
}

⌨️ 快捷键说明

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