Hi i want to check if the user has a specific role I want to change the loaded screen.
this works if I have the open mode to dialog but if I change it to root I get please contact administrator and no error in the catalina out. How can I achieve this? Thank you!!
@Subscribe
public void onMainScreenInit(InitEvent event) {
logoImage.setSource(RelativePathResource.class)
.setPath(“VAADIN/brand-login-screen/logo-pvs-Main.png”);
if (userService.isEmpresa()) {
Empresa empresa = empresaService.getByCurUser();
if (!empresa.getCalificada()) {
// WANT TO CHANGE THE SCREEN IN THE WORK AREA TO THIS DEPENDING ON THE USER ROLE
screenBuilders.editor(Empresa.class, this).withOpenMode(OpenMode.ROOT).editEntity(empresa).build().show();
}
}
}
Why are you using OpenMode.ROOT? It’s only for the main and login windows. Use THIS_TAB or NEW_TAB, and the screen will open in the work area of the main window:
@UiController("extMainScreen")
@UiDescriptor("ext-main-screen.xml")
public class ExtMainScreen extends MainScreen {
@Inject
private ScreenBuilders screenBuilders;
@Subscribe
public void onAfterShow(AfterShowEvent event) {
screenBuilders.screen(this)
.withScreenClass(FooScreen.class)
.withOpenMode(OpenMode.THIS_TAB)
.build()
.show();
}
}