Example usage for com.google.gwt.cell.client Cell handlesSelection

List of usage examples for com.google.gwt.cell.client Cell handlesSelection

Introduction

In this page you can find the example usage for com.google.gwt.cell.client Cell handlesSelection.

Prototype

boolean handlesSelection();

Source Link

Document

Check if this cell handles selection.

Usage

From source file:com.sencha.gxt.widget.core.client.grid.Grid.java

License:sencha.com license

@Override
public void onBrowserEvent(Event ce) {
    int type = ce.getTypeInt();

    CellWidgetImplHelper.onBrowserEvent(this, ce);

    Cell<?> cell = handleEventForCell(ce);

    // we dont want selection model to get click event initiated from cells that
    // handle selection
    // for example, a combo box we dont want row selected when trigger is
    // clicked/*from ww  w  .j av a 2  s. c  o  m*/
    if (type == Event.ONCLICK && cell != null && cell.handlesSelection()) {
        return;
    }

    super.onBrowserEvent(ce);
    switch (type) {
    case Event.ONCLICK:
        // onTap is being called in super.onBrowserEvent, we don't want to call click twice on MSEdge
        // also - various grids rely on the other mouse events, only want to prevent the onClick
        if (!PointerEventsSupport.impl.isSupported()) {
            onClick(ce);
        }
        break;
    case Event.ONDBLCLICK:
        onDoubleClick(ce);
        break;
    case Event.ONMOUSEDOWN:
        onMouseDown(ce);
        break;
    case Event.ONMOUSEUP:
        onMouseUp(ce);
        break;
    }
    view.handleComponentEvent(ce);
}

From source file:com.sencha.gxt.widget.core.client.grid.GridView.java

License:sencha.com license

/**
 * Returns true if the given element is selectable.
 *
 * @param target the element to check/*from ww w .j  a va  2s  .com*/
 * @return true if the given element is selectable
 */
public boolean isSelectableTarget(Element target) {
    if (target == null) {
        return false;
    }

    String tag = target.getTagName();
    if ("input".equalsIgnoreCase(tag) || "textarea".equalsIgnoreCase(tag)) {
        return false;
    }

    int colIndex = findCellIndex(target, null);
    Element cellParent = getCell(findRowIndex(target), colIndex);

    com.google.gwt.cell.client.Cell<?> cell = grid.getColumnModel().getCell(colIndex);
    if (cell != null && cellParent != null && cellParent.isOrHasChild(target) && cell.handlesSelection()) {
        return false;
    }
    return true;
}