Open a specific edit screen

Hi, I’m using an entity to define the CRUD for many entities. For example: the entity Person, is used to register clients, sellers, managers, all in the same system. I also changed the editor screen for each one, because some fields are necessary only in some cases. In order to do this, I’m creating different screens for each kind of person. So, of course, the screens have different names. I wanna know how to use a code like this:

@Inject
private ScreenBuilders screenBuilders;

private void editSelectedEntity(Customer entity) {
screenBuilders.editor(Customer.class, this)
.editEntity(entity)
.build()
.show();
}

But specifying the screen that I wanna open in each case. How do I do that?

Hi Carolina,

this situation is quite common to have different entity types. We have covered that in the entity inheritance guide. You can take a look at it here: https://www.cuba-platform.com/guides/data-modelling-entity-inheritance

In the UI it looks like this:
adjustments-cuba-petclinic-overview

How to develop the corresponding UI is covered in this subsection: https://www.cuba-platform.com/guides/data-modelling-entity-inheritance#ui_for_creating_pets

Cheers
Mario

2 Likes