How to create a mandatory start screen in Cuba ?
i.e. The screen will be having some input fields and it should not show any menu items at the start ,
once the user enters values after validation it should show other screens in menu.
1 Like
Hello @Vignesh_Iyer
You should create an extension of com.haulmont.cuba.web.DefaultApp
class and replace default implementation in the web-spring.xml
file:
<bean name="cuba_App" class="com.company.sample.web.MyApp" scope="vaadin"/>
Then override String routeTopLevelWindowId()
method to return your mandatory screen id. And just show default main screen when user passes validation:
// in App extension
removeAllWindows();
AppUI ui = AppUI.getCurrent();
Screens screens = ui.getScreens();
Screen screen = screens.create("mainWindow", OpenMode.ROOT);
screens.show(screen);
Regards,
Daniil
Hi Daniil Tsaryov,
I am working on 6.10 version and not able to access the removeallWindows() method
Okay, for 6.10 version an implementation will be the following:
// in mandatory screen
@Inject
protected TextField secret;
@Inject
protected WindowConfig windowConfig;
public void checkInput() {
if (!"top secret".equals(secret.getValue())) {
showNotification("Wrong", NotificationType.WARNING);
return;
}
App.getInstance().closeAllWindows();
((WebWindowManager) getWindowManager())
.createTopLevelWindow(windowConfig.getWindowInfo("mainWindow"));
}
Please check demo project:
mandatory-screen.zip (70.1 KB)
Regards,
Daniil