<commit_before>package com.vaadin.components.grid.selection;

import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.dom.client.LabelElement;
import com.google.gwt.user.client.DOM;
import com.vaadin.client.renderers.Renderer;
import com.vaadin.client.widget.grid.RendererCellReference;
import com.vaadin.client.widget.grid.selection.MultiSelectionRenderer;
import com.vaadin.client.widget.grid.selection.SelectionModelMulti;
import com.vaadin.client.widgets.Grid;

public abstract class IndexBasedSelectionModelMultiAbstract extends
        SelectionModelMulti<Object> implements IndexBasedSelectionModel {

    private Renderer<Boolean> renderer;
    protected Grid<Object> grid;
    private boolean allowSelection = true;

    @Override
    public void setGrid(Grid<Object> grid) {
        super.setGrid(grid);
        this.grid = grid;
        this.renderer = new MultiSelectionRenderer<Object>(grid) {
            @Override
            public void init(RendererCellReference cell) {
                InputElement checkbox = Document.get()
                        .createCheckInputElement();
                LabelElement label = Document.get().createLabelElement();
                checkbox.setId(DOM.createUniqueId());
                label.setHtmlFor(checkbox.getId());
                cell.getElement().removeAllChildren();
                cell.getElement().appendChild(checkbox);
                cell.getElement().appendChild(label);
                checkbox.addClassName("v-grid style-scope");
                label.addClassName("v-grid style-scope");
            }

            @Override
            protected void setSelected(int logicalRow, boolean select) {
                if (allowSelection) {
                    super.setSelected(logicalRow, select);
                    allowSelection = false;
                }
            }
        };
    }

    @Override
    public Renderer<Boolean> getSelectionColumnRenderer() {<commit_msg>Prevent tabindex on selection column checkboxes.<commit_after>package com.vaadin.components.grid.selection;

import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.dom.client.LabelElement;
import com.google.gwt.user.client.DOM;
import com.vaadin.client.renderers.Renderer;
import com.vaadin.client.widget.grid.RendererCellReference;
import com.vaadin.client.widget.grid.selection.MultiSelectionRenderer;
import com.vaadin.client.widget.grid.selection.SelectionModelMulti;
import com.vaadin.client.widgets.Grid;

public abstract class IndexBasedSelectionModelMultiAbstract extends
        SelectionModelMulti<Object> implements IndexBasedSelectionModel {

    private Renderer<Boolean> renderer;
    protected Grid<Object> grid;
    private boolean allowSelection = true;

    @Override
    public void setGrid(Grid<Object> grid) {
        super.setGrid(grid);
        this.grid = grid;
        this.renderer = new MultiSelectionRenderer<Object>(grid) {
            @Override
            public void init(RendererCellReference cell) {
                InputElement checkbox = Document.get()
                        .createCheckInputElement();
                LabelElement label = Document.get().createLabelElement();
                checkbox.setId(DOM.createUniqueId());
                checkbox.setTabIndex(-1);
                label.setHtmlFor(checkbox.getId());
                cell.getElement().removeAllChildren();
                cell.getElement().appendChild(checkbox);
                cell.getElement().appendChild(label);
                checkbox.addClassName("v-grid style-scope");
                label.addClassName("v-grid style-scope");
            }

            @Override
            protected void setSelected(int logicalRow, boolean select) {
                if (allowSelection) {
                    super.setSelected(logicalRow, select);
                    allowSelection = false;
                }
            }
        };
    }

    @Override
    public Renderer<Boolean> getSelectionColumnRenderer() {
{'fraction_non_alphanumeric': 0.09507473658417055, 'fraction_numerical': 0.0002450379808870375, 'mean_word_length': 2.518965517241379, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2283415', 'n_tokens_mistral': 1040, 'n_tokens_neox': 986, 'n_words': 180}