Example usage for com.vaadin.ui GridLayout setWidth

List of usage examples for com.vaadin.ui GridLayout setWidth

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:probe.com.view.body.QuantCompareDataLayout.java

private VerticalLayout initProteinsDataCapture(int width) {
    VerticalLayout proteinsDataCapturingMainLayout = new VerticalLayout();
    proteinsDataCapturingMainLayout.setSpacing(true);
    proteinsDataCapturingMainLayout.setMargin(true);
    String containerWidth = ((width * 2) + 10) + "px";
    proteinsDataCapturingMainLayout.setWidth(containerWidth);
    proteinsDataCapturingMainLayout.setSpacing(true);

    Label titleLabel = new Label("2. Insert UniProt Proteins Accessions");
    titleLabel.setContentMode(ContentMode.HTML);
    titleLabel.setStyleName("normalheader");
    titleLabel.setHeight("20px");
    proteinsDataCapturingMainLayout.addComponent(titleLabel);
    proteinsDataCapturingMainLayout.setComponentAlignment(titleLabel, Alignment.TOP_LEFT);

    GridLayout insertProteinsLayout = new GridLayout(3, 3);
    proteinsDataCapturingMainLayout.addComponent(insertProteinsLayout);
    insertProteinsLayout.setSpacing(true);
    insertProteinsLayout.setMargin(new MarginInfo(false, false, false, false));
    insertProteinsLayout.setWidth(containerWidth);

    HorizontalLayout hlo1 = new HorizontalLayout();
    hlo1.setWidth("100%");
    hlo1.setMargin(new MarginInfo(false, true, false, false));
    Label highLabel = new Label("<font color='#cc0000'>&nbsp;High</font>");
    highLabel.setWidth("40px");
    highLabel.setContentMode(ContentMode.HTML);
    hlo1.addComponent(highLabel);//  w ww.  j av  a2s .c om

    HorizontalLayout hlo2 = new HorizontalLayout();
    hlo2.setWidth("100%");
    hlo2.setMargin(new MarginInfo(false, true, false, false));
    Label stableLabel = new Label("<font color='#018df4'>&nbsp;Stable</font>");
    stableLabel.setWidth("50px");
    stableLabel.setContentMode(ContentMode.HTML);
    hlo2.addComponent(stableLabel);

    HorizontalLayout hlo3 = new HorizontalLayout();
    hlo3.setWidth("100%");
    hlo3.setMargin(new MarginInfo(false, true, false, false));
    Label lowLabel = new Label("<font color='#009900'>&nbsp;Low</font>");
    lowLabel.setWidth("40px");
    lowLabel.setContentMode(ContentMode.HTML);
    hlo3.addComponent(lowLabel);
    insertProteinsLayout.addComponent(hlo1, 0, 0);
    insertProteinsLayout.setComponentAlignment(hlo1, Alignment.MIDDLE_CENTER);
    insertProteinsLayout.addComponent(hlo2, 1, 0);
    insertProteinsLayout.setComponentAlignment(hlo2, Alignment.MIDDLE_CENTER);
    insertProteinsLayout.addComponent(hlo3, 2, 0);
    insertProteinsLayout.setComponentAlignment(hlo3, Alignment.MIDDLE_CENTER);

    highTextArea.setWidth("100%");
    highTextArea.setHeight("200px");
    insertProteinsLayout.addComponent(highTextArea, 0, 1);
    insertProteinsLayout.setComponentAlignment(highTextArea, Alignment.MIDDLE_CENTER);

    stableTextArea.setWidth("100%");
    stableTextArea.setHeight("200px");
    insertProteinsLayout.addComponent(stableTextArea, 1, 1);
    insertProteinsLayout.setComponentAlignment(stableTextArea, Alignment.MIDDLE_CENTER);

    lowTextArea.setWidth("100%");
    lowTextArea.setHeight("200px");
    insertProteinsLayout.addComponent(lowTextArea, 2, 1);
    insertProteinsLayout.setComponentAlignment(lowTextArea, Alignment.MIDDLE_CENTER);

    VerticalLayout clear1 = new VerticalLayout();
    hlo1.addComponent(clear1);
    clear1.setDescription("Clear field");
    clear1.setStyleName("clearfieldbtn");
    clear1.setWidth("20px");
    clear1.setHeight("20px");
    //        insertProteinsLayout.addComponent(clear1, 0, 2);
    hlo1.setComponentAlignment(clear1, Alignment.MIDDLE_RIGHT);
    clear1.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            highTextArea.clear();
        }
    });

    VerticalLayout clear2 = new VerticalLayout();
    hlo2.addComponent(clear2);
    clear2.setDescription("Clear field");
    clear2.setStyleName("clearfieldbtn");
    clear2.setWidth("20px");
    clear2.setHeight("20px");

    clear2.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            stableTextArea.clear();
        }
    });

    hlo2.setComponentAlignment(clear2, Alignment.MIDDLE_RIGHT);
    VerticalLayout clear3 = new VerticalLayout();
    hlo3.addComponent(clear3);
    clear3.setDescription("Clear field");
    clear3.setStyleName("clearfieldbtn");
    clear3.setWidth("20px");
    clear3.setHeight("20px");

    clear3.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            lowTextArea.clear();
        }
    });
    hlo3.setComponentAlignment(clear3, Alignment.MIDDLE_RIGHT);
    Label errorLabel = new Label();
    proteinsDataCapturingMainLayout.addComponent(errorLabel);
    HorizontalLayout btnsLayout = new HorizontalLayout();
    btnsLayout.setSpacing(true);
    btnsLayout.setMargin(new MarginInfo(true, false, false, false));

    proteinsDataCapturingMainLayout.addComponent(btnsLayout);
    proteinsDataCapturingMainLayout.setComponentAlignment(btnsLayout, Alignment.MIDDLE_RIGHT);

    Button sampleBtn = new Button("Sample");
    sampleBtn.setStyleName(Reindeer.BUTTON_SMALL);
    btnsLayout.addComponent(sampleBtn);
    sampleBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            reset();
            highTextArea.setValue(highAcc);
            lowTextArea.setValue(lowAcc);
            stableTextArea.setValue(stableAcc);
            diseaseGroupsListA.select("Group A");
            diseaseGroupsListB.select("Group B");
            compareBtn.focus();
        }
    });

    Button resetBtn = new Button("Reset");
    resetBtn.setStyleName(Reindeer.BUTTON_SMALL);
    btnsLayout.addComponent(resetBtn);
    resetBtn.setId("resetBtn");
    resetBtn.addClickListener(this);

    compareBtn = new Button("Compare");
    compareBtn.setStyleName(Reindeer.BUTTON_SMALL);
    btnsLayout.addComponent(compareBtn);
    compareBtn.setId("compareBtn");
    compareBtn.addClickListener(this);

    //        highTextArea.setValue(highAcc);
    //        lowTextArea.setValue(lowAcc);
    //        stableTextArea.setValue(stableAcc);

    return proteinsDataCapturingMainLayout;
}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.PopupRecombineDiseaseGroups.java

private void initPopupLayout() {

    int h = 0;//(default_DiseaseCat_DiseaseGroupMap.size() * 33) + 300;
    for (Map<String, String> m : default_DiseaseCat_DiseaseGroupMap.values()) {
        if (h < m.size()) {
            h = m.size();//from  w  w w .  j  a  v a  2 s .  co  m
        }
    }
    h = (h * 26) + 200;
    int w = 700;
    if (Page.getCurrent().getBrowserWindowHeight() - 280 < h) {
        h = Page.getCurrent().getBrowserWindowHeight() - 280;
    }
    if (Page.getCurrent().getBrowserWindowWidth() < w) {
        w = Page.getCurrent().getBrowserWindowWidth();
    }

    popupWindow.setWidth(w + "px");
    popupWindow.setHeight(h + "px");

    popupBodyLayout.setWidth((w - 50) + "px");

    Set<String> diseaseSet = Quant_Central_Manager.getDiseaseCategorySet();

    diseaseTypeSelectionList.setDescription("Select disease category");

    for (String disease : diseaseSet) {
        diseaseTypeSelectionList.addItem(disease);
        diseaseTypeSelectionList.setItemCaption(disease, (disease));

    }

    HorizontalLayout diseaseCategorySelectLayout = new HorizontalLayout();
    diseaseCategorySelectLayout.setWidthUndefined();
    diseaseCategorySelectLayout.setHeight("50px");
    diseaseCategorySelectLayout.setSpacing(true);
    diseaseCategorySelectLayout.setMargin(true);

    popupBodyLayout.addComponent(diseaseCategorySelectLayout);
    popupBodyLayout.setComponentAlignment(diseaseCategorySelectLayout, Alignment.TOP_LEFT);

    Label title = new Label("Disease Category");
    title.setStyleName(Reindeer.LABEL_SMALL);
    diseaseCategorySelectLayout.addComponent(title);

    diseaseCategorySelectLayout.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    diseaseTypeSelectionList.setWidth("200px");
    diseaseTypeSelectionList.setNullSelectionAllowed(false);
    diseaseTypeSelectionList.setValue("All");
    diseaseTypeSelectionList.setImmediate(true);
    diseaseCategorySelectLayout.addComponent(diseaseTypeSelectionList);
    diseaseCategorySelectLayout.setComponentAlignment(diseaseTypeSelectionList, Alignment.TOP_LEFT);
    diseaseTypeSelectionList.setStyleName("diseaseselectionlist");
    diseaseTypeSelectionList.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            boolean showAll = false;
            String value = event.getProperty().getValue().toString();
            if (value.equalsIgnoreCase("All")) {
                showAll = true;
            }
            for (String dName : diseaseGroupsGridLayoutMap.keySet()) {
                if (dName.equalsIgnoreCase(value) || showAll) {
                    diseaseGroupsGridLayoutMap.get(dName).setVisible(true);
                } else {
                    diseaseGroupsGridLayoutMap.get(dName).setVisible(false);
                }
            }

        }
    });

    VerticalLayout diseaseGroupsNamesContainer = new VerticalLayout();
    diseaseGroupsNamesContainer.setWidth("100%");
    diseaseGroupsNamesContainer.setHeightUndefined();
    popupBodyLayout.addComponent(diseaseGroupsNamesContainer);
    diseaseGroupsNamesContainer.setStyleName(Reindeer.LAYOUT_WHITE);
    GridLayout diseaseNamesHeader = new GridLayout(2, 1);
    diseaseNamesHeader.setWidth("100%");
    diseaseNamesHeader.setHeightUndefined();
    diseaseNamesHeader.setSpacing(true);
    diseaseNamesHeader.setMargin(new MarginInfo(true, false, true, false));
    diseaseGroupsNamesContainer.addComponent(diseaseNamesHeader);
    Label col1Label = new Label("Group Name");
    diseaseNamesHeader.addComponent(col1Label, 0, 0);
    col1Label.setStyleName(Reindeer.LABEL_SMALL);

    Label col2Label = new Label("Suggested Name");
    diseaseNamesHeader.addComponent(col2Label, 1, 0);
    col2Label.setStyleName(Reindeer.LABEL_SMALL);

    Panel diseaseGroupsNamesFrame = new Panel();
    diseaseGroupsNamesFrame.setWidth("100%");
    diseaseGroupsNamesFrame.setHeight((h - 200) + "px");
    diseaseGroupsNamesContainer.addComponent(diseaseGroupsNamesFrame);
    diseaseGroupsNamesFrame.setStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout diseaseNamesUpdateContainerLayout = new VerticalLayout();
    for (String diseaseCategory : diseaseSet) {
        if (diseaseCategory.equalsIgnoreCase("All")) {
            continue;
        }

        HorizontalLayout diseaseNamesUpdateContainer = initDiseaseNamesUpdateContainer(diseaseCategory);
        diseaseNamesUpdateContainerLayout.addComponent(diseaseNamesUpdateContainer);
        diseaseGroupsGridLayoutMap.put(diseaseCategory, diseaseNamesUpdateContainer);
    }
    diseaseGroupsNamesFrame.setContent(diseaseNamesUpdateContainerLayout);

    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setMargin(true);
    btnLayout.setSpacing(true);

    Button resetFiltersBtn = new Button("Reset");
    resetFiltersBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetFiltersBtn);
    resetFiltersBtn.setWidth("50px");
    resetFiltersBtn.setHeight("24px");

    resetFiltersBtn.setDescription("Reset group names to default");
    resetFiltersBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            resetToDefault();
        }
    });
    Button resetToOriginalBtn = new Button("Publications Names");
    resetToOriginalBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetToOriginalBtn);
    resetToOriginalBtn.setWidth("150px");
    resetToOriginalBtn.setHeight("24px");

    resetToOriginalBtn.setDescription("Reset group names to original publication names");
    resetToOriginalBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            resetToPublicationsNames();
        }
    });

    Button applyFilters = new Button("Update");
    applyFilters.setDescription("Update disease groups with the selected names");
    applyFilters.setPrimaryStyleName("resetbtn");
    applyFilters.setWidth("50px");
    applyFilters.setHeight("24px");

    btnLayout.addComponent(applyFilters);
    applyFilters.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            updateGroups();

        }
    });

    popupBodyLayout.addComponent(btnLayout);
    popupBodyLayout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT);
    resetToDefault();

}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.PopupRecombineDiseaseGroups.java

private HorizontalLayout initDiseaseNamesUpdateContainer(String diseaseCategory) {
    GridLayout diseaseNamesUpdateContainer = new GridLayout(2,
            (default_DiseaseCat_DiseaseGroupMap.get(diseaseCategory).size() * 2));
    diseaseNamesUpdateContainer.setWidth("100%");
    diseaseNamesUpdateContainer.setHeightUndefined();
    diseaseNamesUpdateContainer.setSpacing(false);
    diseaseNamesUpdateContainer.setMargin(new MarginInfo(false, false, false, false));

    int widthCalc = 0;
    int row = 0;/*w ww  .  ja va  2  s.c o m*/
    int col = 0;
    Map<String, ComboBox> diseaseGroupNameToListMap = new LinkedHashMap<String, ComboBox>();
    for (String diseaseGroupName : default_DiseaseCat_DiseaseGroupMap.get(diseaseCategory).keySet()) {
        //            if(!diseaseGroupName.contains(diseaseCategory))
        //                continue;
        diseaseNamesUpdateContainer.addComponent(generateLabel(diseaseGroupName, diseaseCategory), col, row);
        ComboBox list = generateLabelList(diseaseCategory);
        diseaseNamesUpdateContainer.addComponent(list, col + 1, row);
        diseaseGroupNameToListMap.put(diseaseGroupName, list);

        col = 0;
        row++;

        VerticalLayout spacer1 = new VerticalLayout();
        spacer1.setHeight("2px");
        spacer1.setWidth("300px");
        spacer1.setStyleName(Reindeer.LAYOUT_WHITE);
        diseaseNamesUpdateContainer.addComponent(spacer1, col, row);
        VerticalLayout spacer2 = new VerticalLayout();
        spacer2.setHeight("2px");
        spacer2.setWidth("300px");
        spacer2.setStyleName(Reindeer.LAYOUT_WHITE);//"lightgraylayout");
        diseaseNamesUpdateContainer.addComponent(spacer2, col + 1, row);

        col = 0;
        row++;
        widthCalc += 26;

    }
    diseaseGroupsSelectionListMap.put(diseaseCategory, diseaseGroupNameToListMap);

    //        widthCalc-=26;
    VerticalLayout diseaseLabelContainer = new VerticalLayout();

    Label label = new Label("<center><font  color='#ffffff'>" + diseaseCategory + "</font></center>");
    label.setContentMode(ContentMode.HTML);
    diseaseLabelContainer.setHeight(widthCalc + "px");
    diseaseLabelContainer.setWidth("20px");
    VerticalLayout rotateContainer = new VerticalLayout();

    rotateContainer.setWidth(widthCalc + "px");
    rotateContainer.setHeight("20px");
    diseaseLabelContainer.addComponent(rotateContainer);

    rotateContainer.setStyleName(
            "row_" + diseaseStyleMap.get(diseaseCategory.replace(" ", "_").replace("'", "-") + ("_Disease")));
    rotateContainer.addComponent(label);
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.addComponent(diseaseLabelContainer);
    layout.addComponent(diseaseNamesUpdateContainer);

    return layout;
}

From source file:probe.com.view.body.quantdatasetsoverview.quantproteinstabsheet.peptidescontainer.popupcomponents.ProteinsInformationOverviewLayout.java

private GridLayout initProteinsForm(int width) {
    GridLayout proteinsFormLayout = new GridLayout(4, 5);
    proteinsFormLayout.setMargin(new MarginInfo(false, true, false, false));
    proteinsFormLayout.setWidth(width + "px");
    proteinsFormLayout.setHeightUndefined();
    accsession = new InformationField("Accession");
    proteinsFormLayout.addComponent(accsession, 0, 0);

    name = new InformationField("Protein Name");
    proteinsFormLayout.addComponent(name, 1, 0);

    quantPeptidesNumber = new InformationField("#Quant Peptides");
    proteinsFormLayout.addComponent(quantPeptidesNumber, 2, 0);

    idPeptidesNumber = new InformationField("#Identified Peptides");
    proteinsFormLayout.addComponent(idPeptidesNumber, 3, 0);

    foldChange = new InformationField("Fold Change");
    proteinsFormLayout.addComponent(foldChange, 0, 1);
    pValue = new InformationField("p-value");
    proteinsFormLayout.addComponent(pValue, 1, 1);

    pvalueSignificanceThreshold = new InformationField("p-value Threshold");
    proteinsFormLayout.addComponent(pvalueSignificanceThreshold, 2, 1);

    pValueComm = new InformationField("Statistical Comments");
    proteinsFormLayout.addComponent(pValueComm, 3, 1);

    roc = new InformationField("ROC AUC");
    proteinsFormLayout.addComponent(roc, 0, 2);

    quantBasisComment = new InformationField("Quantification Basis Comment");
    proteinsFormLayout.addComponent(quantBasisComment, 1, 2);

    additionalComments = new InformationField("Additional Comments");
    proteinsFormLayout.addComponent(additionalComments, 2, 2);

    return proteinsFormLayout;
}

From source file:probe.com.view.body.welcomelayout.PublicationsInformationWindow.java

public PublicationsInformationWindow(List<Object[]> publicationList) {

    int height = Page.getCurrent().getBrowserWindowHeight() - 100;
    int width = Page.getCurrent().getBrowserWindowWidth() - 100;
    int columnNum = width / 250;
    width = columnNum * 250;// w  ww .j a va2  s.  c  o  m
    VerticalLayout popupBodyWrapper = new VerticalLayout();
    popupBodyWrapper.setWidth("100%");
    popupBodyWrapper.setHeight("100%");
    VerticalLayout popupBody = new VerticalLayout();
    popupBody.setWidth((width) + "px");
    popupBody.setHeightUndefined();
    popupBody.setStyleName(Reindeer.LAYOUT_WHITE);
    popupBody.setMargin(true);
    popupBody.setSpacing(true);
    popupBodyWrapper.addComponent(popupBody);
    popupBodyWrapper.setComponentAlignment(popupBody, Alignment.TOP_CENTER);

    popupWindow = new Window() {

        @Override
        public void close() {
            popupWindow.setVisible(false);

        }

    };

    popupWindow.setContent(popupBodyWrapper);
    popupWindow.setWindowMode(WindowMode.NORMAL);

    popupWindow.setWidth((width + 22) + "px");

    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setClosable(false);
    popupWindow.setStyleName(Reindeer.WINDOW_LIGHT);
    popupWindow.setModal(true);
    popupWindow.setDraggable(false);
    popupWindow.setCaption(
            "<font color='gray' style='font-weight: bold;!important'>&nbsp;&nbsp;Publication Information</font>");

    UI.getCurrent().addWindow(popupWindow);
    popupWindow.center();

    popupWindow.setCaptionAsHtml(true);
    popupWindow.setClosable(true);

    GridLayout publicationContainer = new GridLayout();
    publicationContainer.setWidth("100%");
    publicationContainer.setSpacing(true);
    publicationContainer.setMargin(true);
    popupBody.addComponent(publicationContainer);

    publicationContainer.setColumns(columnNum);
    publicationContainer.setRows(publicationList.size());

    this.addLayoutClickListener(PublicationsInformationWindow.this);
    int row = 0;
    int col = 0;

    for (Object[] obj : publicationList) {
        VerticalLayout publicationLayout = initPublicationLayout(obj);
        String btnName = "<font size=1 >" + obj[0].toString() + "</font><br/>" + obj[1].toString()
                + "<br/><font size=1 >" + obj[2].toString() + "</font><br/><font size=1 >#Proteins: "
                + obj[5].toString() /*+ "/" + obj[5].toString() + */ + "   #Peptides: "
                + obj[7].toString() /*+ "/" + obj[7].toString() +*/ + "</font>";

        PopupInfoBtn publicationBtn = new PopupInfoBtn(publicationLayout, btnName, obj[1].toString());
        publicationContainer.addComponent(publicationBtn, col++, row);
        publicationContainer.setComponentAlignment(publicationBtn, Alignment.TOP_CENTER);
        if (col >= columnNum) {
            row++;
            col = 0;

        }
    }
    height = Math.min((++row * 85) + 200, height);
    popupWindow.setHeight((height) + "px");

}

From source file:probe.com.view.core.SingleStudyFilterLayout.java

/**
 *
 * @param dataset/*from w  w  w.j a  va 2s  .  c  om*/
 * @param datasetIndex
 * @param uniqueAttr
 * @param view
 */
public SingleStudyFilterLayout(QuantDatasetObject dataset, int datasetIndex, boolean[] uniqueAttr,
        boolean view) {

    init();
    this.setMargin(new MarginInfo(false, false, false, false));
    VerticalLayout miniLayout = new VerticalLayout();
    Label miniAttrLabel = new Label();
    if (!dataset.getUniqueValues().equalsIgnoreCase("")) {
        miniAttrLabel.setValue("[ " + dataset.getUniqueValues() + "]");
    }
    miniLayout.addComponent(miniAttrLabel);
    GridLayout studyInfo = new GridLayout();
    studyInfo.setColumns(3);
    studyInfo.setWidth("100%");

    SubTreeHideOnClick layout = new SubTreeHideOnClick("Dataset " + datasetIndex, studyInfo, miniLayout, view);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);
    for (int i = 0; i < uniqueAttr.length; i++) {

        boolean check = uniqueAttr[i];

        if (check) {
            if (!dataset.getProperty(i).toString().trim().equalsIgnoreCase("Not Available")
                    && !dataset.getProperty(i).toString().trim().equalsIgnoreCase("0")
                    && !dataset.getProperty(i).toString().trim().equalsIgnoreCase("-1")) {
                if (publicationInfoLayoutComponents[i] != null) {
                    studyInfo.addComponent(publicationInfoLayoutComponents[i]);
                    ((InformationField) publicationInfoLayoutComponents[i])
                            .setValue(dataset.getProperty(i).toString(), null);
                }
            }

        }

    }
    Button btn = new Button("Load Dataset");
    btn.setStyleName(Reindeer.BUTTON_SMALL);
    VerticalLayout btnLayout = new VerticalLayout();
    btnLayout.setMargin(true);
    btnLayout.setHeight("30px");
    btnLayout.addComponent(btn);

    int rowNum = studyInfo.getRows();
    if (studyInfo.getComponentCount() % 3 != 0) {
        studyInfo.addComponent(btnLayout, 2, rowNum - 1);
    } else {
        studyInfo.setRows(rowNum + 1);
        studyInfo.addComponent(btnLayout, 2, rowNum);
    }

    studyInfo.setComponentAlignment(btnLayout, Alignment.BOTTOM_LEFT);

}

From source file:qbic.vaadincomponents.SelectFileComponent.java

License:Open Source License

public SelectFileComponent(String mainCaption, String info, String sourceCaption, String destinationCaption,
        BeanItemContainer<?> source, BeanItemContainer<?> destination) {
    setCaption(mainCaption);/*from   ww w.  java  2 s .  co m*/

    VerticalLayout files = new VerticalLayout();
    files.setSpacing(true);

    // info label
    Label rawFilesInfo = new Label(info);
    rawFilesInfo.addStyleName(ValoTheme.LABEL_COLORED);
    files.addComponent(rawFilesInfo);
    files.setWidth("100%");

    // available files in openbis
    available = new Grid(source);
    available.setCaption(sourceCaption);
    available.setSelectionMode(SelectionMode.MULTI);

    // selected files for anaylsis
    selected = new Grid(destination);

    if (mainCaption.equals("Raw files")) {
        available.removeColumn("fullPath");
        available.removeColumn("openbisCode");
    }

    else if (mainCaption.equals("")) {
        available.removeColumn("name");
        available.removeColumn("path");
        selected.removeColumn("name");
        selected.removeColumn("path");
    }

    selected.setCaption(destinationCaption);
    selected.setSelectionMode(SelectionMode.MULTI);

    for (Grid.Column col : available.getColumns()) {
        col.setWidthUndefined();
    }

    // selectedFiles.set
    // buttons to add or remove files
    VerticalLayout buttons = new VerticalLayout();
    toLeft = new Button();
    toLeft.setIcon(FontAwesome.ARROW_LEFT);

    toRight = new Button();
    toRight.setIcon(FontAwesome.ARROW_RIGHT);
    buttons.addComponent(toRight);
    buttons.addComponent(toLeft);

    GridLayout grids = new GridLayout(3, 1);
    grids.setWidth("100%");

    // grids.setSpacing(true);
    grids.addComponent(available, 0, 0);

    available.setWidth("100%");
    grids.addComponent(buttons, 1, 0);
    grids.addComponent(selected, 2, 0);
    grids.setColumnExpandRatio(0, 0.45f);
    grids.setColumnExpandRatio(1, 0.029f);
    grids.setColumnExpandRatio(2, 0.45f);
    grids.setSpacing(false);
    grids.setComponentAlignment(buttons, com.vaadin.ui.Alignment.MIDDLE_CENTER);

    selected.setWidth("100%");

    files.addComponent(grids);

    this.setCompositionRoot(files);
    files.setMargin(new MarginInfo(true, true, true, false));
    this.setWidth("100%");

}