Example usage for com.vaadin.ui Button setHtmlContentAllowed

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

Introduction

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

Prototype

@Deprecated
public void setHtmlContentAllowed(boolean htmlContentAllowed) 

Source Link

Document

Set whether the caption text is rendered as HTML or not.

Usage

From source file:com.mycollab.mobile.module.crm.view.campaign.CampaignReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*from w ww.  jav  a2 s . com*/

    Button relatedAccounts = new Button();
    relatedAccounts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACCOUNT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(AccountI18nEnum.LIST)
            + "</div>");
    relatedAccounts.setHtmlContentAllowed(true);
    relatedAccounts.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateAccounts))));
    toolbarLayout.addComponent(relatedAccounts);

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(LeadI18nEnum.LIST)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))));
    toolbarLayout.addComponent(relatedLeads);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.cases.CaseReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    MHorizontalLayout toolbarLayout = new MHorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.contact.ContactReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    MHorizontalLayout toolbarLayout = new MHorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Button relatedOpportunities = new Button();
    relatedOpportunities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_OPPORTUNITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(OpportunityI18nEnum.LIST) + "</div>");
    relatedOpportunities.setHtmlContentAllowed(true);
    relatedOpportunities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateOpportunityList))));

    toolbarLayout.addComponent(relatedOpportunities);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivityList))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.lead.LeadReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*  w  ww. ja v a  2  s.  c  o  m*/

    Button relatedCampaigns = new Button();
    relatedCampaigns.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CAMPAIGN
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CampaignI18nEnum.LIST)
            + "</div>");
    relatedCampaigns.setHtmlContentAllowed(true);
    relatedCampaigns
            .addClickListener(clickEvent -> EventBusFactory.getInstance().post(new LeadEvent.GoToRelatedItems(
                    LeadReadViewImpl.this, new CrmRelatedItemsScreenData(associateCampaigns))));
    toolbarLayout.addComponent(relatedCampaigns);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.opportunity.OpportunityReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//  w ww  .j a v  a  2 s.  c om

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(LeadI18nEnum.LIST)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))));
    toolbarLayout.addComponent(relatedLeads);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.peergreen.webconsole.core.notifier.NotifierService.java

License:Open Source License

/**
 * Set badge as new//from   w  w  w  .j av  a  2 s .c  om
 *
 * @param button button
 * @param ui     button UI
 */
private void setBadgeAsNew(final Button button, UI ui) {
    button.setHtmlContentAllowed(true);
    final String newCaption = getInitialCaption(button) + "<span class=\"badge\">new</span>";
    setCaption(button, ui, newCaption);

}

From source file:com.selzlein.lojavirtual.vaadin.core.NavigationMenu.java

License:Open Source License

private Button addMenuItem(String titleKey, FontAwesome icon, String viewId, ClickListener action,
        Integer badgeValue) {//from w  w w  .  j av a  2  s.  c  o  m
    Button b = new Button(ui.getMessage(titleKey), action);
    if (badgeValue != null) {
        b.setCaption(b.getCaption() + "<span class=\"valo-menu-badge\">" + badgeValue + "</span>");
    }
    b.setIcon(icon);
    b.setPrimaryStyleName("valo-menu-item");
    b.setHtmlContentAllowed(true);
    mainMenu.addComponent(b);
    if (viewId != null) {
        menuItems.put(viewId, b);
    }
    return b;
}

From source file:es.mdef.clientmanager.ui.GestionClientesUI.java

License:Apache License

CssLayout buildMenu() {
    // Add items//from w  ww.jav a2 s  . c om
    menuItems.put("common", "Common UI Elements");
    menu.setSizeFull();
    menu.addComponent(getMenuTitleComponent());

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");

    // TODO Actualizar nombre de usuario cuando se logee con exito
    final MenuBar.MenuItem userMenuItem = settings.addItem(getNombreUsuario(),
            new ThemeResource("icons/usuario.svg"), null);

    userMenuItem.addItem("Cambiar contrasea", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            ChangePasswordWindow changePasswordWindow = new ChangePasswordWindow();
            changePasswordWindow.center();
            addWindow(changePasswordWindow);
        }
    });
    userMenuItem.addSeparator();
    userMenuItem.addItem("Salir", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            SecurityContextHolder.clearContext();

            //UI.getCurrent().close();
            Navigator navigator = UI.getCurrent().getNavigator();
            navigator.navigateTo("");
        }
    });
    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    final Button clientesButton = new Button("Clientes", new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            navigator.navigateTo(CLIENT_LIST_VIEW);
        }
    });

    clientesButton.setHtmlContentAllowed(true);
    clientesButton.setPrimaryStyleName("valo-menu-item");
    clientesButton.setIcon(new ThemeResource("icons/clientes2.svg"));
    menuItemsLayout.addComponent(clientesButton);

    final Button budgetButton = new Button("Presupuesto", new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            navigator.navigateTo(BUDGETS_VIEW);
        }
    });

    budgetButton.setHtmlContentAllowed(true);
    budgetButton.setPrimaryStyleName("valo-menu-item");
    budgetButton.setIcon(new ThemeResource("icons/money.svg"));
    menuItemsLayout.addComponent(budgetButton);

    final Button subscripcionButton = new Button("Suscripciones", new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            navigator.navigateTo(PROVIDERS_VIEW);
        }
    });

    subscripcionButton.setHtmlContentAllowed(true);
    subscripcionButton.setPrimaryStyleName("valo-menu-item");
    subscripcionButton.setIcon(new ThemeResource("icons/suscripciones.svg"));
    menuItemsLayout.addComponent(subscripcionButton);

    return menu;
}

From source file:fr.amapj.view.engine.menu.MenuPart.java

License:Open Source License

private CssLayout buildMenu(CssLayout menu, CssLayout menuItemsLayout, List<MenuDescription> allMenus,
        Navigator navigator, AmapUI ui) {

    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);/* w ww.  j  a v a 2s .  c o m*/

    final Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    String nomAmap = new ParametresService().getParametres().nomAmap;
    Label title = new Label("<h2>" + nomAmap + "</h2>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");

    SessionParameters p = SessionManager.getSessionParameters();
    MenuItem settingsItem = settings.addItem(p.userPrenom + " " + p.userNom, null, null);
    settingsItem.addItem("Se dconnecter", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            new PasswordManager().disconnect();
            ui.buildLoginView(null, null, null);
        }
    });

    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    boolean first = true;
    String firstEntry = null;
    Button firstButton = null;

    for (MenuDescription menuDescription : allMenus) {
        final String view = menuDescription.getMenuName().name().toLowerCase();
        final String titleView = menuDescription.getMenuName().getTitle();

        if (menuDescription.getCategorie() != null) {
            Label l = new Label(menuDescription.getCategorie(), ContentMode.HTML);
            l.setPrimaryStyleName("valo-menu-subtitle");
            l.addStyleName("h4");
            l.setSizeUndefined();
            menuItemsLayout.addComponent(l);
        }

        final Button b = new Button(titleView, new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                setSelected(event.getButton(), menuItemsLayout);
                navigator.navigateTo("/" + view);
            }
        });

        b.setId("amapj.menu." + view);
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        b.setIcon(menuDescription.getMenuName().getFont());
        menuItemsLayout.addComponent(b);

        viewNameToMenuButton.put("/" + view, b);

        if (first) {
            first = false;
            firstButton = b;
            firstEntry = view;
        }
    }

    // Gestion de l'url
    String f = Page.getCurrent().getUriFragment();
    if (f != null && f.startsWith("!")) {
        f = f.substring(1);
    }
    if (f == null || f.equals("") || f.equals("/")) {
        navigateWithProtect(navigator, "/" + firstEntry);
        setSelected(firstButton, menuItemsLayout);
    } else {
        navigateWithProtect(navigator, f);
        setSelected(viewNameToMenuButton.get(f), menuItemsLayout);
    }

    return menu;
}

From source file:info.magnolia.security.app.dialog.field.WebAccessFieldFactory.java

License:Open Source License

private Component createRuleRow(final AbstractOrderedLayout parentContainer,
        final AbstractJcrNodeAdapter ruleItem, final Label emptyLabel) {

    final HorizontalLayout ruleLayout = new HorizontalLayout();
    ruleLayout.setSpacing(true);/*from   w w w  .  jav a2s  . c  o  m*/
    ruleLayout.setWidth("100%");

    NativeSelect accessRights = new NativeSelect();
    accessRights.addItem(Permission.ALL);
    accessRights.setItemCaption(Permission.ALL, i18n.translate("security.web.field.getPost"));
    accessRights.addItem(Permission.READ);
    accessRights.setItemCaption(Permission.READ, i18n.translate("security.web.field.get"));
    accessRights.addItem(Permission.NONE);
    accessRights.setItemCaption(Permission.NONE, i18n.translate("security.web.field.deny"));
    accessRights.setNullSelectionAllowed(false);
    accessRights.setImmediate(true);
    accessRights.setInvalidAllowed(false);
    accessRights.setNewItemsAllowed(false);
    Property permissionsProperty = ruleItem.getItemProperty(PERMISSIONS_PROPERTY_NAME);
    if (permissionsProperty == null) {
        permissionsProperty = new DefaultProperty<Long>(Long.class, Permission.ALL);
        ruleItem.addItemProperty(PERMISSIONS_PROPERTY_NAME, permissionsProperty);
    }
    accessRights.setPropertyDataSource(permissionsProperty);
    ruleLayout.addComponent(accessRights);

    TextField path = new TextField();
    path.setWidth("100%");
    Property pathProperty = ruleItem.getItemProperty(PATH_PROPERTY_NAME);
    if (pathProperty == null) {
        pathProperty = new DefaultProperty<String>(String.class, "/*");
        ruleItem.addItemProperty(PATH_PROPERTY_NAME, pathProperty);
    }
    path.setPropertyDataSource(pathProperty);
    ruleLayout.addComponent(path);
    ruleLayout.setExpandRatio(path, 1.0f);

    final Button deleteButton = new Button();
    deleteButton.setHtmlContentAllowed(true);
    deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>");
    deleteButton.addStyleName("inline");
    deleteButton.setDescription(i18n.translate("security.web.field.delete"));
    deleteButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            parentContainer.removeComponent(ruleLayout);
            ruleItem.getParent().removeChild(ruleItem);
            if (parentContainer.getComponentCount() == 1) {
                parentContainer.addComponent(emptyLabel, 0);
            }
        }
    });
    ruleLayout.addComponent(deleteButton);

    return ruleLayout;
}