Search in sources :

Example 1 with NotificationBean

use of com.canoo.dp.impl.platform.projector.notifications.NotificationBean in project dolphin-platform by canoo.

the class GlobalNotificationsHandler method init.

public CompletableFuture<Void> init() {
    CompletableFuture<ControllerProxy<NotificationWrapperBean>> controllerFuture = clientContext.createController(GLOBAL_NOTIFICATIONS_CONTROLLER);
    return controllerFuture.handle((c, e) -> {
        if (e != null) {
        // TODO
        }
        NotificationWrapperBean model = c.getModel();
        model.notificationProperty().onChanged(event -> {
            NotificationBean bean = model.getNotification();
            if (bean != null) {
                showNotification(new NotificationData(bean.getTitle(), bean.getDescription(), bean.getMessageType()));
            }
        });
        NotificationBean bean = model.getNotification();
        if (bean != null) {
            showNotification(new NotificationData(bean.getTitle(), bean.getDescription(), bean.getMessageType()));
        }
        return null;
    });
}
Also used : NotificationWrapperBean(com.canoo.dp.impl.platform.projector.notifications.NotificationWrapperBean) NotificationBean(com.canoo.dp.impl.platform.projector.notifications.NotificationBean) ControllerProxy(com.canoo.platform.remoting.client.ControllerProxy) NotificationData(com.canoo.dp.impl.platform.projector.notifications.NotificationData)

Example 2 with NotificationBean

use of com.canoo.dp.impl.platform.projector.notifications.NotificationBean in project dolphin-platform by canoo.

the class GlobalNotificationsController method init.

@PostConstruct
public void init() {
    eventBus.subscribe(GLOBAL_NOTIFICATION, e -> {
        NotificationBean bean = beanManager.create(NotificationBean.class);
        bean.setTitle(e.getData().getTitle());
        bean.setDescription(e.getData().getText());
        bean.setMessageType(e.getData().getMessageType());
        model.setNotification(bean);
    });
}
Also used : NotificationBean(com.canoo.dp.impl.platform.projector.notifications.NotificationBean) PostConstruct(javax.annotation.PostConstruct)

Aggregations

NotificationBean (com.canoo.dp.impl.platform.projector.notifications.NotificationBean)2 NotificationData (com.canoo.dp.impl.platform.projector.notifications.NotificationData)1 NotificationWrapperBean (com.canoo.dp.impl.platform.projector.notifications.NotificationWrapperBean)1 ControllerProxy (com.canoo.platform.remoting.client.ControllerProxy)1 PostConstruct (javax.annotation.PostConstruct)1