Example usage for com.vaadin.ui HorizontalLayout HorizontalLayout

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

Introduction

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

Prototype

public HorizontalLayout() 

Source Link

Document

Constructs an empty HorizontalLayout.

Usage

From source file:com.foc.vaadin.gui.windows.EditFieldsWindow.java

License:Apache License

public EditFieldsWindow() {

    setModal(true);//  w ww .j a v  a 2  s.  c o m
    setWidth("400px");
    setCaption("Component Editor");

    mainLayout = new VerticalLayout();
    buttonsLayout = new HorizontalLayout();
    tabLayout = new FVTabbedLayout(null);
    tabLayout.setSizeFull();

    add = new Button("Add Field");
    save = new Button("Save Changes");
    cancel = new Button("Cancel");

    initButtons();

    mainLayout.setSpacing(true);

    buttonsLayout.setMargin(true);
    buttonsLayout.setSpacing(true);
    buttonsLayout.addComponent(add);
    buttonsLayout.addComponent(save);
    buttonsLayout.addComponent(cancel);

    mainLayout.addComponent(tabLayout);
    mainLayout.addComponent(buttonsLayout);
    mainLayout.setComponentAlignment(tabLayout, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER);

    setContent(mainLayout);
}

From source file:com.foc.vaadin.gui.windows.LineLabelCreator.java

License:Apache License

public LineLabelCreator(final FVLabel label) {
    setModal(true);//from  w ww  .  j  ava2  s.c o  m
    setWidth("250px");
    setHeight("200px");

    layout = new VerticalLayout();
    buttonsLayout = new HorizontalLayout();

    lineHeight = new TextField("Line Height:");
    lineWidth = new TextField("Line Width:");

    create = new Button("Create");
    cancel = new Button("Cancel");

    cancel.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });

    create.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            AttributesImpl attributes = new AttributesImpl();
            attributes.addAttribute("", "name", "name", "CDATA", "null");
            attributes.addAttribute("", "value", "value", "CDATA", " ");
            attributes.addAttribute("", "bgColor", "bgColor", "CDATA", "#CCCCCC");

            if (!lineHeight.getValue().toString().isEmpty()) {
                attributes.addAttribute("", "height", "height", "CDATA", lineHeight.getValue() + "px");
            }

            if (!lineWidth.getValue().toString().isEmpty()) {
                attributes.addAttribute("", "width", "width", "CDATA", lineWidth.getValue() + "px");
            }

            label.setAttributes(attributes);
            label.initLabel();

            label.requestRepaint();

            close();
        }
    });

    buttonsLayout.setMargin(true);
    buttonsLayout.setSpacing(true);
    buttonsLayout.addComponent(create);
    buttonsLayout.addComponent(cancel);
    layout.addComponent(lineHeight);
    layout.addComponent(lineWidth);
    layout.addComponent(buttonsLayout);
    layout.setComponentAlignment(lineHeight, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(lineWidth, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER);
    setContent(layout);
}

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 ww.j av  a 2  s.  c  o m*/

        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);//from   w w  w  .ja  v  a  2  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. ja va  2  s. 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  ww  .ja va 2s .  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.common.ApplicationLayout.java

License:Apache License

/**
  * Initializes view layout when system enters 'initView' action state.
  *//w w  w  .ja  v  a 2s  . c  o  m
  * @param event -  state event.
  */
public void initView(@SuppressWarnings("rawtypes") StateEvent event) {
    final HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();
    content.setStyleName("main-view");

    final HorizontalSplitPanel leftSplitPanel = new HorizontalSplitPanel();
    leftSplitPanel.setSplitPosition(20, Sizeable.Unit.PERCENTAGE);

    final ComponentContainer leftSideBar = createPlaceholder(StateLayout.LEFT_SIDE_BAR);
    leftSideBar.setSizeFull();
    content.addComponent(leftSideBar, 0);

    final VerticalLayout verticalLayoutContent = new VerticalLayout();
    verticalLayoutContent.setStyleName("freebox-view");
    verticalLayoutContent.addComponent(createPlaceholder(StateLayout.HEADER));
    verticalLayoutContent.setSpacing(true);
    final ComponentContainer layoutContent = createPlaceholder(StateLayout.CONTENT);
    layoutContent.setSizeFull();
    verticalLayoutContent.addComponent(layoutContent);
    verticalLayoutContent.setSizeFull();
    //verticalLayoutContent.addComponent(createPlaceholder(StateLayout.FOOTER));

    verticalLayoutContent.setExpandRatio(layoutContent, 8f);

    content.addComponent(verticalLayoutContent, 1);
    content.setExpandRatio(leftSideBar, 1.0f);
    content.setExpandRatio(verticalLayoutContent, 9f);

    setView(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 w w.jav  a2s . c  o  m
 */
@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.garyclayburg.vconsole.VConsole.java

License:Open Source License

private HorizontalLayout createTop() {
    topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.setSpacing(true);/*from w w  w  .j a v a2s.c o m*/
    topLayout.addStyleName("toolbar");
    final Label title = new Label("Policy console");
    title.setSizeUndefined();
    title.addStyleName("h1");
    topLayout.addComponent(title);
    topLayout.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    topLayout.setExpandRatio(title, 1);

    policyChangeStatus = new Label("");
    policyChangeStatus.setSizeUndefined();
    policyChangeStatus.addStyleName("policyNormal");
    topLayout.addComponent(policyChangeStatus);
    topLayout.setComponentAlignment(policyChangeStatus, Alignment.MIDDLE_LEFT);

    createNotifyButton();
    topLayout.addComponent(notify);
    topLayout.setComponentAlignment(notify, Alignment.MIDDLE_LEFT);
    return topLayout;
}

From source file:com.github.carljmosca.MainLayout.java

public MainLayout() {
    personProcessor = new PersonProcessor();
    //mainLayout = new VerticalLayout();
    personLayout = new HorizontalLayout();
    //buttonLayout = new HorizontalLayout();
    person = new Person();
    init();/*from  w w w . ja  v a 2s  .  c  o m*/
}