Example usage for com.vaadin.ui Notification setHtmlContentAllowed

List of usage examples for com.vaadin.ui Notification setHtmlContentAllowed

Introduction

In this page you can find the example usage for com.vaadin.ui Notification setHtmlContentAllowed.

Prototype

public void setHtmlContentAllowed(boolean htmlContentAllowed) 

Source Link

Document

Sets whether html is allowed in the caption and description.

Usage

From source file:annis.gui.components.HelpButton.java

License:Apache License

@Override
public void buttonClick(ClickEvent event) {
    String caption = "Help";
    if (getCaption() != null && !getCaption().isEmpty()) {
        caption = "Help for \"" + getCaption();
    }/*  w  ww .j  av  a2s .co  m*/
    caption = caption + "<br/><br/>(Click here to close)";
    Notification notify = new Notification(caption, Notification.Type.HUMANIZED_MESSAGE);
    notify.setHtmlContentAllowed(true);
    notify.setDescription(field.getDescription());
    notify.setDelayMsec(-1);
    notify.show(UI.getCurrent().getPage());
}

From source file:by.bigvova.ui.LoginUI.java

License:Apache License

private void notification() {
    Notification notification = new Notification("Welcome to Dashboard Demo");
    notification.setDescription(// www . j  av  a2  s .  c o  m
            "<span>This application is not real, it only demonstrates an application built with the <a href=\"https://vaadin.com\">Vaadin framework</a>.</span> <span>No username or password is required, just click the <b>Sign In</b> button to continue.</span>");
    notification.setHtmlContentAllowed(true);
    notification.setStyleName("tray dark small closable login-help");
    notification.setPosition(Position.BOTTOM_CENTER);
    notification.setDelayMsec(20000);
    notification.show(Page.getCurrent());
}

From source file:com.esofthead.mycollab.vaadin.ui.NotificationUtil.java

License:Open Source License

public static void showNotification(String caption, String description, Type type) {
    Notification warnNotif = new Notification(caption, description, type);
    warnNotif.setHtmlContentAllowed(true);
    warnNotif.setDelayMsec(3000);/*from w w  w  . j  a va 2s . com*/

    if (Page.getCurrent() != null) {
        warnNotif.show(Page.getCurrent());
    } else {
        LOG.error("Current page is null");
    }

}

From source file:com.esofthead.mycollab.vaadin.web.ui.NotificationComponent.java

License:Open Source License

private void displayTrayNotification(AbstractNotification item) {
    if (item instanceof NewUpdateAvailableNotification) {
        NewUpdateAvailableNotification updateNo = (NewUpdateAvailableNotification) item;
        Notification no;
        if (AppContext.isAdmin()) {
            no = new Notification(AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE),
                    AppContext.getMessage(
                            ShellI18nEnum.OPT_HAVING_NEW_VERSION,
                            ((NewUpdateAvailableNotification) item).getVersion())
                            + " "
                            + new A("javascript:com.mycollab.scripts.upgrade('" + updateNo.getVersion() + "','"
                                    + updateNo.getAutoDownloadLink() + "','" + updateNo.getManualDownloadLink()
                                    + "')").appendText(AppContext.getMessage(ShellI18nEnum.ACTION_UPGRADE)),
                    Notification.Type.TRAY_NOTIFICATION);
        } else {/*from   w w  w. j  a  v a  2s  . c  o m*/
            no = new Notification(AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE),
                    AppContext.getMessage(ShellI18nEnum.OPT_HAVING_NEW_VERSION,
                            ((NewUpdateAvailableNotification) item).getVersion()),
                    Notification.Type.TRAY_NOTIFICATION);
        }

        no.setHtmlContentAllowed(true);
        no.setDelayMsec(300000);

        UI currentUI = UI.getCurrent();
        if (currentUI != null) {
            if (SiteConfiguration.getPullMethod() == SiteConfiguration.PullMethod.push) {
                no.show(currentUI.getPage());
                currentUI.push();
            } else {
                try {
                    UI.getCurrent().setPollInterval(1000);
                    no.show(currentUI.getPage());
                } finally {
                    UI.getCurrent().setPollInterval(-1);
                }
            }
        }
    }
}

From source file:com.haulmont.cuba.web.WebWindowManager.java

License:Apache License

@Override
public void showNotification(String caption, String description, NotificationType type) {
    backgroundWorker.checkUIAccess();/*from   w  w w  .j  a  va  2 s . c  om*/

    Notification notification = new Notification(caption, description, convertNotificationType(type));
    notification.setHtmlContentAllowed(NotificationType.isHTML(type));
    setNotificationDelayMsec(notification, type);
    notification.show(Page.getCurrent());
}

From source file:com.mycollab.vaadin.ui.NotificationUtil.java

License:Open Source License

public static void showNotification(String caption, String description, Type type) {
    Notification notification = new Notification(caption, description, type);
    notification.setHtmlContentAllowed(true);
    notification.setDelayMsec(3000);//w w  w .  j  a  va  2 s .  com

    if (Page.getCurrent() != null) {
        notification.show(Page.getCurrent());
    } else {
        LOG.error("Current page is null");
    }

}

From source file:com.mycollab.vaadin.web.ui.NotificationComponent.java

License:Open Source License

private void displayTrayNotification(AbstractNotification item) {
    if (item instanceof NewUpdateAvailableNotification) {
        NewUpdateAvailableNotification updateNo = (NewUpdateAvailableNotification) item;
        Notification no;
        if (UserUIContext.isAdmin()) {
            no = new Notification(UserUIContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE),
                    UserUIContext.getMessage(ShellI18nEnum.OPT_HAVING_NEW_VERSION,
                            ((NewUpdateAvailableNotification) item).getVersion())
                            + " "
                            + new A("javascript:com.mycollab.scripts.upgrade('" + updateNo.getVersion() + "','"
                                    + updateNo.getAutoDownloadLink() + "','" + updateNo.getManualDownloadLink()
                                    + "')").appendText(UserUIContext.getMessage(ShellI18nEnum.ACTION_UPGRADE)),
                    Notification.Type.TRAY_NOTIFICATION);
        } else {/*from  w w w. j a v a  2s.  c  o m*/
            no = new Notification(UserUIContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE),
                    UserUIContext.getMessage(ShellI18nEnum.OPT_HAVING_NEW_VERSION,
                            ((NewUpdateAvailableNotification) item).getVersion()),
                    Notification.Type.TRAY_NOTIFICATION);
        }

        no.setHtmlContentAllowed(true);
        no.setDelayMsec(300000);

        UI currentUI = this.getUI();
        AsyncInvoker.access(getUI(), new AsyncInvoker.PageCommand() {
            @Override
            public void run() {
                no.show(currentUI.getPage());
            }
        });
    }
}

From source file:com.toptal.ui.view.LoginView.java

License:Open Source License

/**
 * Error notification.//from   w ww  .  j  av  a  2s  .  co m
 * @param message Message.
 */
private void error(final String message) {
    final int delay = 5000;
    final Notification notification = new Notification(message, Notification.Type.WARNING_MESSAGE);
    notification.setHtmlContentAllowed(true);
    notification.setStyleName("closable");
    notification.setPosition(Position.BOTTOM_CENTER);
    notification.setIcon(FontAwesome.WARNING);
    notification.setDelayMsec(delay);
    notification.show(Page.getCurrent());
}

From source file:com.vaadHL.utl.msgs.Msgs.java

License:Apache License

public void showInfo(String caption, int delay) {
    Notification not = new Notification(caption);
    not.setDelayMsec(delay);/*from w  ww .j  a v  a2 s.  c o m*/
    not.setHtmlContentAllowed(true);
    not.show(Page.getCurrent());
}

From source file:com.vaadHL.utl.msgs.Msgs.java

License:Apache License

public void showWarning(String caption, int delay) {
    Notification not = new Notification(caption, Notification.Type.WARNING_MESSAGE);
    not.setDelayMsec(delay);//from w  ww.  jav  a  2 s  .c om
    not.setHtmlContentAllowed(true);
    not.setCaption(caption);
    not.show(Page.getCurrent());
}