Search in sources :

Example 1 with DisplayMode

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);
}
Also used : DisplayMode(org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode) Status(org.eclipse.che.ide.api.notification.StatusNotification.Status) Widget(com.google.gwt.user.client.ui.Widget) Label(com.google.gwt.user.client.ui.Label)

Aggregations

Label (com.google.gwt.user.client.ui.Label)1 Widget (com.google.gwt.user.client.ui.Widget)1 DisplayMode (org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode)1 Status (org.eclipse.che.ide.api.notification.StatusNotification.Status)1