Example usage for com.google.gwt.dom.client TableCellElement getColSpan

List of usage examples for com.google.gwt.dom.client TableCellElement getColSpan

Introduction

In this page you can find the example usage for com.google.gwt.dom.client TableCellElement getColSpan.

Prototype

public int getColSpan() 

Source Link

Document

Number of columns spanned by cell.

Usage

From source file:com.vaadin.client.widgets.JsniWorkaround.java

License:Apache License

private static Element getCellFromRow(TableRowElement rowElement, int index) {
    int childCount = rowElement.getCells().getLength();
    if (index < 0 || index >= childCount) {
        return null;
    }/*  w  w  w . j a v a 2 s  . com*/

    TableCellElement currentCell = null;
    boolean indexInColspan = false;
    int i = 0;

    while (!indexInColspan) {
        currentCell = rowElement.getCells().getItem(i);

        // Calculate if this is the cell we are looking for
        int colSpan = currentCell.getColSpan();
        indexInColspan = index < colSpan + i;

        // Increment by colspan to skip over hidden cells
        i += colSpan;
    }
    return currentCell;
}