Example usage for com.vaadin.server FontAwesome EXCLAMATION_TRIANGLE

List of usage examples for com.vaadin.server FontAwesome EXCLAMATION_TRIANGLE

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome EXCLAMATION_TRIANGLE.

Prototype

FontAwesome EXCLAMATION_TRIANGLE

To view the source code for com.vaadin.server FontAwesome EXCLAMATION_TRIANGLE.

Click Source Link

Usage

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

License:Open Source License

private Component buildComponentFromNotification(AbstractNotification item) {
    final MHorizontalLayout wrapper = new MHorizontalLayout();
    wrapper.setData(item);//from   ww  w  .jav  a 2 s .co m
    wrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    if (item instanceof NewUpdateAvailableNotification) {
        final NewUpdateAvailableNotification notification = (NewUpdateAvailableNotification) item;
        Span spanEl = new Span();
        spanEl.appendText(
                AppContext.getMessage(ShellI18nEnum.OPT_HAVING_NEW_VERSION, notification.getVersion()));
        Label lbl = new Label(FontAwesome.INFO_CIRCLE.getHtml() + " " + spanEl.write(), ContentMode.HTML);
        lbl.setWidth("100%");
        CssLayout lblWrapper = new CssLayout();
        lblWrapper.addComponent(lbl);
        wrapper.addComponent(lblWrapper);
        wrapper.expand(lblWrapper);
        if (AppContext.isAdmin()) {
            Button upgradeBtn = new Button(AppContext.getMessage(ShellI18nEnum.ACTION_UPGRADE),
                    new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            UI.getCurrent().addWindow(new UpgradeConfirmWindow(notification.getVersion(),
                                    notification.getManualDownloadLink(), notification.getInstallerFile()));
                            NotificationComponent.this.setPopupVisible(false);
                        }
                    });
            upgradeBtn.addStyleName(UIConstants.BUTTON_BLOCK);
            wrapper.addComponent(upgradeBtn);
        }
    } else if (item instanceof RequestUploadAvatarNotification) {
        wrapper.addComponent(new Label(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " "
                + AppContext.getMessage(ShellI18nEnum.OPT_REQUEST_UPLOAD_AVATAR), ContentMode.HTML));
        Button uploadAvatarBtn = new Button(AppContext.getMessage(ShellI18nEnum.ACTION_UPLOAD_AVATAR),
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" }));
                        NotificationComponent.this.setPopupVisible(false);
                    }
                });
        uploadAvatarBtn.setStyleName(UIConstants.BUTTON_BLOCK);
        wrapper.add(uploadAvatarBtn);
    } else if (item instanceof SmtpSetupNotification) {
        Button smtpBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_SETUP),
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent clickEvent) {
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" }));
                        NotificationComponent.this.setPopupVisible(false);
                    }
                });
        smtpBtn.setStyleName(UIConstants.BUTTON_BLOCK);
        Label lbl = new Label(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " "
                + AppContext.getMessage(ShellI18nEnum.ERROR_NO_SMTP_SETTING), ContentMode.HTML);
        MCssLayout lblWrapper = new MCssLayout(lbl);
        wrapper.with(lblWrapper, smtpBtn).expand(lblWrapper);
    } else {
        LOG.error("Do not render notification " + item);
    }
    return wrapper;
}

From source file:com.foc.vaadin.FocWebVaadinWindow.java

License:Apache License

public void addUnitTestingButtonIfAllowed() {
    // Auto-Testing Header Icon
    if (ConfigInfo.isUnitAllowed()) {
        NativeButton autoTestingIcon = newButtonInHeaderBar("", true);
        menuBarIcons_Add("_UNIT_", autoTestingIcon);
        autoTestingIcon.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
        autoTestingIcon.addClickListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                try {
                    executeAutomatedTesting();
                } catch (Exception e) {
                    Globals.logException(e);
                }/*  w  w  w . j  av  a2s . co  m*/
            }
        });
    }
}

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

License:Open Source License

private Component buildComponentFromNotification(AbstractNotification item) {
    final MHorizontalLayout wrapper = new MHorizontalLayout();
    wrapper.setData(item);/*from  ww w  . ja v a 2 s  .  co m*/
    wrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    if (item instanceof NewUpdateAvailableNotification) {
        final NewUpdateAvailableNotification notification = (NewUpdateAvailableNotification) item;
        Span spanEl = new Span();
        spanEl.appendText(
                UserUIContext.getMessage(ShellI18nEnum.OPT_HAVING_NEW_VERSION, notification.getVersion()));
        ELabel lbl = ELabel.html(FontAwesome.INFO_CIRCLE.getHtml() + " " + spanEl.write()).withFullWidth();
        CssLayout lblWrapper = new CssLayout();
        lblWrapper.addComponent(lbl);
        wrapper.addComponent(lblWrapper);
        wrapper.expand(lblWrapper);
        if (UserUIContext.isAdmin()) {
            MButton upgradeBtn = new MButton(UserUIContext.getMessage(ShellI18nEnum.ACTION_UPGRADE),
                    clickEvent -> {
                        UI.getCurrent().addWindow(new UpgradeConfirmWindow(notification.getVersion(),
                                notification.getManualDownloadLink(), notification.getInstallerFile()));
                        NotificationComponent.this.setPopupVisible(false);
                    }).withStyleName(UIConstants.BLOCK);
            wrapper.addComponent(upgradeBtn);
        }
    } else if (item instanceof RequestUploadAvatarNotification) {
        wrapper.addComponent(new Label(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " "
                + UserUIContext.getMessage(ShellI18nEnum.OPT_REQUEST_UPLOAD_AVATAR), ContentMode.HTML));
        MButton uploadAvatarBtn = new MButton(UserUIContext.getMessage(ShellI18nEnum.ACTION_UPLOAD_AVATAR),
                clickEvent -> {
                    EventBusFactory.getInstance()
                            .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" }));
                    NotificationComponent.this.setPopupVisible(false);
                }).withStyleName(UIConstants.BLOCK);
        wrapper.add(uploadAvatarBtn);
    } else if (item instanceof SmtpSetupNotification) {
        MButton smtpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SETUP), clickEvent -> {
            EventBusFactory.getInstance()
                    .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" }));
            NotificationComponent.this.setPopupVisible(false);
        }).withStyleName(UIConstants.BLOCK);
        Label lbl = ELabel.html(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " "
                + UserUIContext.getMessage(ShellI18nEnum.ERROR_NO_SMTP_SETTING));
        MCssLayout lblWrapper = new MCssLayout(lbl);
        wrapper.with(lblWrapper, smtpBtn).expand(lblWrapper);
    } else {
        LOG.error("Do not render notification " + item);
    }
    return wrapper;
}

From source file:org.eclipse.hawkbit.ui.utils.UINotification.java

License:Open Source License

/**
 * Display error type of notification message.
 * /*from w w  w  .  j a va 2  s  .co m*/
 * @param message
 *            as message.
 */
public void displayValidationError(final String message) {
    final StringBuilder updatedMsg = new StringBuilder(FontAwesome.EXCLAMATION_TRIANGLE.getHtml());
    updatedMsg.append(' ');
    updatedMsg.append(message);
    notificationMessage.showNotification(SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, null,
            updatedMsg.toString(), true);
}

From source file:org.jpos.qi.Sidebar.java

License:Open Source License

@SuppressWarnings("unchecked")
private void loadSideBarOptions(String id) {
    if (id != null && id.equals(currentSidebarId))
        return;//from  www .ja v  a 2 s .  co  m

    options = new LinkedHashMap<>();
    if (menuItems != null)
        removeComponent(menuItems);

    currentSidebarId = id;
    menuItems = new CssLayout();
    menuItems.setPrimaryStyleName("valo-menuitems");

    Element cfg = app.getXmlConfiguration();
    for (Element sb : cfg.getChildren("sidebar")) {
        String eid = sb.getAttributeValue("id");
        if (id == eid || (eid != null && eid.equals(id))) {
            for (Element e : sb.getChildren()) {
                if ("section".equals(e.getName())) {
                    Label l = new Label(e.getAttributeValue("name"));
                    l.setStyleName(ValoTheme.MENU_SUBTITLE);
                    l.setSizeUndefined();
                    menuItems.addComponent(l);
                } else if ("option".equals(e.getName())) {
                    if (((QINavigator) QI.getQI().getNavigator())
                            .hasAccessToRoute(e.getAttributeValue("action"))) {
                        Button b = new Button(e.getAttributeValue("name"));
                        b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
                        String iconName = e.getAttributeValue("icon");
                        if (iconName != null) {
                            try {
                                b.setIcon(FontAwesome.valueOf(iconName));
                            } catch (IllegalArgumentException ex) {
                                b.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
                                b.setEnabled(false);
                            }
                        }
                        String action = e.getAttributeValue("action");
                        options.put(action, b);
                        if (action != null)
                            b.addClickListener((Button.ClickListener) event -> app.getNavigator()
                                    .navigateTo("/" + action));
                        menuItems.addComponent(b);
                    }
                }
            }
            addComponent(menuItems);
        }
    }
}

From source file:org.opennms.features.topology.plugins.topo.bsm.info.SimulationModeEnabledPanelItem.java

License:Open Source License

@Override
public Component getComponent(GraphContainer container) {
    Label label = new Label("Simulation Mode Enabled");
    label.setDescription("Simulation Mode is enabled");
    label.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
    label.addStyleName("warning");

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(label);/*from   w  w w  .ja  v a 2  s  .co m*/
    layout.addStyleName("simulation");
    return layout;
}

From source file:org.opennms.features.topology.plugins.topo.bsm.info.SimulationModeEnabledPanelItemProvider.java

License:Open Source License

private Component createComponent() {
    Label label = new Label("Simulation Mode Enabled");
    label.setDescription("Simulation Mode is enabled");
    label.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
    label.addStyleName("warning");

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(label);/*from   w  w  w  .ja v  a  2 s  .com*/
    layout.addStyleName("simulation");
    return layout;
}

From source file:org.vaadin.viritin.it.MNotificationExapmle.java

License:Apache License

@Override
public Component getTestComponent() {
    MVerticalLayout layout = new MVerticalLayout(new MLabel("MNotification Examples").withStyleName("h1"),
            new MHorizontalLayout(new MButton(FontAwesome.COMMENT, "Humanized", new Button.ClickListener() {
                @Override//from  ww  w . j  a  va  2 s  .c o m
                public void buttonClick(Button.ClickEvent event) {
                    MNotification.humanized("Humanized", "This is a humanized notification!")
                            .withIcon(FontAwesome.COMMENT);
                }
            }).withStyleName("primary"), new MButton(FontAwesome.TIMES, "Error", new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    MNotification.error("Error", "This is an error notification!").withIcon(FontAwesome.TIMES);
                }
            }).withStyleName("danger"),
                    new MButton(FontAwesome.EXCLAMATION_TRIANGLE, "Warning", new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            MNotification.warning("Warning", "This is a warning notification!")
                                    .withIcon(FontAwesome.EXCLAMATION_TRIANGLE);
                        }
                    }), new MButton(FontAwesome.DOWNLOAD, "Tray", new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            MNotification.tray("Tray", "This is a tray notification!")
                                    .withIcon(FontAwesome.DOWNLOAD);
                        }
                    }).withStyleName("friendly"),
                    new MButton(FontAwesome.WHEELCHAIR, "Assistive", new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            MNotification.assistive("Assistive", "This is an assistive notification!");
                        }
                    }).withStyleName("quiet"))).withFullWidth();

    return layout;
}