Hi, I made this composite component in jmix 1.6:
JMix 1.6 ->
class MasterDataField :
CompositeComponent<CssLayout>(),
Field<BaseMasterData>,
CompositeWithCaption,
CompositeWithHtmlCaption,
CompositeWithHtmlDescription,
CompositeWithIcon,
CompositeWithContextHelp,
Focusable, Logging {
It is designed to display either a EntityComboBox or a RadioButtonGroup depending on various parameters. Only one of the two is visible at any given time. This MasterDataField
is used hundreds of times throughout my app.
I’m migrating my app to JMix 2 and MasterDataField became:
JMix 2.5 ->
class MasterDataField : Composite<VerticalLayout>(),
SupportsValidation<BaseMasterData>,
SupportsStatusChangeHandler<AbstractSinglePropertyField<*, BaseMasterData>>,
ComponentValueChangeEvent<AbstractSinglePropertyField<*, BaseMasterData>, BaseMasterData>, BaseMasterData, BaseMasterData>,
SupportsValueSource<BaseMasterData>,
HasRequired,
HasTitle,
HasLabel,
Logging {
{
the problem is that the ComponentValueChangeEvent is not triggred on MasterDataField
It worked in 1.6. How should I migrated this class in your opinion ?
thoughts:
I understand that the ComponentValueChangeEvent is in AbstractField so my composite should implement Composite<AbstractSinglePropertyField<*, *>>
but I can’t do that because it should contains 2 fields.
I can’t decide what type the main field is in the initContent, it can only be done in the onAttach (because I need ValueSource to decide and it is initialized after initContent if I’m not mistaken).
Maybe I can create a class SmartLayout: JmixLayout, AbstractSinglePropertyField<*, *>
that push listeners to all children. then have Composite<SmartLayout>
(too complicated )