@Override public TooltipInfo getTooltipInfo(Element element) { CellReference<JsonObject> cell = getWidget().getCellReference(element); if (cell != null) { JsonObject row = cell.getRow(); if (row == null) { return null; } Column<?, JsonObject> column = cell.getColumn(); if (!(column instanceof CustomGridColumn)) { // Selection checkbox column return null; } CustomGridColumn c = (CustomGridColumn) column; JsonObject cellDescriptions = row.getObject(GridState.JSONKEY_CELLDESCRIPTION); if (cellDescriptions != null && cellDescriptions.hasKey(c.id)) { return new TooltipInfo(cellDescriptions.getString(c.id)); } else if (row.hasKey(GridState.JSONKEY_ROWDESCRIPTION)) { return new TooltipInfo(row.getString(GridState.JSONKEY_ROWDESCRIPTION)); } else { return null; } } return super.getTooltipInfo(element); }
@Override public String getStyle(CellReference<JsonObject> cellReference) { JsonObject row = cellReference.getRow(); if (!row.hasKey(GridState.JSONKEY_CELLSTYLES)) { return null; } Column<?, JsonObject> column = cellReference.getColumn(); if (!(column instanceof CustomGridColumn)) { // Selection checkbox column return null; } CustomGridColumn c = (CustomGridColumn) column; JsonObject cellStylesObject = row.getObject(GridState.JSONKEY_CELLSTYLES); assert cellStylesObject != null; if (cellStylesObject.hasKey(c.id)) { return cellStylesObject.getString(c.id); } else { return null; } }
private void fireItemClick(CellReference<?> cell, NativeEvent mouseEvent) { String rowKey = getRowKey((JsonObject) cell.getRow()); String columnId = getColumnId(cell.getColumn()); getRpcProxy(GridServerRpc.class) .itemClick(rowKey, columnId, MouseEventDetailsBuilder.buildMouseEventDetails(mouseEvent)); }
@JsProperty Object getData() { return cell.getColumn().getValue(cell.getRow()); }
@JsProperty String getColumnName() { return ((GridColumn) cell.getColumn()).getJsColumn().getName(); }
@JsProperty int getIndex() { return cell.getColumnIndex(); }
@JsProperty Element getElement() { return cell.getElement(); }