Example usage for com.vaadin.ui Label Label

List of usage examples for com.vaadin.ui Label Label

Introduction

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

Prototype

public Label(String text) 

Source Link

Document

Creates a new instance with text content mode and the given text.

Usage

From source file:com.esofthead.mycollab.vaadin.ui.form.field.UrlLinkViewField.java

License:Open Source License

@Override
protected Component initContent() {
    if (StringUtils.isBlank(url)) {
        Label lbl = new Label(" ");
        lbl.setContentMode(ContentMode.HTML);
        lbl.setWidth("100%");
        return lbl;
    } else {//ww  w  . ja v a2 s .c  o  m
        final Link link = new UrlLink(url);
        link.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
        return link;
    }
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.UrlSocialNetworkLinkViewField.java

License:Open Source License

@Override
protected Component initContent() {
    if (StringUtils.isBlank(caption)) {
        Label lbl = new Label(" ");
        lbl.setContentMode(ContentMode.HTML);
        lbl.setWidth("100%");
        return lbl;
    } else {//w  w  w  .  j  ava 2  s . co m
        linkAccount = (linkAccount == null) ? "" : linkAccount;
        final Link link = new SocialNetworkLink(caption, linkAccount);
        link.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
        return link;
    }
}

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

License:Open Source License

public void addSection(String sectionName, ComponentContainer container) {
    this.addSection(new MCssLayout(new Label(sectionName)), container);
}

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

License:Open Source License

public GridCellWrapper buildCell(final String caption, final int columns, final int rows, final int colspan,
        final String width, final Alignment alignment) {
    if (StringUtils.isNotBlank(caption)) {
        final Label l = new Label(caption + ":");
        final MHorizontalLayout captionWrapper = new MHorizontalLayout().withSpacing(false).withMargin(true)
                .withWidth(this.defaultCaptionWidth).withHeight("100%").withStyleName("gridform-caption")
                .with(l).withAlign(l, alignment);
        if (columns == 0) {
            captionWrapper.addStyleName("first-col");
        }//from  ww  w. j a v  a 2  s. c  o  m
        if (rows == 0) {
            captionWrapper.addStyleName("first-row");
        }
        this.layout.addComponent(captionWrapper, 2 * columns, rows);
    }
    final GridCellWrapper fieldWrapper = new GridCellWrapper();

    if (rows == 0) {
        fieldWrapper.addStyleName("first-row");
        fieldWrapper.setWidth(width);
    }
    this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows, 2 * (columns + colspan - 1) + 1, rows);
    this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f);

    if (StringUtils.isNotBlank(caption)) {
        fieldCaptionMappings.put(caption, fieldWrapper);
    }
    return fieldWrapper;
}

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

License:Open Source License

public void addComponentNoWrapper(final Component field, final String caption, final int columns,
        final int rows) {
    if (caption != null) {
        final Label l = new Label(caption);
        l.setWidth(this.defaultCaptionWidth);
        this.layout.addComponent(l, 2 * columns, rows);
        this.layout.setComponentAlignment(l, this.captionAlignment);
    }/*from   w  w w  .j  ava2s.co m*/
    if (!(field instanceof Button))
        field.setCaption(null);

    if (field instanceof MultiSelectComp) {
        field.setWidth("200px");
    } else {
        field.setWidth(fieldControlWidth);
    }

    this.layout.addComponent(field, 2 * columns + 1, rows);
    this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f);
}

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

License:Open Source License

private Layout createTextFieldMail(String title, Component component) {
    HorizontalLayout layout = new HorizontalLayout();
    Label lbTitle = new Label(title);
    lbTitle.setWidth("60px");
    lbTitle.setStyleName("lbmail");
    layout.addComponent(lbTitle);/*from www .  ja va 2 s .c o  m*/
    layout.setComponentAlignment(lbTitle, Alignment.MIDDLE_RIGHT);
    layout.addComponent(component);
    layout.setComponentAlignment(component, Alignment.MIDDLE_LEFT);
    layout.setWidth("100%");
    layout.setExpandRatio(component, 1.0f);
    return layout;
}

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

License:Open Source License

@Override
public void popupVisibilityChange(PopupVisibilityEvent event) {
    notificationContainer.removeAllComponents();

    if (notificationItems.size() > 0) {
        for (AbstractNotification item : notificationItems) {
            Component comp = item.renderContent();
            comp.setStyleName("notification-type");
            comp.addStyleName("notification-type-" + item.getType());
            notificationContainer.addComponent(comp);
        }//  w w w . ja  v a 2  s  .c o  m
    } else {
        Label noItemLbl = new Label("There is no notification right now");
        notificationContainer.addComponent(noItemLbl);
        notificationContainer.setComponentAlignment(noItemLbl, Alignment.MIDDLE_CENTER);
    }
}

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

License:Open Source License

public ProgressBarIndicator(final int total, final int remaining, final Boolean displayPercentage) {
    super("progressBar");

    float value = (total != 0) ? ((float) (total - remaining) / total) : 1;

    this.progressIndicator = new ProgressBar(new Float(value));
    this.progressIndicator.setWidth("100%");
    if (displayPercentage) {
        if (total > 0) {
            this.progressStatusLabel = new Label(String.format("%.0f", value * 100) + "%");
        } else {/*from   w  ww. j a v a2s .  c om*/
            this.progressStatusLabel = new Label("100%");
        }
    } else {
        this.progressStatusLabel = new Label(String.valueOf(total - remaining) + "/" + String.valueOf(total));
    }
    this.progressStatusLabel.setWidth("100%");
    this.progressStatusLabel.setHeight("100%");
    this.addComponent(this.progressIndicator, "progressbar-container");
    this.addComponent(this.progressStatusLabel, "progressbar-status");
}

From source file:com.esofthead.mycollab.vaadin.ui.table.AbstractPagedBeanTable.java

License:Open Source License

private CssLayout createControls() {
    this.controlBarWrapper = new CssLayout();
    this.controlBarWrapper.setStyleName("listControl");
    this.controlBarWrapper.setWidth("100%");

    final HorizontalLayout controlBar = new HorizontalLayout();
    controlBar.setWidth("100%");
    this.controlBarWrapper.addComponent(controlBar);

    this.pageManagement = new HorizontalLayout();

    // defined layout here ---------------------------

    if (this.currentPage > 1) {
        final Button firstLink = new ButtonLink("1", new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override//from   ww w.  j ava  2  s. c o m
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(1);
            }
        }, false);
        firstLink.addStyleName("buttonPaging");
        this.pageManagement.addComponent(firstLink);
    }
    if (this.currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss1);
    }

    if (this.currentPage > 3) {
        final Button previous2 = new ButtonLink("" + (this.currentPage - 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage - 2);
            }
        }, false);
        previous2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous2);
    }
    if (this.currentPage > 2) {
        final Button previous1 = new ButtonLink("" + (this.currentPage - 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage - 1);
            }
        }, false);
        previous1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLink
    final Button current = new ButtonLink("" + this.currentPage, new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage);
        }
    }, false);
    current.addStyleName("buttonPaging");
    current.addStyleName("buttonPagingcurrent");

    this.pageManagement.addComponent(current);
    final int range = this.totalPage - this.currentPage;
    if (range >= 1) {
        final Button next1 = new ButtonLink("" + (this.currentPage + 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage + 1);
            }
        }, false);
        next1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        final Button next2 = new ButtonLink("" + (this.currentPage + 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage + 2);
            }
        }, false);
        next2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        final Button last = new ButtonLink("" + this.totalPage, new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.totalPage);
            }
        }, false);
        last.addStyleName("buttonPaging");
        this.pageManagement.addComponent(last);
    }

    this.pageManagement.setWidth(null);
    this.pageManagement.setSpacing(true);
    controlBar.addComponent(this.pageManagement);
    controlBar.setComponentAlignment(this.pageManagement, Alignment.MIDDLE_RIGHT);

    return this.controlBarWrapper;
}

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

License:Open Source License

protected CssLayout createPageControls() {
    this.controlBarWrapper = new CssLayout();
    this.controlBarWrapper.setWidth("100%");

    final HorizontalLayout controlBar = new HorizontalLayout();
    controlBar.setWidth("100%");
    this.controlBarWrapper.addComponent(controlBar);

    pageManagement = new MHorizontalLayout();

    // defined layout here ---------------------------

    if (currentPage > 1) {
        final Button firstLink = new Button("1", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override//from   w  w w  .  j  a  v a  2s.  c  o m
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(1);
            }
        });
        firstLink.addStyleName("buttonPaging");
        pageManagement.addComponent(firstLink);
    }
    if (currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        pageManagement.addComponent(ss1);
    }
    if (currentPage > 3) {
        final Button previous2 = new Button("" + (currentPage - 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(currentPage - 2);
            }
        });
        previous2.addStyleName("buttonPaging");
        pageManagement.addComponent(previous2);
    }
    if (currentPage > 2) {
        final Button previous1 = new Button("" + (currentPage - 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage - 1);
            }
        });
        previous1.addStyleName("buttonPaging");
        pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLinkLegacy
    final Button current = new Button("" + currentPage, new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            AbstractBeanBlockList.this.pageChange(currentPage);
        }
    });
    current.addStyleName("buttonPaging");
    current.addStyleName("current");

    pageManagement.addComponent(current);
    final int range = totalPage - currentPage;
    if (range >= 1) {
        final Button next1 = new Button("" + (currentPage + 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage + 1);
            }
        });
        next1.addStyleName("buttonPaging");
        pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        final Button next2 = new Button("" + (currentPage + 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage + 2);
            }
        });
        next2.addStyleName("buttonPaging");
        pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        final Button last = new Button("" + totalPage, new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(totalPage);
            }
        });
        last.addStyleName("buttonPaging");
        pageManagement.addComponent(last);
    }

    pageManagement.setWidth(null);
    controlBar.addComponent(pageManagement);
    controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT);

    return this.controlBarWrapper;
}