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

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

Introduction

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

Prototype

@Override
    public int getOffsetLeft() 

Source Link

Usage

From source file:org.drools.guvnor.client.widgets.decoratedgrid.MergableGridWidget.java

License:Apache License

/**
 * Retrieve the extents of a cell/* ww w .  ja  v a2 s  . co m*/
 * 
 * @param cv
 *            The cell for which to retrieve the extents
 * @return
 */
CellSelectionDetail getSelectedCellExtents(CellValue<? extends Comparable<?>> cv) {

    if (cv == null) {
        throw new IllegalArgumentException("cv cannot be null");
    }

    // Cells in hidden columns do not have extents
    if (!columns.get(cv.getCoordinate().getCol()).isVisible()) {
        return null;
    }

    Coordinate hc = cv.getHtmlCoordinate();
    TableRowElement tre = tbody.getRows().getItem(hc.getRow()).<TableRowElement>cast();
    TableCellElement tce = tre.getCells().getItem(hc.getCol()).<TableCellElement>cast();
    int offsetX = tce.getOffsetLeft();
    int offsetY = tce.getOffsetTop();
    int w = tce.getOffsetWidth();
    int h = tce.getOffsetHeight();
    CellSelectionDetail e = new CellSelectionDetail(cv.getCoordinate(), offsetX, offsetY, h, w);
    return e;
}