Package org.zkoss.zk.ui.util
Interface ComponentCloneListener
-
- All Known Subinterfaces:
CloneableEventListener<T>
,PagingListener
- All Known Implementing Classes:
GenericAutowireComposer
,GenericForwardComposer
,GroupsModelArray
,SelectorComposer
,SimpleGroupsModel
public interface ComponentCloneListener
Used to notify an object stored in a component, when the component is cloned.When a component is cloned, it checks every attribute (
Component.setAttribute(java.lang.String, java.lang.Object, int)
) and listener (Component.addEventListener(int, java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>)
) to see whether this interface is implemented. If implemented,willClone(org.zkoss.zk.ui.Component)
will be called. Then, the object can either return itself, if it can be shared by two components, or clone itself, if an independent instance must be used for each component.- Since:
- 2.4.0
- Author:
- tomyeh
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
willClone(Component comp)
Called when a component is going to be cloned.
-
-
-
Method Detail
-
willClone
java.lang.Object willClone(Component comp)
Called when a component is going to be cloned. If the object is OK to be shared by the cloned and original components, it can return itself. If an independent instance must be created for the cloned component, it can clone itself and return the cloned object.- Parameters:
comp
- the cloned component (not the original one)- Returns:
- the object to be used in the cloned component. If this object is returned, the same object is shared by the cloned and original components. If other object is returned, it is used by the cloned component. If null is returned, it is not used by the cloned component at all.
- Since:
- 5.0.0
-
-