Example usage for com.vaadin.ui.themes ValoTheme LABEL_NO_MARGIN

List of usage examples for com.vaadin.ui.themes ValoTheme LABEL_NO_MARGIN

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme LABEL_NO_MARGIN.

Prototype

String LABEL_NO_MARGIN

To view the source code for com.vaadin.ui.themes ValoTheme LABEL_NO_MARGIN.

Click Source Link

Document

A utility style that can be combined with the #LABEL_H1 , #LABEL_H2 , #LABEL_H3 and #LABEL_H4 styles to remove the default margins from the header.

Usage

From source file:com.mycollab.module.project.view.ticket.ToggleTicketSummaryField.java

License:Open Source License

public ToggleTicketSummaryField(final ProjectTicket ticket) {
    this.ticket = ticket;
    this.setWidth("100%");
    titleLinkLbl = ELabel.html(buildTicketLink())
            .withStyleName(ValoTheme.LABEL_NO_MARGIN, UIConstants.LABEL_WORD_WRAP).withWidthUndefined();
    if (ticket.isClosed()) {
        titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED);
    } else if (ticket.isOverdue()) {
        titleLinkLbl.addStyleName(WebThemes.LINK_OVERDUE);
    }/*ww w.  ja  v  a 2s .  c o m*/
    this.addComponent(titleLinkLbl);
    if (CurrentProjectVariables.canWriteTicket(ticket)) {
        this.addStyleName("editable-field");
        buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
                .withStyleName("toggle");
        buttonControls.setDefaultComponentAlignment(Alignment.TOP_LEFT);
        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                removeComponent(titleLinkLbl);
                removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(ticket.getName());
                editField.setWidth("100%");
                editField.focus();
                addComponent(editField);
                removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_CLICK_TO_EDIT));
        buttonControls.with(instantEditBtn);

        if ((ticket.isRisk() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.RISKS))
                || (ticket.isBug() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.BUGS))
                || (ticket.isTask()
                        && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS))) {
            MButton removeBtn = new MButton("", clickEvent -> {
                ConfirmDialogExt.show(UI.getCurrent(),
                        UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                        UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                            if (confirmDialog.isConfirmed()) {
                                AppContextUtil.getSpringBean(ProjectTicketService.class).removeTicket(ticket,
                                        UserUIContext.getUsername());
                                BlockRowRender rowRenderer = UIUtils.getRoot(ToggleTicketSummaryField.this,
                                        BlockRowRender.class);
                                if (rowRenderer != null) {
                                    rowRenderer.selfRemoved();
                                }
                                EventBusFactory.getInstance()
                                        .post(new TicketEvent.HasTicketPropertyChanged(this, "all"));
                            }
                        });
            }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
            buttonControls.with(removeBtn);
        }

        this.addComponent(buttonControls);
    }
}

From source file:com.mycollab.shell.view.components.NoSubDomainExistedWindow.java

License:Open Source License

public NoSubDomainExistedWindow(final String domain) {
    this.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    final Label titleIcon = ELabel.fontIcon(FontAwesome.EXCLAMATION_CIRCLE)
            .withStyleName("warning-icon", ValoTheme.LABEL_NO_MARGIN).withWidthUndefined();

    Label warningMsg = new ELabel(UserUIContext.getMessage(ShellI18nEnum.ERROR_NO_SUB_DOMAIN, domain))
            .withWidthUndefined();//from w w  w  .ja v  a  2 s .  co  m

    Button backToHome = new Button(UserUIContext.getMessage(ShellI18nEnum.BUTTON_BACK_TO_HOME_PAGE),
            clickEvent -> getUI().getPage().setLocation("https://www.mycollab.com"));
    backToHome.addStyleName(WebThemes.BUTTON_ACTION);
    this.with(titleIcon, warningMsg, backToHome);
}

From source file:com.mycollab.vaadin.mvp.view.NotPresentedView.java

License:Open Source License

public NotPresentedView() {
    MVerticalLayout bodyLayout = new MVerticalLayout().withMargin(false);
    setContent(bodyLayout);//ww  w .  j a  v  a2s. c o m
    bodyLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    final ELabel titleIcon = ELabel.fontIcon(FontAwesome.EXCLAMATION_CIRCLE).withStyleName("warning-icon",
            ValoTheme.LABEL_NO_MARGIN);
    titleIcon.setWidthUndefined();
    bodyLayout.with(titleIcon);

    Label label = ELabel
            .h2(UserUIContext.getMessage(GenericI18Enum.NOTIFICATION_FEATURE_NOT_AVAILABLE_IN_VERSION))
            .withWidthUndefined();
    bodyLayout.with(label).withAlign(label, Alignment.MIDDLE_CENTER);

    RestTemplate restTemplate = new RestTemplate();
    try {
        String result = restTemplate.getForObject(SiteConfiguration.getApiUrl("storeweb"), String.class);
        ELabel webPage = ELabel.html(result);
        webPage.setHeight("480px");
        bodyLayout
                .with(new MVerticalLayout(webPage).withMargin(false).withAlign(webPage, Alignment.TOP_CENTER));
    } catch (Exception e) {
        Div informDiv = new Div()
                .appendText("Can not load the store page. You can check the online edition at ")
                .appendChild(new A("https://www.mycollab.com/pricing/download/", "_blank").appendText("here"));
        ELabel webPage = ELabel.html(informDiv.write()).withWidthUndefined();
        bodyLayout.with(new MVerticalLayout(webPage).withAlign(webPage, Alignment.TOP_CENTER));
    }
}

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

License:Open Source License

public static ELabel h1(String value) {
    return ELabel.html(value).withStyleName(ValoTheme.LABEL_H1, ValoTheme.LABEL_NO_MARGIN);
}

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

License:Open Source License

public static ELabel h2(String value) {
    return ELabel.html(value).withStyleName(ValoTheme.LABEL_H2, ValoTheme.LABEL_NO_MARGIN);
}

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

License:Open Source License

public static ELabel h3(String value) {
    return ELabel.html(value).withStyleName(ValoTheme.LABEL_H3, ValoTheme.LABEL_NO_MARGIN);
}

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

License:Open Source License

private HeaderWithFontAwesome(FontAwesome iconFont, String title, String primaryStyle) {
    super();//from   www.j a  v  a2s.  c  o m
    wrappedLbl = new Label();
    wrappedLbl.setContentMode(ContentMode.HTML);
    wrappedLbl.setStyleName(primaryStyle);
    wrappedLbl.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    this.iconFont = iconFont;
    updateTitle(title);
    this.addComponent(wrappedLbl);
}

From source file:dhbw.clippinggorilla.userinterface.views.ArchiveView.java

public Component createClippingRow(Article a) {
    Image imageNewsImage = new Image();
    String url = a.getUrlToImage();
    if (url == null || url.isEmpty()) {
        url = a.getSourceAsSource().getLogo().toExternalForm();
    }//ww  w . j  av a2 s . com
    imageNewsImage.setSource(new ExternalResource(url));
    imageNewsImage.addStyleName("articleimage");

    VerticalLayout layoutNewsImage = new VerticalLayout(imageNewsImage);
    layoutNewsImage.setMargin(false);
    layoutNewsImage.setSpacing(false);
    layoutNewsImage.setWidth("200px");
    layoutNewsImage.setHeight("150px");
    layoutNewsImage.setComponentAlignment(imageNewsImage, Alignment.MIDDLE_CENTER);

    Label labelHeadLine = new Label(a.getTitle(), ContentMode.HTML);
    labelHeadLine.addStyleName(ValoTheme.LABEL_H2);
    labelHeadLine.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    labelHeadLine.setWidth("100%");

    Label labelDescription = new Label(a.getDescription(), ContentMode.HTML);
    labelDescription.setWidth("100%");

    Image imageSource = new Image();
    Source s = a.getSourceAsSource();
    URL logo;
    if (s != null) {
        logo = s.getLogo();
    } else {
        Log.error("Source is null: " + a.getSource());
        return new Label("INTERNAL ERROR");
    }
    if (logo != null) {
        imageSource.setSource(new ExternalResource(logo));
    } else {
        Log.error("Sourcelogo is null: " + s.getName());
    }
    imageSource.setHeight("30px");
    Label labelSource = new Label(a.getSourceAsSource().getName());
    labelSource.addStyleName(ValoTheme.LABEL_SMALL);

    LocalDateTime time = a.getPublishedAtAsLocalDateTime();
    DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG);
    formatter.withZone(ZoneId.of("Europe/Berlin"));
    Label labelDate = new Label(time.format(formatter));
    labelDate.addStyleName(ValoTheme.LABEL_SMALL);

    Label labelAuthor = new Label();
    labelAuthor.addStyleName(ValoTheme.LABEL_SMALL);
    labelAuthor.setWidth("100%");
    if (a.getAuthor() != null && !a.getAuthor().isEmpty()) {
        labelAuthor.setValue(a.getAuthor());
    }

    Button openWebsite = new Button(VaadinIcons.EXTERNAL_LINK);
    openWebsite.addClickListener(e -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false));

    HorizontalLayout layoutArticleOptions = new HorizontalLayout();
    layoutArticleOptions.setWidth("100%");
    layoutArticleOptions.addComponents(imageSource, labelSource, labelDate, labelAuthor, openWebsite);
    layoutArticleOptions.setComponentAlignment(imageSource, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelSource, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelDate, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelAuthor, Alignment.MIDDLE_LEFT);
    layoutArticleOptions.setComponentAlignment(openWebsite, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setExpandRatio(labelAuthor, 5);

    VerticalLayout layoutNewsText = new VerticalLayout(labelHeadLine, labelDescription, layoutArticleOptions);
    layoutNewsText.setMargin(false);
    layoutNewsText.setWidth("100%");

    HorizontalLayout layoutClipping = new HorizontalLayout();
    layoutClipping.setWidth("100%");
    layoutClipping.setMargin(true);
    layoutClipping.addComponents(layoutNewsImage, layoutNewsText);
    layoutClipping.setComponentAlignment(layoutNewsImage, Alignment.MIDDLE_CENTER);
    layoutClipping.setExpandRatio(layoutNewsText, 5);
    layoutClipping.addStyleName(ValoTheme.LAYOUT_CARD);
    layoutClipping.addStyleName("tags");
    return layoutClipping;
}

From source file:dhbw.clippinggorilla.userinterface.views.ClippingView.java

public Component createClippingRow(Article a) {
    Image imageNewsImage = new Image();
    String url = a.getUrlToImage();
    if (url == null || url.isEmpty()) {
        url = a.getSourceAsSource().getLogo().toExternalForm();
    }//from  ww w .ja  va 2s  .c  o m
    imageNewsImage.setSource(new ExternalResource(url));
    imageNewsImage.addStyleName("articleimage");

    VerticalLayout layoutNewsImage = new VerticalLayout(imageNewsImage);
    layoutNewsImage.setMargin(false);
    layoutNewsImage.setSpacing(false);
    layoutNewsImage.setWidth("200px");
    layoutNewsImage.setHeight("150px");
    layoutNewsImage.setComponentAlignment(imageNewsImage, Alignment.MIDDLE_CENTER);

    Label labelHeadLine = new Label(a.getTitle(), ContentMode.HTML);
    labelHeadLine.addStyleName(ValoTheme.LABEL_H2);
    labelHeadLine.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    labelHeadLine.setWidth("100%");

    Label labelDescription = new Label(a.getDescription(), ContentMode.HTML);
    labelDescription.setWidth("100%");

    Image imageSource = new Image();
    Source s = a.getSourceAsSource();
    URL logo = null;
    if (s != null) {
        logo = s.getLogo();
    } else {
        Log.error("Source is null: " + a.getSource());
        return new Label("INTERNAL ERROR");
    }
    if (logo != null) {
        imageSource.setSource(new ExternalResource(logo));
    } else {
        Log.error("Sourcelogo is null: " + s.getName());
    }
    imageSource.setHeight("30px");
    Label labelSource = new Label(a.getSourceAsSource().getName());
    labelSource.addStyleName(ValoTheme.LABEL_SMALL);

    LocalDateTime time = a.getPublishedAtAsLocalDateTime();
    DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG);
    formatter.withZone(ZoneId.of("Europe/Berlin"));
    Label labelDate = new Label(time.format(formatter));
    labelDate.addStyleName(ValoTheme.LABEL_SMALL);

    Label labelAuthor = new Label();
    labelAuthor.addStyleName(ValoTheme.LABEL_SMALL);
    labelAuthor.setWidth("100%");
    if (a.getAuthor() != null && !a.getAuthor().isEmpty()) {
        labelAuthor.setValue(a.getAuthor());
    }

    Button openWebsite = new Button(VaadinIcons.EXTERNAL_LINK);
    openWebsite.addClickListener(e -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false));

    HorizontalLayout layoutArticleOptions = new HorizontalLayout();
    layoutArticleOptions.setWidth("100%");
    layoutArticleOptions.addComponents(imageSource, labelSource, labelDate, labelAuthor, openWebsite);
    layoutArticleOptions.setComponentAlignment(imageSource, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelSource, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelDate, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelAuthor, Alignment.MIDDLE_LEFT);
    layoutArticleOptions.setComponentAlignment(openWebsite, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setExpandRatio(labelAuthor, 5);

    VerticalLayout layoutNewsText = new VerticalLayout(labelHeadLine, labelDescription, layoutArticleOptions);
    layoutNewsText.setMargin(false);
    layoutNewsText.setWidth("100%");

    HorizontalLayout layoutClipping = new HorizontalLayout();
    layoutClipping.setWidth("100%");
    layoutClipping.setMargin(true);
    layoutClipping.addComponents(layoutNewsImage, layoutNewsText);
    layoutClipping.setComponentAlignment(layoutNewsImage, Alignment.MIDDLE_CENTER);
    layoutClipping.setExpandRatio(layoutNewsText, 5);
    layoutClipping.addStyleName(ValoTheme.LAYOUT_CARD);
    layoutClipping.addStyleName("tags");
    return layoutClipping;
}

From source file:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java

public Component getCategories(InterestProfile profile) {
    Map<Category, Boolean> categories = profile.getCategories();
    VerticalLayout categoriesLayout = new VerticalLayout();
    categoriesLayout.setWidth("100%");
    Panel categoriesPanel = new Panel(categoriesLayout);

    categories.entrySet().stream().sorted((e1, e2) -> e1.getKey().getName().compareTo(e2.getKey().getName()))
            .forEach(e -> {/*from   w  w  w.  j av a 2  s  .  c o  m*/
                Category category = e.getKey();
                boolean enabled = e.getValue();
                GridLayout categoryLayout = new GridLayout(3, 1);
                categoryLayout.setWidth("100%");

                CheckBox categorySelected = new CheckBox();
                categorySelected.setValue(enabled);
                categorySelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                categorySelected.addValueChangeListener(v -> categories.replace(category, v.getValue()));

                Label categoryIcon = new Label(category.getIcon().getHtml(), ContentMode.HTML);
                categoryIcon.addStyleName(ValoTheme.LABEL_H3);
                categoryIcon.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                Label categoryName = new Label(category.getName(), ContentMode.HTML);
                Language.setCustom(null, s -> categoryName.setValue(category.getName()));
                categoryName.addStyleName(ValoTheme.LABEL_H3);
                categoryName.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                categoryLayout.addComponents(categorySelected, categoryIcon, categoryName);
                categoryLayout.setComponentAlignment(categorySelected, Alignment.MIDDLE_CENTER);
                categoryLayout.setComponentAlignment(categoryIcon, Alignment.MIDDLE_LEFT);
                categoryLayout.setComponentAlignment(categoryName, Alignment.MIDDLE_LEFT);
                categoryLayout.setColumnExpandRatio(2, 5);
                categoryLayout.setSpacing(true);

                categoriesLayout.addComponent(categoryLayout);
            });

    categoriesPanel.setContent(categoriesLayout);
    categoriesPanel.setHeight("100%");
    categoriesPanel.setCaption(Language.get(Word.CATEGORIES));
    Language.setCustom(Word.CATEGORIES, s -> categoriesPanel.setCaption(s));

    return categoriesPanel;
}