Example usage for com.vaadin.ui HorizontalLayout setSpacing

List of usage examples for com.vaadin.ui HorizontalLayout setSpacing

Introduction

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

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

From source file:com.cavisson.gui.dashboard.components.controls.Tables.java

License:Apache License

public Tables() {
    setMargin(true);/* w w  w. j  av a  2 s .com*/
    setSpacing(true);

    Label h1 = new Label("Tables");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.addStyleName("wrapping");
    wrap.setSpacing(true);
    addComponent(wrap);

    wrap.addComponents(hierarchical, footer, sized, expandRatios, stripes, verticalLines, horizontalLines,
            borderless, headers, compact, small, rowIndex, rowCaption, rowIcon, componentsInCells);

    ValueChangeListener update = new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            if (table == null) {
                table = new Table();
                table.setContainerDataSource(normalContainer);
                addComponent(table);
            }
            if (hierarchical.getValue() && table instanceof Table) {
                removeComponent(table);
                table = new TreeTable();
                table.setContainerDataSource(hierarchicalContainer);
                addComponent(table);
            } else if (!hierarchical.getValue() && table instanceof TreeTable) {
                removeComponent(table);
                table = new Table();
                table.setContainerDataSource(normalContainer);
                addComponent(table);
            }

            configure(table, footer.getValue(), sized.getValue(), expandRatios.getValue(), stripes.getValue(),
                    verticalLines.getValue(), horizontalLines.getValue(), borderless.getValue(),
                    headers.getValue(), compact.getValue(), small.getValue(), rowIndex.getValue(),
                    rowCaption.getValue(), rowIcon.getValue(), componentsInCells.getValue());
        }
    };

    hierarchical.addValueChangeListener(update);
    footer.addValueChangeListener(update);
    sized.addValueChangeListener(update);
    expandRatios.addValueChangeListener(update);
    stripes.addValueChangeListener(update);
    verticalLines.addValueChangeListener(update);
    horizontalLines.addValueChangeListener(update);
    borderless.addValueChangeListener(update);
    headers.addValueChangeListener(update);
    compact.addValueChangeListener(update);
    small.addValueChangeListener(update);
    rowIndex.addValueChangeListener(update);
    rowCaption.addValueChangeListener(update);
    rowIcon.addValueChangeListener(update);
    componentsInCells.addValueChangeListener(update);

    footer.setValue(false);

}

From source file:com.cavisson.gui.dashboard.components.controls.Tabsheets.java

License:Apache License

public Tabsheets() {
    setMargin(true);/*from   w  w w .j a va 2 s.  com*/

    Label h1 = new Label("Tabs");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.setSpacing(true);
    wrap.addStyleName("wrapping");
    addComponent(wrap);

    final CheckBox closable = new CheckBox("Closable");
    closable.setImmediate(true);
    wrap.addComponent(closable);

    final CheckBox overflow = new CheckBox("Overflow");
    overflow.setImmediate(true);
    wrap.addComponent(overflow);

    final CheckBox caption = new CheckBox("Captions", true);
    caption.setImmediate(true);
    wrap.addComponent(caption);

    final CheckBox icon = new CheckBox("Icons");
    icon.setImmediate(true);
    wrap.addComponent(icon);

    final CheckBox disable = new CheckBox("Disable tabs");
    disable.setImmediate(true);
    wrap.addComponent(disable);

    Label h3 = new Label("Additional Styles");
    h3.addStyleName("h3");
    addComponent(h3);

    wrap = new HorizontalLayout();
    wrap.setSpacing(true);
    wrap.addStyleName("wrapping");
    wrap.setMargin(new MarginInfo(false, false, true, false));
    addComponent(wrap);

    final CheckBox framed = new CheckBox("Framed", true);
    framed.setImmediate(true);
    wrap.addComponent(framed);

    final CheckBox centered = new CheckBox("Centered tabs");
    centered.setImmediate(true);
    wrap.addComponent(centered);

    final CheckBox rightAlign = new CheckBox("Right-aligned tabs");
    rightAlign.setImmediate(true);
    wrap.addComponent(rightAlign);

    final CheckBox equal = new CheckBox("Equal-width tabs");
    equal.setImmediate(true);
    wrap.addComponent(equal);

    final CheckBox padded = new CheckBox("Padded tabbar");
    padded.setImmediate(true);
    wrap.addComponent(padded);

    final CheckBox compact = new CheckBox("Compact");
    compact.setImmediate(true);
    wrap.addComponent(compact);

    final CheckBox iconsOnTop = new CheckBox("Icons on top");
    iconsOnTop.setImmediate(true);
    wrap.addComponent(iconsOnTop);

    final CheckBox selectedOnly = new CheckBox("Selected tab closable");
    selectedOnly.setImmediate(true);
    wrap.addComponent(selectedOnly);

    ValueChangeListener update = new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            String style = framed.getValue() ? "framed " : "";
            style += centered.getValue() ? " centered-tabs" : "";
            style += rightAlign.getValue() ? " right-aligned-tabs" : "";
            style += equal.getValue() ? " equal-width-tabs" : "";
            style += padded.getValue() ? " padded-tabbar" : "";
            style += compact.getValue() ? " compact-tabbar" : "";
            style += iconsOnTop.getValue() ? " icons-on-top" : "";
            style += selectedOnly.getValue() ? " only-selected-closable" : "";

            if (tabs != null) {
                removeComponent(tabs);
            }
            tabs = getTabSheet(caption.getValue(), style.trim(), closable.getValue(), overflow.getValue(),
                    icon.getValue(), disable.getValue());
            addComponent(tabs);
        }
    };
    closable.addValueChangeListener(update);
    overflow.addValueChangeListener(update);
    caption.addValueChangeListener(update);
    icon.addValueChangeListener(update);
    disable.addValueChangeListener(update);
    framed.addValueChangeListener(update);
    centered.addValueChangeListener(update);
    rightAlign.addValueChangeListener(update);
    equal.addValueChangeListener(update);
    padded.addValueChangeListener(update);
    compact.addValueChangeListener(update);
    iconsOnTop.addValueChangeListener(update);
    selectedOnly.addValueChangeListener(update);

    // Generate initial view
    icon.setValue(true);
}

From source file:com.cavisson.gui.dashboard.components.controls.TextFields.java

License:Apache License

public TextFields() {
    setMargin(true);//w  w w. j a v a 2s.  c o m

    Label h1 = new Label("Text Fields");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    TextField tf = new TextField("Normal");
    tf.setInputPrompt("First name");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Custom color");
    tf.setInputPrompt("Email");
    tf.addStyleName("color1");
    row.addComponent(tf);

    tf = new TextField("User Color");
    tf.setInputPrompt("Gender");
    tf.addStyleName("color2");
    row.addComponent(tf);

    tf = new TextField("Themed");
    tf.setInputPrompt("Age");
    tf.addStyleName("color3");
    row.addComponent(tf);

    tf = new TextField("Error");
    tf.setValue("Somethings wrong");
    tf.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(tf);

    tf = new TextField("Error, borderless");
    tf.setValue("Somethings wrong");
    tf.setComponentError(new UserError("Fix it, now!"));
    tf.addStyleName("borderless");
    row.addComponent(tf);

    tf = new TextField("Read-only");
    tf.setInputPrompt("Nationality");
    tf.setValue("Finnish");
    tf.setReadOnly(true);
    row.addComponent(tf);

    tf = new TextField("Small");
    tf.setValue("Field value");
    tf.addStyleName("small");
    row.addComponent(tf);

    tf = new TextField("Large");
    tf.setValue("Field value");
    tf.addStyleName("large");
    tf.setIcon(testIcon.get(true));
    row.addComponent(tf);

    tf = new TextField("Icon inside");
    tf.setInputPrompt("Ooh, an icon");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Large, Icon inside");
    tf.setInputPrompt("Ooh, an icon");
    tf.addStyleName("large");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Small, Icon inside");
    tf.setInputPrompt("Ooh, an icon");
    tf.addStyleName("small");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("16px supported by default");
    tf.setInputPrompt("Image icon");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get(true, 16));
    row.addComponent(tf);

    tf = new TextField();
    tf.setValue("Font, no caption");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField();
    tf.setValue("Image, no caption");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get(true, 16));
    row.addComponent(tf);

    CssLayout group = new CssLayout();
    group.addStyleName("v-component-group");
    row.addComponent(group);

    tf = new TextField();
    tf.setInputPrompt("Grouped with a button");
    tf.addStyleName("inline-icon");
    tf.setIcon(testIcon.get());
    tf.setWidth("260px");
    group.addComponent(tf);

    Button button = new Button("Do It");
    // button.addStyleName("primary");
    group.addComponent(button);

    tf = new TextField("Borderless");
    tf.setInputPrompt("Write here");
    tf.addStyleName("inline-icon");
    tf.addStyleName("borderless");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Right-aligned");
    tf.setValue("1,234");
    tf.addStyleName("align-right");
    row.addComponent(tf);

    tf = new TextField("Centered");
    tf.setInputPrompt("Guess what?");
    tf.addStyleName("align-center");
    row.addComponent(tf);

    PasswordField pwf = new PasswordField("Password");
    pwf.setInputPrompt("Secret words");
    pwf.addStyleName("inline-icon");
    pwf.setIcon(FontAwesome.LOCK);
    row.addComponent(pwf);

    pwf = new PasswordField("Password, right-aligned");
    pwf.setInputPrompt("Secret words");
    pwf.addStyleName("inline-icon");
    pwf.addStyleName("align-right");
    pwf.setIcon(FontAwesome.LOCK);
    row.addComponent(pwf);

    pwf = new PasswordField("Password, centered");
    pwf.setInputPrompt("Secret words");
    pwf.addStyleName("inline-icon");
    pwf.addStyleName("align-center");
    pwf.setIcon(FontAwesome.LOCK);
    row.addComponent(pwf);

    tf = new TextField("Tiny");
    tf.setValue("Field value");
    tf.addStyleName("tiny");
    row.addComponent(tf);

    tf = new TextField("Huge");
    tf.setValue("Field value");
    tf.addStyleName("huge");
    row.addComponent(tf);

    h1 = new Label("Text Areas");
    h1.addStyleName("h1");
    addComponent(h1);

    row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    TextArea ta = new TextArea("Normal");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Inline icon");
    ta.setInputPrompt("Inline icon not really working");
    ta.addStyleName("inline-icon");
    ta.setIcon(testIcon.get());
    row.addComponent(ta);

    ta = new TextArea("Custom color");
    ta.addStyleName("color1");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Custom color, read-only");
    ta.addStyleName("color2");
    ta.setValue("Field value, spanning multiple lines of text");
    ta.setReadOnly(true);
    row.addComponent(ta);

    ta = new TextArea("Custom color");
    ta.addStyleName("color3");
    ta.setValue("Field value, spanning multiple lines of text");
    row.addComponent(ta);

    ta = new TextArea("Small");
    ta.addStyleName("small");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Large");
    ta.addStyleName("large");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Borderless");
    ta.addStyleName("borderless");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Right-aligned");
    ta.addStyleName("align-right");
    ta.setValue("Field value, spanning multiple lines of text");
    row.addComponent(ta);

    ta = new TextArea("Centered");
    ta.addStyleName("align-center");
    ta.setValue("Field value, spanning multiple lines of text");
    row.addComponent(ta);

    ta = new TextArea("Tiny");
    ta.addStyleName("tiny");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    ta = new TextArea("Huge");
    ta.addStyleName("huge");
    ta.setInputPrompt("Write your comment");
    row.addComponent(ta);

    RichTextArea rta = new RichTextArea();
    rta.setValue("<b>Some</b> <i>rich</i> content");
    row.addComponent(rta);

    rta = new RichTextArea("Read-only");
    rta.setValue("<b>Some</b> <i>rich</i> content");
    rta.setReadOnly(true);
    row.addComponent(rta);
}

From source file:com.cms.component.CustomPageTable.java

public HorizontalLayout createControls(String pageSizeDefault) {
    this.pageSizeDefault = pageSizeDefault;
    separatorTotal.setImmediate(true);//  w w  w .java 2s.com
    Label itemsPerPageLabel = new Label(BundleUtils.getString("common.table.numberRecord"));

    for (String numberSize : Constants.PAGE_SIZE_LIST) {
        itemsPerPageSelect.addItem(numberSize);
    }
    itemsPerPageSelect.setImmediate(true);
    itemsPerPageSelect.setNullSelectionAllowed(false);
    itemsPerPageSelect.setWidth("50px");
    itemsPerPageSelect.addValueChangeListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = -2255853716069800092L;

        @Override
        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            setPageLength(Integer.valueOf(String.valueOf(event.getProperty().getValue())));
            firePagedChangedEvent();
        }
    });
    itemsPerPageSelect.select(pageSizeDefault);
    Label pageLabel = new Label(BundleUtils.getString("common.table.page"), ContentMode.HTML);
    final TextField currentPageTextField = new TextField();
    currentPageTextField.setValue(String.valueOf(getCurrentPage()));
    currentPageTextField.setConverter(Integer.class);
    currentPageTextField
            .addValidator(new IntegerRangeValidator("Wrong page number", 1, getTotalAmountOfPages()));
    Label separatorLabel = new Label("&nbsp;/&nbsp;", ContentMode.HTML);
    final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), ContentMode.HTML);
    currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL);
    currentPageTextField.setImmediate(true);
    currentPageTextField.addValueChangeListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = -2255853716069800092L;

        @Override
        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            currentPageTextField.removeAllValidators();
            currentPageTextField
                    .addValidator(new IntegerRangeValidator("Wrong page number", 1, getTotalAmountOfPages()));
            if (Integer.valueOf(String.valueOf(currentPageTextField.getValue())) <= getTotalAmountOfPages()) {
                int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue()));
                setCurrentPage(page);
            }
        }
    });
    pageLabel.setWidth(null);
    currentPageTextField.setWidth("30px");
    separatorLabel.setWidth(null);
    totalPagesLabel.setWidth(null);

    HorizontalLayout controlBar = new HorizontalLayout();
    HorizontalLayout pageSize = new HorizontalLayout();
    HorizontalLayout pageManagement = new HorizontalLayout();
    final Button first = new Button("<<", new Button.ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            setCurrentPage(0);
        }
    });
    previous = new Button("<", new Button.ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            previousPage();
        }
    });
    final Button next = new Button(">", new Button.ClickListener() {
        private static final long serialVersionUID = -1927138212640638452L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            nextPage();
        }
    });
    final Button last = new Button(">>", new Button.ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            setCurrentPage(getTotalAmountOfPages());
        }
    });
    first.setStyleName(Reindeer.BUTTON_LINK);
    previous.setStyleName(Reindeer.BUTTON_LINK);
    next.setStyleName(Reindeer.BUTTON_LINK);
    last.setStyleName(Reindeer.BUTTON_LINK);

    itemsPerPageLabel.addStyleName("pagedtable-itemsperpagecaption");
    itemsPerPageSelect.addStyleName("pagedtable-itemsperpagecombobox");
    pageLabel.addStyleName("pagedtable-pagecaption");
    currentPageTextField.addStyleName("pagedtable-pagefield");
    separatorLabel.addStyleName("pagedtable-separator");
    separatorTotal.addStyleName("pagedtable-separator");
    totalPagesLabel.addStyleName("pagedtable-total");
    first.addStyleName("pagedtable-first");
    previous.addStyleName("pagedtable-previous");
    next.addStyleName("pagedtable-next");
    last.addStyleName("pagedtable-last");

    itemsPerPageLabel.addStyleName("pagedtable-label");
    itemsPerPageSelect.addStyleName("pagedtable-combobox");
    pageLabel.addStyleName("pagedtable-label");
    currentPageTextField.addStyleName("pagedtable-label");
    separatorLabel.addStyleName("pagedtable-label");
    separatorTotal.addStyleName("pagedtable-label");
    totalPagesLabel.addStyleName("pagedtable-label");
    first.addStyleName("pagedtable-button");
    previous.addStyleName("pagedtable-button");
    next.addStyleName("pagedtable-button");
    last.addStyleName("pagedtable-button");

    pageSize.addComponent(itemsPerPageLabel);
    pageSize.addComponent(itemsPerPageSelect);
    Label separator = new Label("&nbsp;/&nbsp;", ContentMode.HTML);
    pageSize.addComponent(separator);
    pageSize.addComponent(separatorTotal);
    pageSize.setComponentAlignment(itemsPerPageLabel, Alignment.MIDDLE_LEFT);
    pageSize.setComponentAlignment(itemsPerPageSelect, Alignment.MIDDLE_LEFT);
    pageSize.setComponentAlignment(separator, Alignment.MIDDLE_LEFT);
    pageSize.setComponentAlignment(separatorTotal, Alignment.MIDDLE_LEFT);
    pageSize.setSpacing(true);
    pageManagement.addComponent(first);
    pageManagement.addComponent(previous);
    pageManagement.addComponent(pageLabel);
    pageManagement.addComponent(currentPageTextField);
    pageManagement.addComponent(separatorLabel);
    pageManagement.addComponent(totalPagesLabel);
    pageManagement.addComponent(next);
    pageManagement.addComponent(last);
    pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT);
    pageManagement.setWidth(null);
    pageManagement.setSpacing(true);
    controlBar.addComponent(pageSize);
    controlBar.addComponent(pageManagement);
    controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER);
    controlBar.setWidth("100%");
    controlBar.setExpandRatio(pageSize, 1);
    addListener(new PageChangeListener() {
        @Override
        public void pageChanged(PagedTableChangeEvent event) {
            int abc = event.getCurrentPage();
            first.setEnabled(container.getStartIndex() > 0);
            previous.setEnabled(container.getStartIndex() > 0);
            next.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength());
            last.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength());
            currentPageTextField.setValue(String.valueOf(getCurrentPage()));
            totalPagesLabel.setValue(String.valueOf(getTotalAmountOfPages()));
            if (resizePage) {
                int lenght = getPageLength();
                int a = lenght % 5;
                int b = lenght / 5;
                if (a != 0) {
                    int pageLenght = 5 * (b + 1);
                    itemsPerPageSelect.setValue(pageLenght);
                }
            }
            separatorTotal.setValue(String.valueOf(container.getRealSize()));
        }
    });
    return controlBar;
}

From source file:com.cms.component.WindowProgress.java

public WindowProgress(String caption) {
    setClosable(false);//from   ww w.j  a  va 2  s .c om
    setReadOnly(true);
    setResizable(false);
    setWidth("-1px");
    setHeight("-1px");
    setModal(true);
    //        setStyleName("loading-window");
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setWidth("-1px");
    horizontalLayout.setHeight("-1px");
    horizontalLayout.setSpacing(true);
    horizontalLayout.setMargin(true);

    pb = new ProgressBar();
    pb.setIndeterminate(true);
    lb = new Label();
    lb.setValue(BundleUtils.getString("Running"));
    horizontalLayout.addComponent(pb);
    horizontalLayout.addComponent(lb);

    setContent(horizontalLayout);
}

From source file:com.cms.component.WindowProgress.java

public WindowProgress() {
    setClosable(false);// w w  w.j  av  a  2 s .  c om
    setReadOnly(true);
    setResizable(false);
    setWidth("-1px");
    setHeight("-1px");
    setModal(true);
    //        setStyleName("loading-window");
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setWidth("-1px");
    horizontalLayout.setHeight("-1px");
    horizontalLayout.setSpacing(true);
    horizontalLayout.setMargin(true);

    pb = new ProgressBar();
    pb.setIndeterminate(true);
    lb = new Label();
    lb.setValue(BundleUtils.getString("Running"));
    horizontalLayout.addComponent(pb);
    horizontalLayout.addComponent(lb);

    setContent(horizontalLayout);
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildInfoItem(String caption, Object value) {
    Label captionLabel = new Label(caption);
    captionLabel.addStyleName(ValoTheme.LABEL_BOLD);

    Label valueLabel = value instanceof LocalDate ? new LocalDateLabel((LocalDate) value)
            : new Label(value.toString());

    HorizontalLayout layout = new HorizontalLayout(captionLabel, valueLabel);
    layout.setSpacing(true);

    return layout;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildAvailableUpdateLayout() {
    Label message = new Label($("UpdateManagerViewImpl.updateAvailable", presenter.getUpdateVersion()));
    message.addStyleName(ValoTheme.LABEL_BOLD);

    Button update = new LinkButton($("UpdateManagerViewImpl.updateButton")) {
        @Override//from w ww. j  a  v a  2 s  .  c  om
        protected void buttonClick(ClickEvent event) {
            UI.getCurrent().access(new Thread(UpdateManagerViewImpl.class.getName() + "-updateFromServer") {
                @Override
                public void run() {
                    presenter.updateFromServer();
                }
            });
        }
    };
    update.setVisible(presenter.isUpdateEnabled());

    HorizontalLayout updater = new HorizontalLayout(message, update);
    updater.setComponentAlignment(message, Alignment.MIDDLE_LEFT);
    updater.setComponentAlignment(update, Alignment.MIDDLE_LEFT);
    updater.setSpacing(true);

    Label changelog = new Label(presenter.getChangelog(), ContentMode.HTML);

    VerticalLayout layout = new VerticalLayout(updater, changelog);
    layout.setSpacing(true);
    layout.setWidth("100%");

    return layout;
}

From source file:com.dungnv.streetfood.ui.CommonSearchPagedUI.java

private final void init() {

    setWidth("100%");
    setStyleName("item-search-box");
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    this.addComponent(layout);

    FormLayout form = new FormLayout();
    //        form.setWidth("100%");
    form.setMargin(false);/* ww w  .  ja va 2  s .co  m*/
    layout.addComponent(form);
    layout.setComponentAlignment(form, Alignment.MIDDLE_CENTER);

    cbRecordPerPage = new ComboBox();
    cbRecordPerPage.setWidth("65px");
    cbRecordPerPage.setStyleName(ValoTheme.COMBOBOX_TINY);
    cbRecordPerPage.setCaption(BundleUtils.getLanguage("lbl.recordsPerPage"));
    cbRecordPerPage.setTextInputAllowed(false);
    cbRecordPerPage.addItem(10);
    cbRecordPerPage.addItem(20);
    cbRecordPerPage.addItem(30);
    cbRecordPerPage.addItem(50);
    cbRecordPerPage.addItem(100);
    cbRecordPerPage.addItem(200);
    cbRecordPerPage.select(10);
    form.addComponent(cbRecordPerPage);
    cbRecordPerPage.setNullSelectionAllowed(false);

    btnFastBackward = new Button();
    btnFastBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFastBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFastBackward.setIcon(FontAwesome.FAST_BACKWARD);
    layout.addComponent(btnFastBackward);
    layout.setComponentAlignment(btnFastBackward, Alignment.MIDDLE_CENTER);

    btnBackward = new Button();
    btnBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnBackward.setIcon(FontAwesome.BACKWARD);
    layout.addComponent(btnBackward);
    layout.setComponentAlignment(btnBackward, Alignment.MIDDLE_CENTER);

    cbPaged = new ComboBox();
    cbPaged.setTextInputAllowed(false);
    for (int i = 1; i <= pageCount; i++) {
        cbPaged.addItem(i);
    }

    cbPaged.setNullSelectionAllowed(false);
    cbPaged.select(1);
    cbPaged.addStyleName(ValoTheme.COMBOBOX_TINY);
    cbPaged.setWidth("60px");
    layout.addComponent(cbPaged);
    layout.setComponentAlignment(cbPaged, Alignment.MIDDLE_CENTER);

    btnFoward = new Button();
    btnFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFoward.setIcon(FontAwesome.FORWARD);
    layout.addComponent(btnFoward);
    layout.setComponentAlignment(btnFoward, Alignment.MIDDLE_CENTER);

    btnFastFoward = new Button();
    btnFastFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFastFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFastFoward.setIcon(FontAwesome.FAST_FORWARD);
    layout.addComponent(btnFastFoward);
    layout.setComponentAlignment(btnFastFoward, Alignment.MIDDLE_CENTER);
    enableComponent();
}

From source file:com.dungnv.streetfood.ui.TwinColumnUI.java

public final void init() {
    setMargin(true);//from  w w  w .  ja v a  2  s. c  om
    setSpacing(true);
    setWidth(100f, Unit.PERCENTAGE);

    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setSpacing(true);
    hLayout.setWidth(100f, Unit.PERCENTAGE);
    addComponent(hLayout);

    msLeft = new MultiSelectUI(searchField);
    msLeft.setWidth(100.0f, Unit.PERCENTAGE);
    hLayout.addComponent(msLeft);
    hLayout.setExpandRatio(msLeft, .45f);

    VerticalLayout vButtonLayout = new VerticalLayout();
    vButtonLayout.setSpacing(true);
    hLayout.addComponent(vButtonLayout);
    hLayout.setExpandRatio(vButtonLayout, .1f);
    hLayout.setComponentAlignment(vButtonLayout, Alignment.BOTTOM_CENTER);

    btnLeftAll = new Button();
    btnLeftAll.setWidth(100f, Unit.PERCENTAGE);
    btnLeftAll.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT);
    vButtonLayout.addComponent(btnLeftAll);

    btnLeft = new Button();
    btnLeft.setWidth(100f, Unit.PERCENTAGE);
    btnLeft.setIcon(FontAwesome.ANGLE_LEFT);
    vButtonLayout.addComponent(btnLeft);

    btnRight = new Button();
    btnRight.setWidth(100f, Unit.PERCENTAGE);
    btnRight.setIcon(FontAwesome.ANGLE_RIGHT);
    vButtonLayout.addComponent(btnRight);

    btnRightAll = new Button();
    btnRightAll.setWidth(100f, Unit.PERCENTAGE);
    btnRightAll.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT);
    vButtonLayout.addComponent(btnRightAll);

    msRight = new MultiSelectUI(searchField);
    msRight.setWidth(100.0f, Unit.PERCENTAGE);
    hLayout.addComponent(msRight);
    hLayout.setExpandRatio(msRight, .45f);

    HorizontalLayout hlButtonFooter = new HorizontalLayout();
    hlButtonFooter.setSpacing(true);
    addComponent(hlButtonFooter);
    setComponentAlignment(hlButtonFooter, Alignment.BOTTOM_RIGHT);

    btnSave = new Button(BundleUtils.getLanguage("lbl.save"), FontAwesome.SAVE);
    hlButtonFooter.addComponent(btnSave);

    btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN);
    hlButtonFooter.addComponent(btnCancel);
}