Example usage for com.vaadin.client.widget.grid CellReference getRowIndex

List of usage examples for com.vaadin.client.widget.grid CellReference getRowIndex

Introduction

In this page you can find the example usage for com.vaadin.client.widget.grid CellReference getRowIndex.

Prototype

public int getRowIndex() 

Source Link

Document

Gets the row index of the row.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.grid.selection.MultiSelectionBodyClickHandler.java

License:Apache License

@Override
public void onClick(GridClickEvent event) {
    SelectionModel<JsonObject> selectionModel = grid.getSelectionModel();
    if (!(selectionModel instanceof SelectionModel.Multi)) {
        return;// ww w  . j  ava2s .co m
    }

    SelectionModel.Multi<JsonObject> model = (SelectionModel.Multi<JsonObject>) selectionModel;
    CellReference<JsonObject> cell = grid.getEventCell();

    if (!event.isShiftKeyDown() || previous < 0) {
        handleCtrlClick(model, cell, event);
        previous = cell.getRowIndex();
        return;
    }

    // This works on the premise that grid fires the data available event to
    // any newly added handlers.
    boolean ctrlOrMeta = event.isControlKeyDown() || event.isMetaKeyDown();
    handler = grid.addDataAvailableHandler(new ShiftSelector(cell, model, ctrlOrMeta));
}