@Override protected void renderRowValues(SafeHtmlBuilder sb, List<T> values, int start, SelectionModel<? super T> selectionModel) { String keyboardSelectedItem = " " + style.cellListKeyboardSelectedItem(); String selectedItem = " " + style.cellListSelectedItem(); String evenItem = style.cellListEvenItem(); String oddItem = style.cellListOddItem(); int keyboardSelectedRow = getKeyboardSelectedRow() + getPageStart(); int length = values.size(); int end = start + length; for (int i = start; i < end; i++) { T value = values.get(i - start); boolean isSelected = selectionModel == null ? false : selectionModel.isSelected(value); StringBuilder classesBuilder = new StringBuilder(); classesBuilder.append(i % 2 == 0 ? evenItem : oddItem); if (isSelected) { classesBuilder.append(selectedItem); } if (i == keyboardSelectedRow) { classesBuilder.append(keyboardSelectedItem); } SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder(); Context context = new Context(i, 0, getValueKey(value)); cell.render(context, value, cellBuilder); sb.append(TEMPLATE.div(i, classesBuilder.toString(), cellBuilder.toSafeHtml())); } }
Context context = new Context(absRowIndex, curColumn, cellTable.getValueKey(rowValue)); String cellStyles = column.getCellStyleNames(context, rowValue); if (cellStyles != null) {
/** * Build the table header for the column. */ private void buildTableHeader(TableRowBuilder tr, Column<T, ?> column, Header<?> header, boolean isSortable, boolean isSorted, boolean isSortAscending, StringBuilder classesBuilder, String sortableStyle, String sortedStyle, int prevColspan, int curColumn) { if (isSortable) { classesBuilder.append(sortableStyle); } if (isSorted) { classesBuilder.append(sortedStyle); } appendExtraStyles(header, classesBuilder); TableCellBuilder th = tr.startTH().colSpan(prevColspan).className(classesBuilder.toString()); enableColumnHandlers(th, column); if (header != null) { // Build the header. Context context = new Context(0, curColumn - prevColspan, header.getKey()); if (isSortable) { // TODO: Figure out aria-label and translation of label text th.attribute("role", "button"); th.tabIndex(-1); } renderSortableHeader(th, context, header, isSorted, isSortAscending); } th.endTH(); }
/** * Create the context for a column based on the current table building state. * * @param column the column id * @return the context that contains the column index, row/subrow indexes, and the row value key */ public final Context createContext(int column) { return new Context(rowIndex, column, rowValueKey, subrowIndex); }
/** * Create the context for a column based on the current table building state. * * @param column the column id * @return the context that contains the column index, row/subrow indexes, and the row value key */ public final Context createContext(int column) { return new Context(rowIndex, column, rowValueKey, subrowIndex); }
@Override protected boolean resetFocusOnCell() { int row = getKeyboardSelectedRow(); if (isRowWithinBounds(row)) { Element rowElem = getKeyboardSelectedElement(); Element cellParent = getCellParent(rowElem); T value = getVisibleItem(row); Context context = new Context(row + getPageStart(), 0, getValueKey(value)); return cell.resetFocus(context, cellParent, value); } return false; }
/** * Get the {@link Context} for the cell. */ private Context createContext() { return new Context(0, 0, getKey(value)); }
@Override protected boolean resetFocusOnCell() { int row = getKeyboardSelectedRow(); if (isRowWithinBounds(row)) { Element rowElem = getKeyboardSelectedElement(); Element cellParent = getCellParent(rowElem); T value = getVisibleItem(row); Context context = new Context(row + getPageStart(), 0, getValueKey(value)); return cell.resetFocus(context, cellParent, value); } return false; }
/** * Get the {@link Context} for the cell. */ private Context createContext() { return new Context(0, 0, getKey(value)); }
int headerIndex = isHeader ? headerBuilder.getRowIndex(targetTableRow) : footerBuilder.getRowIndex(targetTableRow); Context context = new Context(headerIndex, col, header.getKey()); Context context = new Context(absRow, col, getValueKey(value), subrow); CellPreviewEvent<T> previewEvent = CellPreviewEvent.fire(this, event, this, context, value, cellIsEditing,
Context context = new Context(i, curColumn, getValueKey(value)); String cellStyles = column.getCellStyleNames(context, value); if (cellStyles != null) {
Context context = new Context(i, 0, getValueKey(value)); cell.render(context, value, cellBuilder);
Element cellParent = getCellParent(cellTarget); T value = getVisibleItem(indexOnPage); Context context = new Context(idx, 0, getValueKey(value)); CellPreviewEvent<T> previewEvent = CellPreviewEvent.fire(this, event, this, context, value, cellIsEditing,
Element cellParent = getCellParent(); Object key = getValueKey(); Context context = new Context(getIndex(), 0, key); boolean cellWasEditing = parentCell.isEditing(context, cellParent, value);
@Override protected boolean resetFocusOnCell() { Element elem = getKeyboardSelectedElement(); if (elem == null) { // There is no selected element. return false; } int row = getKeyboardSelectedRow(); int col = getKeyboardSelectedColumn(); T value = getVisibleItem(row); Object key = getValueKey(value); // TODO(pengzhuang): this doesn't support sub row selection? Context context = new Context(row + getPageStart(), col, key); HasCell<T, ?> column = tableBuilder.getColumn(context, value, elem); if (column == null) { // The selected element does not contain a Cell. return false; } resetFocusOnCellImpl(context, value, column, elem); return false; }
public void onValueChange(ValueChangeEvent<Date> event) { // Remember the values before hiding the popup. Element cellParent = lastParent; Date oldValue = lastValue; Object key = lastKey; int index = lastIndex; int column = lastColumn; panel.hide(); // Update the cell and value updater. Date date = event.getValue(); setViewData(key, date); setValue(new Context(index, column, key), cellParent, oldValue); if (valueUpdater != null) { valueUpdater.update(date); } } });
/** * Reset focus on this node. * * @return true of the cell takes focus, false if not */ boolean resetFocusOnCell() { if (parentNodeInfo != null) { Context context = new Context(getIndex(), 0, getValueKey()); Cell<T> cell = parentNodeInfo.getCell(); return cell.resetFocus(context, getCellParent(), value); } return false; }
/** * Create the context for a column based on the current table building state. * * @param column the column id * @return the context that contains the column index, row/subrow indexes, and the row value key */ public final Context createContext(int column) { return new Context(rowIndex, column, rowValueKey, subrowIndex); }
/** * Get the {@link Context} for the cell. */ private Context createContext() { return new Context(0, 0, getKey(value)); }
@Override protected boolean resetFocusOnCell() { int row = getKeyboardSelectedRow(); if (isRowWithinBounds(row)) { Element rowElem = getKeyboardSelectedElement(); Element cellParent = getCellParent(rowElem); T value = getVisibleItem(row); Context context = new Context(row + getPageStart(), 0, getValueKey(value)); return cell.resetFocus(context, cellParent, value); } return false; }