@IviExperimental(reasons = [])
class PanelContainerControllerHolder<C : PanelContainerController<*, CD?, VM, SD>, CD, VM : PanelSubContainerViewModel<SD>, SD>(findContainerViewDataBinding: () -> ViewDataBinding?, createPanelContainerController: (PanelContainerContext) -> C?)

A convenience class for common PanelContainer logic to do with creating a PanelContainerController and re-creating it when its dependencies change.

PanelContainer should use panelContainerContext as delegate for PanelContainer.ttiviPanelContainerContext. Dependencies must be set using a delegate returned by rebuildOnChange.



Returns the ViewDataBinding containing the PanelContainer, if any. It is used to optimise the initialization of the PanelContainerController. This function is only called when panelContainerContext is set for the first time.

If findContainerViewDataBinding returns a valid ViewDataBinding then the holder listens for binding updates and invokes createPanelContainerController on update completing. That guarantees that a controller is created once when all property updates are completed.

If findContainerViewDataBinding returns a null then createPanelContainerController is called on every change of observed properties including panelContainerContext.


Called when the holder has sufficient information for creating a PanelContainerController. The returned controller will be bound to the system UI and unbound when the controller is cleared or replaced. The function may return null when it is not ready to create a controller. In these cases it's common for the information that the controller creation depends on to be set using a delegate returned by rebuildOnChange such that controller creation is automatically re-attempted when then information becomes available.


The type of the panel container data. The panel container data is the input data that is visualized by the panel container.


The panel sub-container view model type.


The type of the panel sub-container data.


Link copied to clipboard
constructor(findContainerViewDataBinding: () -> ViewDataBinding?, createPanelContainerController: (PanelContainerContext) -> C?)


Link copied to clipboard

The context used to create and bind the controller. A controller cannot be created without a context and setting this to null will destroy any previously created controller. Changing the context will cause the controller to be replaced as well.

Link copied to clipboard

The panel sub-container view models.


Link copied to clipboard

Creates a delegate that recreates the controller when the value delegate's value changes. This is intended to be used for information that the controller depends on and cannot be changed within the controller itself.