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

📄 rowcollectionitem.java

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JAVA
字号:
/* RowCollectionItem.java

 {{IS_NOTE
 Purpose:
 
 Description:
 
 History:
 Jul 31, 2007 3:24:34 PM , Created by jumperchen
 }}IS_NOTE

 Copyright (C) 2007 Potix Corporation. All Rights Reserved.

 {{IS_RIGHT
 This program is distributed under GPL Version 2.0 in the hope that
 it will be useful, but WITHOUT ANY WARRANTY.
 }}IS_RIGHT
 */
package org.zkoss.zkplus.databind;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.UiException;
import org.zkoss.zul.Grid;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.Row;

/* package */class RowCollectionItem implements CollectionItem {

	public Component getComponentAtIndexByOwner(Component comp, int index) {
		if (comp instanceof Grid) {
			final Grid grid = (Grid) comp;
			return (Component) grid.getRows().getChildren().get(index);
		} else {
			throw new UiException("Unsupported type for RowCollectionItem: "
					+ comp);
		}
	}

	public Component getComponentCollectionOwner(Component comp) {
		if (comp instanceof Row) {
			final Row row = (Row) comp;
			return row.getGrid();
		} else {
			throw new UiException("Unsupported type for RowCollectionItem: "
					+ comp);
		}
	}

	public ListModel getModelByOwner(Component comp) {
		if (comp instanceof Grid) {
			final Grid grid = (Grid) comp;
			return grid.getModel();
		} else {
			throw new UiException("Unsupported type for RowCollectionItem: "
					+ comp);
		}
	}

	public void setupBindingRenderer(Component comp, DataBinder binder) {
		if (comp instanceof Row) {
			final Row row = (Row) comp;
			final Grid grid = row.getGrid();
			if (grid.getRowRenderer() == null) {
				grid.setRowRenderer(new BindingRowRenderer(row, binder));
			}
		}
	}
}

⌨️ 快捷键说明

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