/** * {@inheritDoc} * * <p> * The row element may not be the same as the TR element at the specified * index if some row values are rendered with additional rows. * </p> * * @param row the row index, relative to the page start * @return the row element, or null if it doesn't exists * @throws IndexOutOfBoundsException if the row index is outside of the * current page */ @Override protected TableRowElement getChildElement(int row) { return getSubRowElement(row + getPageStart(), 0); }
/** * Get the index of the row value from the associated {@link TableRowElement}. * * @param row the row element * @return the row value index */ @Override public final int getRowValueIndex(TableRowElement row) { try { return Integer.parseInt(row.getAttribute(ROW_ATTRIBUTE)); } catch (NumberFormatException e) { // The attribute doesn't exist. Maybe the user is overriding // renderRowValues(). return row.getSectionRowIndex() + cellTable.getPageStart(); } }
@SuppressWarnings("deprecation") @Override protected void replaceChildren(List<T> values, int start, SafeHtml html) { refreshHeadersAndColumnsImpl(); /* * If html is not null and legacyRenderRowValues is true, then the user * override renderRowValues() and rendered directly into a SafeHtmlBuilder. * The legacy method is deprecated but still supported. */ if (html == null || legacyRenderRowValues == false) { html = buildRowValues(values, getPageStart() + start, false); } TABLE_IMPL.replaceChildren(this, getTableBodyElement(), CellBasedWidgetImpl.get().processHtml( html), start, values.size()); }
@Override protected void replaceAllChildren(List<T> values, SafeHtml html) { refreshHeadersAndColumnsImpl(); /* * If html is not null and legacyRenderRowValues is true, then the user * overrode renderRowValues() and rendered directly into a SafeHtmlBuilder. * The legacy method is deprecated but still supported. */ if (html == null || legacyRenderRowValues == false) { html = buildRowValues(values, getPageStart(), true); } TABLE_IMPL.replaceAllRows(this, getTableBodyElement(), CellBasedWidgetImpl.get().processHtml( html)); }
/** * Get the {@link TableCellElement} that is currently keyboard selected. * * @return the table cell element, or null if not selected */ private TableCellElement getKeyboardSelectedTableCellElement() { int colIndex = getKeyboardSelectedColumn(); if (colIndex < 0) { return null; } // Do not use getRowElement() because that will flush the presenter. int rowIndex = getKeyboardSelectedRow(); if (rowIndex < 0 || rowIndex >= getTableBodyElement().getRows().getLength()) { return null; } TableRowElement tr = getSubRowElement(rowIndex + getPageStart(), keyboardSelectedSubrow); if (tr != null) { int cellCount = tr.getCells().getLength(); if (cellCount > 0) { int column = Math.min(colIndex, cellCount - 1); return tr.getCells().getItem(column); } } return null; }
@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; }
int relRow = absRow - getPageStart(); checkRowBounds(relRow);
TableRowElement tr = getSubRowElement(index + getPageStart(), subrow); if (tr == null) {
/** * {@inheritDoc} * * <p> * The row element may not be the same as the TR element at the specified * index if some row values are rendered with additional rows. * </p> * * @param row the row index, relative to the page start * @return the row element, or null if it doesn't exists * @throws IndexOutOfBoundsException if the row index is outside of the * current page */ @Override protected TableRowElement getChildElement(int row) { return getSubRowElement(row + getPageStart(), 0); }
/** * {@inheritDoc} * * <p> * The row element may not be the same as the TR element at the specified * index if some row values are rendered with additional rows. * </p> * * @param row the row index, relative to the page start * @return the row element, or null if it doesn't exists * @throws IndexOutOfBoundsException if the row index is outside of the * current page */ @Override protected TableRowElement getChildElement(int row) { return getSubRowElement(row + getPageStart(), 0); }
int relRow = event.getIndex() - table.getPageStart(); int subrow = event.getContext().getSubIndex(); if ((table.getKeyboardSelectedColumn() != col)
protected final void renderRowValuesLegacy(SafeHtmlBuilder sb, List<T> values, int start, SelectionModel<? super T> selectionModel) { int keyboardSelectedRow = getKeyboardSelectedRow() + getPageStart(); String evenRowStyle = style.evenRow(); String oddRowStyle = style.oddRow();
/** * Get the index of the row value from the associated {@link TableRowElement}. * * @param row the row element * @return the row value index */ @Override public final int getRowValueIndex(TableRowElement row) { try { return Integer.parseInt(row.getAttribute(ROW_ATTRIBUTE)); } catch (NumberFormatException e) { // The attribute doesn't exist. Maybe the user is overriding // renderRowValues(). return row.getSectionRowIndex() + cellTable.getPageStart(); } }
/** * Get the index of the row value from the associated {@link TableRowElement}. * * @param row the row element * @return the row value index */ @Override public final int getRowValueIndex(TableRowElement row) { try { return Integer.parseInt(row.getAttribute(ROW_ATTRIBUTE)); } catch (NumberFormatException e) { // The attribute doesn't exist. Maybe the user is overriding // renderRowValues(). return row.getSectionRowIndex() + cellTable.getPageStart(); } }
int relRow = absRow - getPageStart(); int subrow = tableBuilder.getSubrowValueIndex(targetTableRow);
final int absEndIndex = table.getPageStart() + startIndex + childCount;
@SuppressWarnings("deprecation") @Override protected void replaceChildren(List<T> values, int start, SafeHtml html) { refreshHeadersAndColumnsImpl(); /* * If html is not null and legacyRenderRowValues is true, then the user * override renderRowValues() and rendered directly into a SafeHtmlBuilder. * The legacy method is deprecated but still supported. */ if (html == null || legacyRenderRowValues == false) { html = buildRowValues(values, getPageStart() + start, false); } TABLE_IMPL.replaceChildren(this, getTableBodyElement(), CellBasedWidgetImpl.get().processHtml( html), start, values.size()); }
@SuppressWarnings("deprecation") @Override protected void replaceChildren(List<T> values, int start, SafeHtml html) { refreshHeadersAndColumnsImpl(); /* * If html is not null and legacyRenderRowValues is true, then the user * override renderRowValues() and rendered directly into a SafeHtmlBuilder. * The legacy method is deprecated but still supported. */ if (html == null || legacyRenderRowValues == false) { html = buildRowValues(values, getPageStart() + start, false); } TABLE_IMPL.replaceChildren(this, getTableBodyElement(), CellBasedWidgetImpl.get().processHtml( html), start, values.size()); }
@Override protected void replaceAllChildren(List<T> values, SafeHtml html) { refreshHeadersAndColumnsImpl(); /* * If html is not null and legacyRenderRowValues is true, then the user * overrode renderRowValues() and rendered directly into a SafeHtmlBuilder. * The legacy method is deprecated but still supported. */ if (html == null || legacyRenderRowValues == false) { html = buildRowValues(values, getPageStart(), true); } TABLE_IMPL.replaceAllRows(this, getTableBodyElement(), CellBasedWidgetImpl.get().processHtml( html)); }
@Override protected void replaceAllChildren(List<T> values, SafeHtml html) { refreshHeadersAndColumnsImpl(); /* * If html is not null and legacyRenderRowValues is true, then the user * overrode renderRowValues() and rendered directly into a SafeHtmlBuilder. * The legacy method is deprecated but still supported. */ if (html == null || legacyRenderRowValues == false) { html = buildRowValues(values, getPageStart(), true); } TABLE_IMPL.replaceAllRows(this, getTableBodyElement(), CellBasedWidgetImpl.get().processHtml( html)); }