Example usage for com.google.gwt.dom.client TableRowElement is

List of usage examples for com.google.gwt.dom.client TableRowElement is

Introduction

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

Prototype

public static boolean is(Node node) 

Source Link

Document

Determine whether the given Node can be cast to this class.

Usage

From source file:com.vaadin.client.connectors.grid.GridDragSourceConnector.java

License:Apache License

private List<JsonObject> getDraggedRows(Event dragStartEvent) {
    List<JsonObject> draggedRows = new ArrayList<>();

    if (TableRowElement.is((JavaScriptObject) dragStartEvent.getTarget())) {
        TableRowElement row = (TableRowElement) dragStartEvent.getTarget();
        int rowIndex = ((Escalator.AbstractRowContainer) getGridBody()).getLogicalRowIndex(row);

        JsonObject rowData = gridConnector.getDataSource().getRow(rowIndex);

        if (dragMultipleRows(rowData)) {
            getSelectedVisibleRows().forEach(draggedRows::add);
        } else {//from   w  ww.j a  v a  2  s  . c o  m
            draggedRows.add(rowData);
        }
    }

    return draggedRows;
}

From source file:com.vaadin.client.connectors.grid.GridDropTargetConnector.java

License:Apache License

private Optional<TableRowElement> getTargetRow(Element source) {
    while (!Objects.equals(source, getGridBody().getElement())) {
        if (TableRowElement.is(source)) {
            return Optional.of(source.cast());
        }//from  w  ww  .  j  av a2 s. co m
        source = source.getParentElement();
    }
    return Optional.empty();
}

From source file:com.vaadin.client.connectors.grid.TreeGridDropTargetConnector.java

License:Apache License

@Override
protected void sendDropEventToServer(List<String> types, Map<String, String> data, String dropEffect,
        NativeEvent dropEvent) {/*ww w.j  av  a  2s .  c  o  m*/
    String rowKey = null;
    DropLocation dropLocation = null;
    Integer rowDepth = null;
    Boolean rowCollapsed = null;

    Element targetElement = getTargetElement((Element) dropEvent.getEventTarget().cast());
    // the target element is either the tablewrapper or one of the body rows
    if (TableRowElement.is(targetElement)) {
        JsonObject rowData = getRowData(targetElement.cast());
        rowKey = rowData.getString(GridState.JSONKEY_ROWKEY);
        dropLocation = getDropLocation(targetElement, dropEvent);

        // Collect hierarchy information
        JsonObject hierarchyDescription = rowData
                .getObject(HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION);
        rowDepth = (int) hierarchyDescription.getNumber(HierarchicalDataCommunicatorConstants.ROW_DEPTH);
        rowCollapsed = hierarchyDescription.getBoolean(HierarchicalDataCommunicatorConstants.ROW_COLLAPSED);
    } else {
        dropLocation = DropLocation.EMPTY;
    }

    MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder.buildMouseEventDetails(dropEvent,
            targetElement);

    getRpcProxy(TreeGridDropTargetRpc.class).drop(types, data, dropEffect, rowKey, rowDepth, rowCollapsed,
            dropLocation, mouseEventDetails);
}