Example usage for com.vaadin.ui GridLayout getComponentCount

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

Introduction

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

Prototype

@Override
public int getComponentCount() 

Source Link

Document

Gets the number of components contained in the layout.

Usage

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

/**
 *
 * @param dataset/* w  w w  .  ja v  a 2  s.  com*/
 * @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);

}