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.fnc.view.ui.AlphaListMainUI.java

public AlphaListMainUI() {
    setSizeFull();//  w  ww .ja va  2s . com
    setMargin(true);

    addComponent(buildForms());

    HorizontalLayout h = new HorizontalLayout();
    h.setWidthUndefined();
    h.setSpacing(true);

    progress.setWidth("150px");
    h.addComponent(progress);
    h.setComponentAlignment(progress, Alignment.MIDDLE_LEFT);

    status.setValue("0%");
    h.addComponent(status);

    addComponent(h);
    addComponent(grid);
}

From source file:com.fnc.view.ui.AlphaListMainUI.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("50%");

    corporation.setCaption("Corporation: ");
    corporation.addStyleName(ValoTheme.COMBOBOX_SMALL);
    trade.setCaption("Trade: ");
    trade.addStyleName(ValoTheme.COMBOBOX_SMALL);
    branch.setCaption("Branch: ");
    branch.addStyleName(ValoTheme.COMBOBOX_SMALL);

    corporation.addValueChangeListener(new CorporateComboBoxPropertyListener(trade, trade.getCaption()));
    form.addComponent(corporation);//  w  w  w .jav  a  2  s  .  c  o m

    trade.addValueChangeListener(new CorporateComboBoxPropertyListener(branch, branch.getCaption()));
    form.addComponent(trade);

    branch.addValueChangeListener(branchPropertyChangeListener);
    form.addComponent(branch);

    HorizontalLayout h = new HorizontalLayout();
    h.setCaption("Year: ");
    h.setWidth("100%");
    h.setSpacing(true);

    h.addComponent(selectYear());
    h.addComponent(alphaListButton());

    form.addComponent(h);

    return form;
}

From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java

public ThirteenthMonthUI() {
    setSizeFull();//from   w  w  w .  j av  a2  s . c o m
    setMargin(true);

    addComponent(buildForms());

    HorizontalLayout h = new HorizontalLayout();
    h.setWidthUndefined();
    h.setSpacing(true);

    progress.setWidth("150px");
    h.addComponent(progress);
    h.setComponentAlignment(progress, Alignment.MIDDLE_LEFT);

    status.setValue("0%");
    h.addComponent(status);

    addComponent(h);
}

From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("50%");

    corporation.setCaption("Corporation: ");
    corporation.addStyleName(ValoTheme.COMBOBOX_SMALL);
    trade.setCaption("Trade: ");
    trade.addStyleName(ValoTheme.COMBOBOX_SMALL);
    branch.setCaption("Branch: ");
    branch.addStyleName(ValoTheme.COMBOBOX_SMALL);

    corporation.addValueChangeListener(new CorporateComboBoxPropertyListener(trade, trade.getCaption()));
    form.addComponent(corporation);/*from  w  w  w  . ja  v a  2 s  .  c  om*/

    trade.addValueChangeListener(new CorporateComboBoxPropertyListener(branch, branch.getCaption()));
    form.addComponent(trade);

    branch.addValueChangeListener(branchPropertyChangeListener);
    form.addComponent(branch);

    HorizontalLayout h = new HorizontalLayout();
    h.setCaption("Year: ");
    h.setWidth("100%");
    h.setSpacing(true);

    h.addComponent(selectYear());
    h.addComponent(button());

    form.addComponent(h);

    return form;
}

From source file:com.foc.web.modules.photoAlbum.PhotoAlbum_Thumb_Table.java

License:Apache License

private void redrawPhotos() {
    FVVerticalLayout vLay = getMainVerticalLayout();
    if (vLay != null) {
        vLay.removeAllComponents();//w w w .  j  a  v  a 2s  .  com

        HorizontalLayout hLay = null;

        int nbrPhotos = 0;

        PhotoAlbumListWithFilter list = (PhotoAlbumListWithFilter) getFocList();
        if (list != null && list.getFocListFilter() != null) {
            list.getFocListFilter().setActive(true);
            for (int i = 0; i < list.size(); i++) {
                PhotoAlbum photo = (PhotoAlbum) list.getFocObject(i);
                FocXMLAttributes attribs = new FocXMLAttributes();
                attribs.addAttribute(FXML.ATT_WIDTH, "100px");
                attribs.addAttribute(FXML.ATT_HEIGHT, "100px");
                attribs.addAttribute(FXML.ATT_EDITABLE, "false");

                FVImageField imgField = new FVImageField(photo.getFocProperty(PhotoAlbumDesc.FLD_IMAGE),
                        attribs);

                if (!imgField.isImage()) {
                    imgField.dispose();
                } else {

                    if (nbrPhotos % 4 == 0) {//4 Photos by line
                        hLay = null;
                    }
                    nbrPhotos++;

                    if (hLay == null) {
                        hLay = new HorizontalLayout();
                        hLay.setSpacing(true);
                        vLay.addComponent(hLay);
                    }

                    if (imgField.getEmbedded() != null) {
                        imgField.addStyleName("foc-ImageFieldClickable");
                        imgField.getEmbedded().addClickListener(new PhotoClickListener(photo));
                    }
                    hLay.addComponent(imgField);
                }
            }
        }

        PhotoAlbumAppGroup group = PhotoAlbumAppGroup.getCurrentAppGroup();
        if (isEditable() && group != null && group.isAllowUpload()) {
            FVUpload_Image uploadButton = newUploadButton();
            if (uploadButton != null) {
                uploadButton.setMaxSizeAllowed(8388608);
                vLay.addComponent(uploadButton);
            }
        }
    }
}

From source file:com.foo01.components.ReservationComponent.java

public static Component build(final Reservation r) {
    final HorizontalLayout reservationComponentLayout = new HorizontalLayout();

    final VerticalLayout datesLayout = new VerticalLayout();
    Label beginningDate = new Label(
            (new SimpleDateFormat("E dd.MM.", Locale.getDefault())).format(r.getBeginning().getTime()));
    Label endingDate = new Label(
            (new SimpleDateFormat("E dd.MM.", Locale.getDefault())).format(r.getEnding().getTime()));
    beginningDate.addStyleName("datelabel");
    endingDate.addStyleName("datelabel");
    datesLayout.addComponent(beginningDate);
    datesLayout.addComponent(endingDate);
    datesLayout.setSpacing(true);/* w ww  . j av a2 s  . c o m*/
    reservationComponentLayout.addComponent(datesLayout);

    Label reservationInfoLabel = new Label(r.getUser() + "</br></br>" + r.getDescription(), ContentMode.HTML);
    reservationInfoLabel.addStyleName("informationlabel");
    reservationComponentLayout.addComponent(reservationInfoLabel);

    Label rightArrowIconLabel = new Label("</br>" + FontAwesome.CHEVRON_RIGHT.getHtml(), ContentMode.HTML);
    rightArrowIconLabel.addStyleName("rightArrowIconLabel");
    reservationComponentLayout.addComponent(rightArrowIconLabel);

    reservationComponentLayout.setSpacing(true);
    reservationComponentLayout.setWidth("100%");
    datesLayout.setWidth("85px");
    reservationInfoLabel.setSizeFull();
    rightArrowIconLabel.setHeight("100%");
    rightArrowIconLabel.setWidth("20px");
    reservationComponentLayout.setExpandRatio(reservationInfoLabel, 1.0f);

    reservationComponentLayout.addLayoutClickListener(new LayoutClickListener() {
        @Override
        public void layoutClick(LayoutClickEvent event) {
            //System.out.println(event.getClickedComponent().getParent().getId());
            ((foo01TouchKitUI) UI.getCurrent()).NAVIGATIONMANAGER.navigateTo(new ReservationView(r));
        }
    });

    return reservationComponentLayout;
}

From source file:com.foo01.ui.ReservationDetailView.java

@Override
protected final void onBecomingVisible() {
    getNavigationBar().setCaption("Detail Rezervace");

    //buttony pod navbarem
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setStyleName("buttonToolBarLayout");
    buttonsLayout.setWidth("100%");

    Button deleteButton = new Button();
    deleteButton.setCaption("SMAZAT");
    deleteButton.setWidth(null);//from w  w w  . j  a  v  a 2s  .c  o m
    buttonsLayout.addComponent(deleteButton);

    Label plug = new Label();
    buttonsLayout.addComponent(plug);

    Button saveButton = new Button();
    saveButton.setCaption("ULOIT");
    saveButton.setWidth(null);
    buttonsLayout.addComponent(saveButton);
    buttonsLayout.setExpandRatio(plug, 1.0f);
    List<Source> sourcesList = MockSource.mockSources();

    //combobox na zdroje a jmeno uzivatele
    HorizontalLayout sourceAndNameLayout = new HorizontalLayout();
    sourceAndNameLayout.setWidth("100%");
    sourceAndNameLayout.setStyleName("sourceAndNameLayout");

    NativeSelect select = new NativeSelect();
    select.setNullSelectionAllowed(false);
    System.out.println(Page.getCurrent().getBrowserWindowWidth());
    String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px";
    select.setWidth(width);
    select.addItems(sourcesList);
    for (Source s : sourcesList) {
        if (reservation.getSource().equals(s)) {
            select.select(s);
            break;
        }
    }
    sourceAndNameLayout.addComponent(select);

    Label plug2 = new Label();
    sourceAndNameLayout.addComponent(plug2);

    Label name = new Label(reservation.getUser());
    name.setWidth(null);
    sourceAndNameLayout.addComponent(name);
    sourceAndNameLayout.setExpandRatio(plug2, 1.0f);

    //datepickery
    DatePicker dateFrom = new DatePicker();
    dateFrom.setStyleName("datePickerDetailView");
    dateFrom.setValue(reservation.getBeginning());
    dateFrom.setUseNative(true);
    dateFrom.setResolution(Resolution.TIME);
    dateFrom.setWidth("100%");

    DatePicker dateTo = new DatePicker();
    dateTo.setStyleName("datePickerDetailView");
    dateTo.setValue(reservation.getEnding());
    dateTo.setUseNative(true);
    dateTo.setResolution(Resolution.TIME);
    dateTo.setWidth("100%");

    //layout pro slider a popisky
    HorizontalLayout sliderLayout = new HorizontalLayout();
    sliderLayout.setStyleName("sliderLayout");
    sliderLayout.setWidth("100%");
    sliderLayout.setSpacing(true);

    Label sliderCaption = new Label("Po?et: ");
    sliderCaption.addStyleName("sliderCaption");
    sliderCaption.setWidth(null);
    sliderLayout.addComponent(sliderCaption);

    final Label horvalue = new Label();
    horvalue.setWidth("45px");
    horvalue.setStyleName("value");
    sliderLayout.addComponent(horvalue);

    final Slider horslider = new Slider(1, 10);
    horslider.setOrientation(SliderOrientation.HORIZONTAL);
    horslider.setValue(Double.valueOf(1));
    horslider.getState();
    horslider.getValue();
    horslider.setImmediate(true);
    horslider.setWidth("100%");
    sliderLayout.addComponent(horslider);
    sliderLayout.setExpandRatio(horslider, 1.0f);

    horvalue.setValue(String.valueOf(horslider.getValue().intValue()));

    horslider.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            int value = horslider.getValue().intValue();

            horvalue.setValue(String.valueOf(value));
        }
    });

    //switch schvaleno
    HorizontalLayout switchLayout = new HorizontalLayout();
    switchLayout.setStyleName("switchLayout");
    switchLayout.addComponent(new Label("Schvleno:"));
    switchLayout.setSpacing(true);
    Switch checkbox = new Switch(null, true);
    switchLayout.addComponent(checkbox);

    //popis rezervace
    TextArea description = new TextArea();
    description.setStyleName("descriptionDetailView");

    description.setWidth("100%");
    description.setImmediate(false);
    description.setCaption("Popis:");
    description.setValue(reservation.getDescription());
    //description.setRequired(true);
    description.setRequiredError("Popis mus bt zadn!");
    description.setNullRepresentation("");
    description.setReadOnly(true);
    //description.setRows(0);

    final VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    content.setStyleName(width);
    content.addComponent(buttonsLayout);
    content.addComponent(sourceAndNameLayout);
    content.addComponent(dateFrom);
    content.addComponent(dateTo);

    content.addComponent(sliderLayout);
    content.addComponent(switchLayout);
    content.addComponent(description);

    setContent(content);
}

From source file:com.foo01.ui.ReservationView.java

@Override
protected final void onBecomingVisible() {
    getNavigationBar().setCaption("Detail Rezervace");

    //buttony pod navbarem
    //        HorizontalLayout buttonsLayout = new HorizontalLayout();
    //        buttonsLayout.setStyleName("buttonToolBarLayout");
    //        buttonsLayout.setWidth("100%");
    ///*from  w  w  w  .j  av a  2 s . co  m*/
    //        Button deleteButton = new Button();
    //        deleteButton.setCaption("SMAZAT");
    //        deleteButton.setWidth(null);
    //        buttonsLayout.addComponent(deleteButton);
    //
    //        Label plug = new Label();
    //        buttonsLayout.addComponent(plug);
    //
    //        Button saveButton = new Button();
    //        saveButton.setCaption("ULOIT");
    //        saveButton.setWidth(null);
    //        buttonsLayout.addComponent(saveButton);
    //        buttonsLayout.setExpandRatio(plug, 1.0f);  

    //combobox na zdroje a jmeno uzivatele
    List<Source> sourcesList = MockSource.mockSources();
    HorizontalLayout sourceAndNameLayout = new HorizontalLayout();
    sourceAndNameLayout.setWidth("100%");
    sourceAndNameLayout.setStyleName("sourceAndNameLayout");

    NativeSelect select = new NativeSelect();
    select.setNullSelectionAllowed(false);
    System.out.println(Page.getCurrent().getBrowserWindowWidth());
    String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px";
    select.setWidth(width);
    select.addItems(sourcesList);
    for (Source s : sourcesList) {
        if (reservation.getSource().equals(s)) {
            select.select(s);
            break;
        }
    }
    sourceAndNameLayout.addComponent(select);

    Label plug2 = new Label();
    sourceAndNameLayout.addComponent(plug2);

    Label name = new Label(reservation.getUser());
    name.setWidth(null);
    sourceAndNameLayout.addComponent(name);
    sourceAndNameLayout.setExpandRatio(plug2, 1.0f);

    //datepickery
    DatePicker dateFrom = new DatePicker();
    dateFrom.setStyleName("datePickerDetailView");
    dateFrom.setValue(reservation.getBeginning());
    dateFrom.setUseNative(true);
    dateFrom.setResolution(Resolution.TIME);
    dateFrom.setWidth("100%");

    DatePicker dateTo = new DatePicker();
    dateTo.setStyleName("datePickerDetailView");
    dateTo.setValue(reservation.getEnding());
    dateTo.setUseNative(true);
    dateTo.setResolution(Resolution.TIME);
    dateTo.setWidth("100%");

    //layout pro slider a popisky
    HorizontalLayout sliderLayout = new HorizontalLayout();
    sliderLayout.setStyleName("sliderLayout");
    sliderLayout.setWidth("100%");
    sliderLayout.setSpacing(true);

    Label sliderCaption = new Label("Po?et: ");
    sliderCaption.addStyleName("sliderCaption");
    sliderCaption.setWidth(null);
    sliderLayout.addComponent(sliderCaption);

    final Label horvalue = new Label();
    horvalue.setWidth("45px");
    horvalue.setStyleName("value");
    sliderLayout.addComponent(horvalue);

    final Slider horslider = new Slider(1, 10);
    horslider.setOrientation(SliderOrientation.HORIZONTAL);
    horslider.setValue(Double.valueOf(1));
    horslider.getState();
    horslider.getValue();
    horslider.setImmediate(true);
    horslider.setWidth("100%");
    sliderLayout.addComponent(horslider);
    sliderLayout.setExpandRatio(horslider, 1.0f);

    horvalue.setValue(String.valueOf(horslider.getValue().intValue()));

    horslider.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            int value = horslider.getValue().intValue();

            horvalue.setValue(String.valueOf(value));
        }
    });

    //switch schvaleno
    HorizontalLayout switchLayout = new HorizontalLayout();
    switchLayout.setStyleName("switchLayout");
    switchLayout.addComponent(new Label("Schvleno:"));
    switchLayout.setSpacing(true);
    Switch checkbox = new Switch(null, true);
    switchLayout.addComponent(checkbox);

    //popis rezervace
    TextArea description = new TextArea();
    description.setStyleName("descriptionDetailView");

    description.setWidth("100%");
    description.setImmediate(false);
    description.setCaption("Popis:");
    description.setValue(reservation.getDescription());
    //description.setRequired(true);
    description.setRequiredError("Popis mus bt zadn!");
    description.setNullRepresentation("");
    description.setReadOnly(true);
    //description.setRows(0);

    final VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    content.addComponent(new ButtonToolBarLayout(this));
    content.addComponent(sourceAndNameLayout);
    content.addComponent(dateFrom);
    content.addComponent(dateTo);

    content.addComponent(sliderLayout);
    content.addComponent(switchLayout);
    content.addComponent(description);

    setContent(content);
}

From source file:com.freebox.engeneering.application.web.layout.HeaderController.java

License:Apache License

/**
 * Initializes view when system enters 'initView' action state.
 *
 * @param event -  state event.//from  w  ww . j  a v a 2  s .c  om
 */
@SuppressWarnings("rawtypes")
public void initView(StateEvent event) {
    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setSpacing(true);
    top.addStyleName("toolbar");
    setView(top);

}

From source file:com.github.carljmosca.ui.MainUI.java

private void addHeader() {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    cmbWidgets = new ComboBox();
    cmbWidgets.setContainerDataSource(widgets);
    cmbWidgets.setItemCaptionPropertyId("name");
    hl.addComponent(cmbWidgets);/*ww w  .j  a  v a 2s.  c  o m*/

    Button btnUpdate = new Button("Update", FontAwesome.ADJUST);
    btnUpdate.addClickListener((Button.ClickEvent event) -> {
        cmbWidgets.select(widgets.getIdByIndex(0));
    });
    hl.addComponent(btnUpdate);

    Button btnShow = new Button("Show", FontAwesome.DASHBOARD);
    btnShow.addClickListener((Button.ClickEvent event) -> {
        try {
            fgWidget.commit();
        } catch (FieldGroup.CommitException ex) {
            Logger.getLogger(MainUI.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println(demoAppData.getSelectedWidget().getName());
    });
    hl.addComponent(btnShow);

    Button btnChange = new Button("Change", FontAwesome.REFRESH);
    btnChange.addClickListener((Button.ClickEvent event) -> {
        Widget widget = (Widget) biDemoAppData.getItemProperty("selectedWidget").getValue();
        widget.setName("test xxxx");
        System.out.println(demoAppData.getSelectedWidget().getName());
    });
    hl.addComponent(btnChange);

    mainLayout.addComponent(hl);
}