Customize displayed field

I have an application with some customers.
The datamodel is very rich to cover all customers cases but some customer don’t need all fields.
In a table view, it is possible to hide some columns, it is a good start, but how to do for others views.

I would like that a customer can choose to hide some fields of any entity,
A screen with all Entities / Fields and the user can choose to hide some of them.

How can I intercept all UI elements with a property to a field before showing, and check the visibiliy from my conf and hide it if asked ?
I know that I can set the visible property for each of the UI elements for each views,
but it’s a huge code modification and I can miss some screen now or in the future…
(and I don’t want to do this work twice, classic ui then flowui after all components I need will be ready)

Bonus: right now, it’s only hide/visible, but why not also set a custom caption or set the field as mandatory…

Hello!

I think the only place where you can check components with the your custom visibility config is the InitEvent of the screen.

In this event, components are already loaded and DataContainer is set. So you can create some Spring Bean that will check all components from the screen with your config. For instance:

@Subscribe
public void onInit(InitEvent event) {
    fieldVisibilityManager.manageFields(getWindow().getComponents());
}

where fieldVisibilityManager is a custom bean that checks all nested components that they are bound with “hidden” properties.