MutablePanelContextFactory
A PanelContextFactory that allows the C to be configured with configurePanelContext before createInner is called.
A MutablePanelContextFactory implementation that builds a more specialized type of CommonPanelContext can obtain mutablePanelContext with getMutablePanelContext to implement a more specialized type of M through delegation. The following example shows how to implement a CustomPanelContextFactory
:
class CustomPanelContext(
commonPanelContext: CommonPanelContext,
) : CommonPanelContext by commonPanelContext
interface MutableCustomPanelContext : MutableCommonPanelContext
class CustomPanelContextFactory(
private val commonPanelContextFactory: CommonPanelContextFactory,
) : MutablePanelContextFactory<CustomPanelContext, MutableCustomPanelContext>() {
override val mutablePanelContext: MutableCustomPanelContext =
DefaultMutableCustomPanelContext(
getMutablePanelContext(commonPanelContextFactory)
)
public override fun createInner(): CustomPanelContext =
CustomPanelContext(
basePanelContext = create(commonPanelContextFactory)
)
}
private class DefaultMutableCustomPanelContext(
mutableCommonPanelContext: MutableCommonPanelContext,
) : MutableCustomPanelContext,
MutableCommonPanelContext by mutableCommonPanelContext
The CommonPanelContextFactory instance in the above example can be obtained with PanelContextFactoryProvider.createCommonPanelContextFactory.
To extend another panel context type, replace CommonPanelContext
in the above example with the name of the panel context type that is to be extended.
Parameters
The PanelContext type created by this factory.
Mutable variant of C. This type has mutable properties that allow the to be create C instance to be configured with configurePanelContext before createInner is called. Typically, this type has a subset of the properties of C. Only properties that are intended to be modified by panel containers are included.