01: /* CollectionItem.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Jul 31, 2007 2:51:58 PM , Created by jumperchen
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zkplus.databind;
20:
21: import org.zkoss.zk.ui.Component;
22: import org.zkoss.zul.ListModel;
23:
24: /**
25: * The <i>CollectionItem</i> is used by {@link DataBinder} and provides an
26: * interface for collection component to interact with the <i>DataBinder</i>
27: * such as <i>Grid</i> or <i>Listbox</i>.
28: *
29: * @author jumperchen
30: * @see DataBinder
31: * @since 3.0.0
32: */
33: public interface CollectionItem {
34: /**
35: * <p>
36: * Returns the component's owner.
37: * </p>
38: * For example: if this comp is a <i>Row</i> component then this method will
39: * return the associated <i>Grid</i> component of the Row.
40: *
41: * @param comp A component as <i>Row</i> or <i>Listitem</i>.
42: * @return Component the comp's owner.
43: */
44: public Component getComponentCollectionOwner(Component comp);
45:
46: /**
47: * <p>
48: * Returns the component by the index in the comp's children.
49: * </p>
50: *
51: * @param comp Collection owner component such as <i>Grid</i>.
52: * @param index index of the element to return
53: * @return Component the component at the specified position in the list of
54: * comp's children.
55: */
56: public Component getComponentAtIndexByOwner(Component comp,
57: int index);
58:
59: /**
60: * <p>
61: * Returns the component model as {@link ListModel}
62: * </p>
63: *
64: * @param comp Collection owner component such as <i>Grid</i>.
65: * @return ListModel
66: */
67: public ListModel getModelByOwner(Component comp);
68:
69: /**
70: * <p>
71: * Sets the binding renderer for the template component such as <i>Listitem</i>
72: * or <i>Row</i>.
73: * </p>
74: *
75: * @param comp A component such as <i>Row</i> or <i>Listitem</i>.
76: * @param binder The associated DataBinder
77: */
78: public void setupBindingRenderer(Component comp, DataBinder binder);
79: }
|