org.zkoss.zkplus.databind.BindingListitemRenderer Maven / Gradle / Ivy
/* BindingListitemRenderer.java
{{IS_NOTE
Purpose:
Description:
History:
Sat Feb 3 14:18:27 2007, Created by Henri
}}IS_NOTE
Copyright (C) 2007 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
}}IS_RIGHT
*/
package org.zkoss.zkplus.databind;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.zkoss.lang.Generics.cast;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
/**
* @deprecated As of release 7.0.0, replace with new ZK binding.
*/
/*package*/ class BindingListitemRenderer
implements org.zkoss.zul.ListitemRenderer, org.zkoss.zul.ListitemRendererExt, Serializable {
private static final long serialVersionUID = 200808191417L;
private static final String KIDS = "zkplus.databind.KIDS";
private Listitem _template;
private DataBinder _binder;
private int x = 0;
public BindingListitemRenderer(Listitem template, DataBinder binder) {
_template = template;
_binder = binder;
}
//-- ListitemRendererExt --//
public Listitem newListitem(Listbox listbox) {
//clone from template
final Listitem clone = (Listitem)_template.clone();
//TODO: see if databinder has this kind of Listitem, if not, add new CollectionListItem
//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 Listitem and and it decendants share the same templatemap
Map