On the readme for the user inbox add-on, the example code for installing it onto a standard main screen are:
import de.diedavids.cuba.userinbox.web.screens.UserInboxMessageMenuBadge;
public class CustomApplicationMainScreen extends MainScreen {
@Inject
protected SideMenu sideMenu;
@Inject
protected Timer updateCountersTimer;
@Inject
protected UserInboxMessageMenuBadge userInboxMessageMenuBadge;
@Subscribe
protected void onInit(InitEvent event) {
userInboxMessageMenuBadge.initMessagesMenuItem(
sideMenu,
updateCountersTimer,
this
);
}
@Subscribe
protected void onAfterShow(AfterShowEvent event) {
userInboxMessageMenuBadge.updateMessageCounter(sideMenu);
}
@Subscribe("updateCountersTimer")
protected void onUpdateCountersTimerTimerAction(Timer.TimerActionEvent event) {
userInboxMessageMenuBadge.updateMessageCounter(sideMenu);
}
}
But it seems the Timer is never instantiated, because running the app then gives you:
DevelopmentException: Unable to find an instance of type 'interface com.haulmont.cuba.gui.components.Timer' named 'updateCountersTimer' for instance of 'com.medflex.medflexj.web.screens.ExtMainScreen'
There’s no Timer to inject, so I think what’s needed is instantiating one. I’m going to look into the source of the demo project to figure it out - but I think the readme needs updated.