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:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java

public Component getSources(GroupInterestProfile profile, boolean isAdmin) {
    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setWidth("100%");
    VerticalLayout sourcesLayout = new VerticalLayout();
    sourcesLayout.setWidth("100%");
    Panel sourcesPanel = new Panel(sourcesLayout);

    List<CheckBox> checkBoxes = new ArrayList<>();
    HashMap<String, GridLayout> sourceLayouts = new HashMap<>();
    profile.getSources().entrySet().stream()
            .sorted((e1, e2) -> e1.getKey().getName().compareToIgnoreCase(e2.getKey().getName())).forEach(e -> {
                Source source = e.getKey();
                boolean enabled = e.getValue();
                GridLayout sourceLayout = new GridLayout(5, 1);
                sourceLayout.setSizeFull();

                CheckBox sourceSelected = new CheckBox();
                sourceSelected.setValue(enabled);
                sourceSelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                sourceSelected.addValueChangeListener(v -> profile.getSources().replace(source, v.getValue()));
                sourceSelected.setEnabled(isAdmin);
                checkBoxes.add(sourceSelected);

                Image sourceLogo = new Image();
                sourceLogo.addStyleName("logosmall");
                sourceLogo.setSource(new ExternalResource(source.getLogo()));
                if (isAdmin) {
                    sourceLogo.addClickListener(c -> {
                        sourceSelected.setValue(!sourceSelected.getValue());
                        profile.getSources().replace(source, sourceSelected.getValue());
                    });/*from  w  w  w.j ava2 s.  co  m*/
                }
                VerticalLayout layoutLogo = new VerticalLayout(sourceLogo);
                layoutLogo.setWidth("150px");
                layoutLogo.setHeight("50px");
                layoutLogo.setMargin(false);
                layoutLogo.setSpacing(false);
                layoutLogo.setComponentAlignment(sourceLogo, Alignment.MIDDLE_LEFT);

                Label labelHeadLine = new Label(
                        source.getCategory().getIcon().getHtml() + "  " + source.getName(), ContentMode.HTML);
                labelHeadLine.addStyleName(ValoTheme.LABEL_H3);

                Label labelDescription = new Label(source.getDescription(), ContentMode.HTML);
                labelDescription.setWidth("300px");
                PopupView popup = new PopupView(null, labelDescription);

                Button buttonDescription = new Button(VaadinIcons.INFO_CIRCLE_O);
                buttonDescription.addClickListener(ce -> {
                    popup.setPopupVisible(true);
                });

                sourceLayout.addComponents(sourceSelected, layoutLogo, labelHeadLine, popup, buttonDescription);
                sourceLayout.setComponentAlignment(sourceSelected, Alignment.MIDDLE_CENTER);
                sourceLayout.setComponentAlignment(layoutLogo, Alignment.MIDDLE_CENTER);
                sourceLayout.setColumnExpandRatio(2, 5);
                sourceLayout.setSpacing(true);

                sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "")
                        .replaceAll("_", ""), sourceLayout);
                sourcesLayout.addComponent(sourceLayout);
            });

    sourcesPanel.setContent(sourcesLayout);
    sourcesPanel.setHeight("100%");
    sourcesPanel.setCaption(Language.get(Word.SOURCES));
    Language.setCustom(Word.SOURCES, s -> sourcesPanel.setCaption(s));
    windowLayout.addComponent(sourcesPanel);
    windowLayout.setExpandRatio(sourcesPanel, 1);
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);

    CheckBox checkBoxSelectAll = new CheckBox();
    Language.setCustom(Word.SELECT_ALL, s -> checkBoxSelectAll.setCaption(s));
    checkBoxSelectAll.setWidth("100%");
    checkBoxSelectAll.addValueChangeListener(e -> {
        profile.getSources().replaceAll((c, enabled) -> checkBoxSelectAll.getValue());
        checkBoxes.forEach(c -> c.setValue(checkBoxSelectAll.getValue()));
    });
    checkBoxSelectAll.setEnabled(isAdmin);

    TextField textFieldSearch = new TextField();
    Language.setCustom(Word.SEARCH, s -> textFieldSearch.setPlaceholder(s));
    textFieldSearch.setWidth("100%");
    textFieldSearch.setMaxLength(255);
    textFieldSearch.setPlaceholder(Language.get(Word.SEARCH));
    textFieldSearch.addValueChangeListener(searchValue -> {
        sourceLayouts.forEach((sourceName, sourceLayout) -> {
            if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "")
                    .replaceAll("-", "").replaceAll("_", ""))) {
                sourcesLayout.removeComponent(sourceLayout);
            } else {
                sourcesLayout.addComponent(sourceLayout);
            }
        });
    });

    Label placeholder = new Label();
    placeholder.setWidth("100%");

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.setMargin(new MarginInfo(true, false, false, false));
    footer.addStyleName("menubar");
    footer.setWidth("100%");
    footer.addComponents(checkBoxSelectAll, textFieldSearch, placeholder);
    footer.setComponentAlignment(checkBoxSelectAll, Alignment.MIDDLE_LEFT);
    footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER);

    windowLayout.addComponent(footer);
    windowLayout.setHeight("350px");
    return windowLayout;
}

From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java

public Component getCategories(GroupInterestProfile profile, boolean isAdmin) {
    Map<Category, Boolean> categories = profile.getCategories();
    VerticalLayout categoriesLayout = new VerticalLayout();
    categoriesLayout.setWidth("100%");
    Panel categoriesPanel = new Panel(categoriesLayout);

    categories.entrySet().stream().sorted((e1, e2) -> e1.getKey().getName().compareTo(e2.getKey().getName()))
            .forEach(e -> {//from ww w .  j av  a  2s  .c  om
                Category category = e.getKey();
                boolean enabled = e.getValue();
                GridLayout categoryLayout = new GridLayout(3, 1);
                categoryLayout.setWidth("100%");

                CheckBox categorySelected = new CheckBox();
                categorySelected.setValue(enabled);
                categorySelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                categorySelected.addValueChangeListener(v -> categories.replace(category, v.getValue()));
                categorySelected.setEnabled(isAdmin);

                Label categoryIcon = new Label(category.getIcon().getHtml(), ContentMode.HTML);
                categoryIcon.addStyleName(ValoTheme.LABEL_H3);
                categoryIcon.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                Label categoryName = new Label(category.getName(), ContentMode.HTML);
                Language.setCustom(null, s -> categoryName.setValue(category.getName()));
                categoryName.addStyleName(ValoTheme.LABEL_H3);
                categoryName.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                categoryLayout.addComponents(categorySelected, categoryIcon, categoryName);
                categoryLayout.setComponentAlignment(categorySelected, Alignment.MIDDLE_CENTER);
                categoryLayout.setComponentAlignment(categoryIcon, Alignment.MIDDLE_LEFT);
                categoryLayout.setComponentAlignment(categoryName, Alignment.MIDDLE_LEFT);
                categoryLayout.setColumnExpandRatio(2, 5);
                categoryLayout.setSpacing(true);

                categoriesLayout.addComponent(categoryLayout);
            });

    categoriesPanel.setContent(categoriesLayout);
    categoriesPanel.setHeight("100%");
    categoriesPanel.setCaption(Language.get(Word.CATEGORIES));
    Language.setCustom(Word.CATEGORIES, s -> categoriesPanel.setCaption(s));

    return categoriesPanel;
}

From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java

public Component getTags(GroupInterestProfile profile, boolean isAdmin) {
    GridLayout allTagsLayout = new GridLayout(2, 1);
    Panel allTagsPanel = new Panel(allTagsLayout);
    allTagsPanel.setWidth("100%");
    allTagsPanel.setHeight("265px");
    allTagsPanel.setCaption(Language.get(Word.TAGS));
    Language.setCustom(Word.TAGS, s -> allTagsPanel.setCaption(s));

    VerticalLayout includedTagsLayout = new VerticalLayout();
    includedTagsLayouts.put(profile, includedTagsLayout);
    includedTagsLayout.setWidth("100%");
    includedTagsLayout.addStyleName("tags");
    Label labelIncludedTags = new Label(Language.get(Word.INCLUDE_TAGS));//Evtl only included
    Language.setCustom(Word.INCLUDE_TAGS, s -> labelIncludedTags.setValue(s));
    if (isAdmin) {
        Component addIncludeTagGroup = getAddTagGroup(profile, true);
        includedTagsLayout.addComponents(labelIncludedTags, addIncludeTagGroup);
        includedTagsLayout.setComponentAlignment(addIncludeTagGroup, Alignment.MIDDLE_CENTER);
    } else {/*w w  w.  j  av a2s  . c om*/
        includedTagsLayout.addComponents(labelIncludedTags);
    }
    includedTagsLayout.setComponentAlignment(labelIncludedTags, Alignment.MIDDLE_CENTER);

    VerticalLayout excludedTagsLayout = new VerticalLayout();
    excludedTagsLayouts.put(profile, excludedTagsLayout);
    excludedTagsLayout.setWidth("100%");
    excludedTagsLayout.addStyleName("tags");
    Label labelExcludedTags = new Label(Language.get(Word.EXCLUDE_TAGS));//Evtl only included
    Language.setCustom(Word.EXCLUDE_TAGS, s -> labelExcludedTags.setValue(s));
    if (isAdmin) {
        Component addExcludeTagGroup = getAddTagGroup(profile, false);
        excludedTagsLayout.addComponents(labelExcludedTags, addExcludeTagGroup);
        excludedTagsLayout.setComponentAlignment(addExcludeTagGroup, Alignment.MIDDLE_CENTER);
    } else {
        excludedTagsLayout.addComponents(labelExcludedTags);
    }
    excludedTagsLayout.setComponentAlignment(labelExcludedTags, Alignment.MIDDLE_CENTER);

    profile.getTags().forEach((tag, included) -> addRow(profile, included, tag, isAdmin));

    allTagsLayout.addComponents(includedTagsLayout, excludedTagsLayout);
    allTagsLayout.setWidth("100%");
    return allTagsPanel;
}

From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java

private void addRow(GroupInterestProfile profile, boolean included, String value, boolean isAdmin) {
    GridLayout tagLayout = new GridLayout(2, 1);
    tagLayout.setWidth("100%");

    Label labelTagName = new Label(value, ContentMode.HTML);
    labelTagName.setWidth("100%");
    labelTagName.addStyleName(ValoTheme.LABEL_H3);
    labelTagName.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    tagLayout.addComponent(labelTagName);
    tagLayout.setComponentAlignment(labelTagName, Alignment.MIDDLE_LEFT);

    if (isAdmin) {
        Button buttonDeleteTag = new Button(VaadinIcons.TRASH);
        buttonDeleteTag.addStyleName(ValoTheme.BUTTON_DANGER);
        buttonDeleteTag.addClickListener(ev -> {
            profile.getTags().remove(value);
            if (included) {
                includedTagsLayouts.get(profile).removeComponent(tagLayout);
            } else {
                excludedTagsLayouts.get(profile).removeComponent(tagLayout);
            }/*  www  .  ja  v  a  2s  .c o m*/
        });
        tagLayout.addComponent(buttonDeleteTag);
        tagLayout.setComponentAlignment(buttonDeleteTag, Alignment.MIDDLE_RIGHT);
    }

    tagLayout.setWidth("100%");
    tagLayout.setColumnExpandRatio(0, 5);
    tagLayout.setSpacing(true);
    tagLayout.setMargin(false);

    if (included) {
        if (isAdmin) {
            includedTagsLayouts.get(profile).addComponent(tagLayout, 2);
        } else {
            includedTagsLayouts.get(profile).addComponent(tagLayout, 1);
        }
    } else {
        if (isAdmin) {
            excludedTagsLayouts.get(profile).addComponent(tagLayout, 2);
        } else {
            excludedTagsLayouts.get(profile).addComponent(tagLayout, 1);
        }
    }
}

From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java

/**
 * Value is optional// www .  j av  a  2 s .c  o  m
 *
 * @param action
 * @param content
 * @param value
 * @return
 */
private Component getRow(Layout parent, Runnable onDelete, String action, String content, String value) {
    Panel panelRow = new Panel();
    GridLayout layoutRow = new GridLayout(2, 1);

    Label labelInfo = new Label("", ContentMode.HTML);
    String stringInfo = action.toUpperCase() + "<br>";
    if (value != null) {
        stringInfo += content + " = " + value;
    } else {
        stringInfo += content + " ";
    }
    labelInfo.setValue(stringInfo);

    Button buttonDelete = new Button(VaadinIcons.TRASH);
    buttonDelete.addStyleName(ValoTheme.BUTTON_DANGER);
    buttonDelete.addClickListener(ce -> {
        onDelete.run();
        parent.removeComponent(panelRow);
    });

    layoutRow.addComponents(labelInfo, buttonDelete);
    layoutRow.setComponentAlignment(buttonDelete, Alignment.MIDDLE_RIGHT);
    layoutRow.setComponentAlignment(labelInfo, Alignment.MIDDLE_LEFT);
    layoutRow.setWidth("100%");
    layoutRow.setMargin(true);
    layoutRow.addStyleName("crawler");
    panelRow.setContent(layoutRow);
    panelRow.setWidth("100%");
    return panelRow;
}

From source file:edu.kit.dama.ui.admin.ServiceAccessTokenDialog.java

License:Apache License

private void updateAuthenticatorAttributeLayout(AbstractAuthenticator authenticator) {
    UIUtils7.GridLayoutBuilder builder;//from  ww  w. ja  v a  2 s  . c  o  m
    String[] attributes = authenticator.getCredentialAttributeNames();

    switch (attributes.length) {
    case 0: {
        tokenField = null;
        secretField = null;
        nosecretField = null;
        builder = new UIUtils7.GridLayoutBuilder(1, 1);
        break;
    }
    case 1: {
        tokenField = new TextField(attributes[0]);
        tokenField.addStyleName("myboldcaption");
        secretField = null;
        nosecretField = null;
        builder = new UIUtils7.GridLayoutBuilder(1, 1);
        break;
    }
    default: {
        tokenField = new TextField(attributes[0]);
        tokenField.addStyleName("myboldcaption");
        secretField = new PasswordField(attributes[1]);
        secretField.addStyleName("myboldcaption");
        nosecretField = new TextField(attributes[1]);
        nosecretField.addStyleName("myboldcaption");
        builder = new UIUtils7.GridLayoutBuilder(2, 3);
    }
    }

    if (tokenField != null) {
        builder.fillRow(tokenField, 0, 0, 1);
    } else {
        builder.fillRow(new Label("No configuration needed."), 0, 0, 1);
    }

    if (secretField != null) {
        builder.addComponent(secretField, 0, 1);
        builder.addComponent(generateButton, Alignment.BOTTOM_RIGHT, 1, 1, 1, 1);
        builder.fillRow(showSecret, 0, 2, 1);
    }
    GridLayout newLayout = builder.getLayout();
    newLayout.setSpacing(true);
    newLayout.setWidth("400px");

    mainLayout.replaceComponent(authenticatorConfigurationLayout, newLayout);
    authenticatorConfigurationLayout = newLayout;
}

From source file:edu.kit.dama.ui.simon.panel.SimonMainPanel.java

License:Apache License

/**
 * Create the tab for a single category.
 *
 * @param pProbes The probes of this category.
 *
 * @return The category tab component.//from   w  ww  .  ja  v a2 s  . c om
 */
private Component createCategoryTab(List<AbstractProbe> pProbes) {
    UIUtils7.GridLayoutBuilder layoutBuilder = new UIUtils7.GridLayoutBuilder(2, pProbes.size());

    int row = 0;
    for (AbstractProbe probe : pProbes) {
        Embedded status = new Embedded(null, getResourceForStatus(probe.getCurrentStatus()));
        Label name = new Label(probe.getName());
        layoutBuilder.addComponent(status, Alignment.MIDDLE_LEFT, 0, row, 1, 1).addComponent(name,
                Alignment.MIDDLE_LEFT, 1, row, 1, 1);
        row++;
    }
    GridLayout tabLayout = layoutBuilder.getLayout();
    tabLayout.setColumnExpandRatio(0, .01f);
    tabLayout.setColumnExpandRatio(1, 1.0f);
    tabLayout.setImmediate(true);
    tabLayout.setSpacing(true);
    tabLayout.setMargin(true);
    tabLayout.setWidth("100%");
    return tabLayout;
}

From source file:edu.nps.moves.mmowgliMobile.ui.UserRenderer2.java

License:Open Source License

public void setMessage(FullEntryView2 mView, ListEntry message, ListView2 messageList,
        AbstractOrderedLayout layout) {/*from w w  w .  ja v  a 2 s .  c  o m*/
    // messageList can be null if coming in from ActionPlan
    Object key = HSess.checkInit();
    UserListEntry wu = (UserListEntry) message;
    User u = wu.getUser();
    layout.removeAllComponents();

    HorizontalLayout hlay = new HorizontalLayout();
    layout.addComponent(hlay);
    hlay.addStyleName("m-userview-top");
    hlay.setWidth("100%");
    hlay.setMargin(true);
    hlay.setSpacing(true);

    Image img = new Image();
    img.addStyleName("m-ridgeborder");
    img.setSource(mediaLocator.locate(u.getAvatar().getMedia()));
    img.setWidth("90px");
    img.setHeight("90px");
    hlay.addComponent(img);
    hlay.setComponentAlignment(img, Alignment.MIDDLE_CENTER);

    Label lab;
    hlay.addComponent(lab = new Label());
    lab.setWidth("5px");

    VerticalLayout vlay = new VerticalLayout();
    vlay.setSpacing(true);
    hlay.addComponent(vlay);
    hlay.setComponentAlignment(vlay, Alignment.MIDDLE_LEFT);
    vlay.setWidth("100%");
    hlay.setExpandRatio(vlay, 1.0f);
    HorizontalLayout horl = new HorizontalLayout();
    horl.setSpacing(false);
    vlay.addComponent(horl);
    vlay.setComponentAlignment(horl, Alignment.BOTTOM_LEFT);
    horl.addComponent(lab = new Label("name"));
    lab.addStyleName("m-user-top-label"); //light-text");
    horl.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;" + u.getUserName()));
    lab.addStyleName("m-user-top-value");
    horl = new HorizontalLayout();
    horl.setSpacing(false);
    vlay.addComponent(horl);
    vlay.setComponentAlignment(horl, Alignment.TOP_LEFT);

    horl.addComponent(lab = new Label("level"));
    lab.addStyleName("m-user-top-label"); //light-text");
    Level lev = u.getLevel();
    if (u.isGameMaster()) {
        Level l = Level.getLevelByOrdinal(Level.GAME_MASTER_ORDINAL, HSess.get());
        if (l != null)
            lev = l;
    }
    horl.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;&nbsp;" + lev.getDescription()));
    lab.addStyleName("m-user-top-value");

    GridLayout gLay = new GridLayout();
    // gLay.setHeight("155px");  // won't size properly
    gLay.setMargin(true);
    gLay.addStyleName("m-userview-mid");
    gLay.setColumns(2);
    gLay.setRows(11);
    gLay.setSpacing(true);
    gLay.setWidth("100%");
    gLay.setColumnExpandRatio(1, 1.0f);
    layout.addComponent(gLay);

    addRow(gLay, "user ID:", "" + getPojoId(message));
    addRow(gLay, "location:", u.getLocation());
    addRow(gLay, "expertise:", u.getExpertise());
    addRow(gLay, "affiliation:", u.getAffiliation());
    addRow(gLay, "date registered:", formatter.format(u.getRegisterDate()));

    gLay.addComponent(new Hr(), 0, 5, 1, 5);

    Container cntr = new CardsByUserContainer<Card>(u); // expects ThreadLocal session to be setup
    numCards = cntr.size();
    addRow(gLay, "cards played:", "" + numCards);
    cntr = new ActionPlansByUserContainer<Card>(u); // expects ThreadLocal session to be setup
    numAps = cntr.size();
    addRow(gLay, "action plans:", "" + numAps);

    gLay.addComponent(new Hr(), 0, 8, 1, 8);

    addRow(gLay, "exploration points:", "" + u.getBasicScore());
    addRow(gLay, "innovation points:", "" + u.getInnovationScore());

    cardListener = new CardLis(u, mView);
    apListener = new AppLis(u, mView);

    layout.addComponent(makeButtons());

    HSess.checkClose(key);
}

From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopupRoleDifferent.java

License:Open Source License

/**
 * Permet de dessiner le tableau /* ww w  . j av a  2s. co  m*/
 */
public void drawTab(Tab tab) {
    GridLayout gl = new GridLayout(4, 1 + tab.lines.size());
    gl.setWidth("800px");
    gl.setSpacing(false);

    contentLayout.addComponent(gl);

    // Construction du titre   
    Label l = new Label(tab.titre);
    l.addStyleName(tab.styleTitre);
    l.setWidth("100%");
    gl.addComponent(l, 0, 0, 3, 0);

    List<TabLine> lines = tab.lines;
    for (int i = 0; i < lines.size(); i++) {
        TabLine line = lines.get(i);

        int height = computeHeight(line);
        // La taille minimale est de 36 pixels, pour les boutons inscrire / desincrire
        height = Math.max(height, 36);

        Label l1 = new Label(line.col1);
        l1.addStyleName(line.styleCol1);
        l1.setWidth("100%");
        l1.setHeight(height + "px");
        gl.addComponent(l1, 0, i + 1);

        Label l2 = new Label(line.col2);
        l2.addStyleName(line.styleCol2);
        l2.setWidth("100%");
        l2.setHeight(height + "px");
        gl.addComponent(l2, 1, i + 1);

        Label l3 = new Label(line.col3);
        l3.addStyleName(line.styleCol3);
        l3.setWidth("100%");
        l3.setHeight(height + "px");
        gl.addComponent(l3, 2, i + 1);

        if (line.col4 != null) {
            Button b = new Button(line.col4);
            b.addStyleName(line.styleCol4);
            b.addClickListener(e -> handleButton(line.role));
            b.setWidth("100%");
            gl.addComponent(b, 3, i + 1);
            gl.setComponentAlignment(b, Alignment.MIDDLE_CENTER);
        } else {
            Label l4 = new Label("");
            l4.addStyleName(line.styleCol4);
            l4.setWidth("100%");
            l4.setHeight(height + "px");
            gl.addComponent(l4, 3, i + 1);
        }
    }
}

From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopupToutAutorise.java

License:Open Source License

/**
 * Permet de dessiner le tableau //w  w w  . j a  v a 2 s . c  o  m
 */
public void drawTab(Tab tab) {
    GridLayout gl = new GridLayout(3, 1 + tab.lines.size());
    gl.setWidth("600px");
    gl.setSpacing(false);

    contentLayout.addComponent(gl);

    // Construction du titre   
    Label l = new Label(tab.titre);
    l.addStyleName(tab.styleTitre);
    l.setWidth("100%");
    gl.addComponent(l, 0, 0, 2, 0);

    List<TabLine> lines = tab.lines;
    for (int i = 0; i < lines.size(); i++) {
        TabLine line = lines.get(i);

        int height = computeHeight(line);
        // La taille minimale est de 36 pixels, pour les boutons inscrire / desincrire
        height = Math.max(height, 36);

        Label l1 = new Label(line.col1);
        l1.addStyleName(line.styleCol1);
        l1.setWidth("100%");
        l1.setHeight(height + "px");
        gl.addComponent(l1, 0, i + 1);

        Label l2 = new Label(line.col2);
        l2.addStyleName(line.styleCol2);
        l2.setWidth("100%");
        l2.setHeight(height + "px");
        gl.addComponent(l2, 1, i + 1);

        if (line.col3 != null) {
            Button b = new Button(line.col3);
            b.addStyleName(line.styleCol3);
            b.addClickListener(e -> handleButton(line.cell));
            b.setWidth("100%");
            gl.addComponent(b, 2, i + 1);
            gl.setComponentAlignment(b, Alignment.MIDDLE_CENTER);
        } else {
            Label l3 = new Label("");
            l3.addStyleName(line.styleCol3);
            l3.setWidth("100%");
            l3.setHeight(height + "px");
            gl.addComponent(l3, 2, i + 1);
        }
    }
}