use of org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode in project che by eclipse.
the class NotificationPopup method update.
/**
* Update notification's widget values.
* <p/>
* Widget consumes:
* <ul>
* <li>{@link Notification#title}</li>
* <li>{@link Notification#content}</li>
* <li>Icon and background color based on {@link Status}</li>
* </ul>
*/
private void update() {
Widget titleWidget = titlePanel.getWidget();
if (titleWidget != null && titleWidget instanceof Label) {
((Label) titleWidget).setText(notification.getTitle());
titleWidget.setTitle(notification.getTitle());
}
Widget messageWidget = messagePanel.getWidget();
if (messageWidget != null && messageWidget instanceof Label) {
((Label) messageWidget).setText(notification.getContent());
}
iconPanel.setWidget(getIconBaseOnStatus());
removeStyleName(resources.notificationCss().notificationStatusProgress());
removeStyleName(resources.notificationCss().notificationStatusSuccess());
removeStyleName(resources.notificationCss().notificationStatusFail());
removeStyleName(resources.notificationCss().notificationStatusWarning());
DisplayMode displayMode = notification.getDisplayMode();
Status status = notification.getStatus();
switch(status) {
case PROGRESS:
setStyleName(resources.notificationCss().notificationStatusProgress(), true);
break;
case SUCCESS:
setStyleName(resources.notificationCss().notificationStatusSuccess(), true);
break;
case FAIL:
setStyleName(resources.notificationCss().notificationStatusFail(), true);
break;
case WARNING:
setStyleName(resources.notificationCss().notificationStatusWarning(), true);
break;
}
if (FLOAT_MODE == displayMode && PROGRESS == status) {
hideTimer.cancel();
return;
}
hideTimer.schedule(DEFAULT_TIME);
}
Aggregations