org.zkoss.zkplus.databind.BindingRowRenderer Maven / Gradle / Ivy
/* BindingRowRenderer.java
{{IS_NOTE
Purpose:
Description:
History:
Mon Mar 19 11:10:12 2007, Created by Henri
}}IS_NOTE
Copyright (C) 2007 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
}}IS_RIGHT
*/
package org.zkoss.zkplus.databind;
import static org.zkoss.lang.Generics.cast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Row;
/**
* @deprecated As of release 7.0.0, replace with new ZK binding.
*/
/*package*/ class BindingRowRenderer implements org.zkoss.zul.RowRenderer, org.zkoss.zul.RowRendererExt, Serializable {
private static final long serialVersionUID = 200808191425L;
private static final String KIDS = "zkplus.databind.KIDS";
private Row _template;
private DataBinder _binder;
private int x = 0;
public BindingRowRenderer(Row template, DataBinder binder) {
_template = template;
_binder = binder;
}
//-- RowRendererExt --//
public Row newRow(Grid grid) {
//clone from template
final Row clone = (Row) _template.clone();
//avoid duplicate id error, will set to new id when render()
//Bug #1962153: Data binding generates duplicate id in some case (add "_")
if (clone.getId().length() > 0) {
clone.setId(null);
}
//link cloned component with template
//each Row and its descendants share the same templatemap
Map