Search in sources :

Example 1 with DashboardUpdatedEvent

use of io.jmix.dashboardsui.event.DashboardUpdatedEvent in project jmix by jmix-framework.

the class DashboardImpl method initTimer.

private void initTimer(Component frame) {
    Window parentWindow = findWindow(frame);
    int timerDelay = getTimerDelay() == 0 ? dashboardModel.getTimerDelay() : getTimerDelay();
    if (timerDelay > 0 && parentWindow != null) {
        Timer dashboardUpdatedTimer = facets.create(Timer.class);
        dashboardUpdatedTimer.setOwner(getFrame());
        dashboardUpdatedTimer.setDelay(timerDelay * 1000);
        dashboardUpdatedTimer.setRepeating(true);
        dashboardUpdatedTimer.addTimerActionListener(timer -> uiEventPublisher.publishEvent(new DashboardUpdatedEvent(dashboardModel)));
        dashboardUpdatedTimer.start();
    }
}
Also used : Timer(io.jmix.ui.component.Timer) DashboardUpdatedEvent(io.jmix.dashboardsui.event.DashboardUpdatedEvent)

Example 2 with DashboardUpdatedEvent

use of io.jmix.dashboardsui.event.DashboardUpdatedEvent in project jmix by jmix-framework.

the class PersistentDashboardEdit method onPropagateBtnClick.

@Subscribe("propagateBtn")
public void onPropagateBtnClick(Button.ClickEvent event) {
    DashboardModel dashboard = getDashboardModel();
    uiEventPublisher.publishEvent(new DashboardUpdatedEvent(dashboard));
}
Also used : DashboardUpdatedEvent(io.jmix.dashboardsui.event.DashboardUpdatedEvent) DashboardModel(io.jmix.dashboards.model.DashboardModel)

Aggregations

DashboardUpdatedEvent (io.jmix.dashboardsui.event.DashboardUpdatedEvent)2 DashboardModel (io.jmix.dashboards.model.DashboardModel)1 Timer (io.jmix.ui.component.Timer)1