Example usage for com.vaadin.ui FormLayout setResponsive

List of usage examples for com.vaadin.ui FormLayout setResponsive

Introduction

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

Prototype

public void setResponsive(boolean responsive) 

Source Link

Document

Toggles responsiveness of this component.

Usage

From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java

License:Open Source License

private void initComponents() {
    removeAllComponents();//from ww  w.  j  av  a  2s  .co m

    fieldGroup = new BeanFieldGroup<Vcf2fastaInputBean>(Vcf2fastaInputBean.class);
    vcf2fastaInputBean = new Vcf2fastaInputBean(config);
    fieldGroup.setItemDataSource(vcf2fastaInputBean);

    FormLayout layout = new FormLayout();
    layout.setResponsive(true);
    layout.setMargin(true);
    layout.setWidth("100%");
    //layout.addStyleName("light");
    layout.setImmediate(true);
    addComponent(layout);

    Label section1;
    final ComboBox analysis_combo;
    final ComboBox accession_combo;
    Label section2;
    ComboBox contig_combo;
    TextField interval;
    Label section3;
    Component buttonLayout;
    Component progressLayout;

    section1 = new Label("Input");
    section1.addStyleName("h3 colored");
    layout.addComponent(section1);
    analysis_combo = getComboBox(ANALYSIS_CAPTION, ANALYSIS, getAnalysesList(), false);
    layout.addComponent(analysis_combo);
    accession_combo = getComboBox(ACCESSION_CAPTION, ACCESSION,
            getAccessionsList("Cassava 6.1 WGS Bredeson 61 accessions"), false);
    layout.addComponent(accession_combo);

    analysis_combo.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            accession_combo.setContainerDataSource(getAccessionsList((String) analysis_combo.getValue()));
            accession_combo.select(accession_combo.getContainerDataSource().getItemIds().iterator().next());
        }
    });

    section2 = new Label("Parameters");
    section2.addStyleName("h3 colored");
    layout.addComponent(section2);
    contig_combo = getComboBox(CONTIG_CAPTION, CONTIG, getContigsList(), true);
    layout.addComponent(contig_combo);
    interval = getTextField(INTERVAL_CAPTION, INTERVAL, vcf2fastaUI.getConfig().getString("defaultInterval"),
            20);
    layout.addComponent(interval);

    section3 = new Label("Result");
    section3.addStyleName("h3 colored");
    layout.addComponent(section3);
    resultLayout = new VerticalLayout();
    resultLayout.setSizeFull();
    resultLayout.setMargin(true);
    resultLayout.setSpacing(true);
    resultLayout.addStyleName("light");
    layout.addComponent(resultLayout);

    layout.addComponent(new Label(""));

    buttonLayout = getSubmitLayout();
    layout.addComponent(buttonLayout);
    progressLayout = getProgressLayout();
    layout.addComponent(progressLayout);

    initCommitHandler();
}