/** * 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(); } }
/** * Given a click event, return the Cell that was clicked, or null if the event * did not hit this table. The cell can also be null if the click event does * not occur on a specific cell. * * @param event A click event of indeterminate origin * @return The appropriate cell, or null */ public Cell getCellForEvent(ClickEvent event) { Element td = getEventTargetCell(Event.as(event.getNativeEvent())); if (td == null) { return null; } int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex(); int column = TableCellElement.as(td).getCellIndex(); return new Cell(row, column); }
/** * 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(); } }
/** * Get the index of the row value from the associated {@link TableRowElement}. * * @param row the row element * @return the row value index */ public final int getRowValueIndex(TableRowElement row) { return row.getSectionRowIndex() + getView().getVisibleRange().getStart(); }
/** * Get the index of the row value from the associated {@link TableRowElement}. * * @param row the row element * @return the row value index */ public final int getRowValueIndex(TableRowElement row) { return row.getSectionRowIndex() + getView().getVisibleRange().getStart(); }
private List<String> getDraggedRows(NativeEvent dragStartEvent) { List<String> draggedRows = new ArrayList<>(); if (TableRowElement.is(dragStartEvent.getEventTarget())) { TableRowElement row = dragStartEvent.getEventTarget().cast(); TableWidget tableWidget = getTableWidget(); if (tableWidget == null) { draggedRows.add(String.valueOf(row.getSectionRowIndex())); return draggedRows; } if (isRowSelected(row)) { return getAllVisibleSelectedRows(); } draggedRows.add(getDraggedRowKey(row)); } return draggedRows; }
/** * Borrowed from CellTable#onBrowserEvent2(Event event) * * @param target * @return */ public static int identifyRow(Element target) { // Find the cell where the event occurred. TableCellElement tableCell = findNearestParentCell(target); if (tableCell == null) { return -1; } // Determine if we are in the header, footer, or body. Its possible that // the table has been refreshed before the current event fired (ex. change // event refreshes before mouseup fires), so we need to check each parent // element. Element trElem = tableCell.getParentElement(); if (trElem == null) { return -1; } TableRowElement tr = TableRowElement.as(trElem); Element sectionElem = tr.getParentElement(); if (sectionElem == null) { return -1; } int row = tr.getSectionRowIndex(); return row; }
int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex(); int column = TableCellElement.as(td).getCellIndex();
/** * Given a click event, return the Cell that was clicked, or null if the event * did not hit this table. The cell can also be null if the click event does * not occur on a specific cell. * * @param event A click event of indeterminate origin * @return The appropriate cell, or null */ public Cell getCellForEvent(ClickEvent event) { Element td = getEventTargetCell(Event.as(event.getNativeEvent())); if (td == null) { return null; } int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex(); int column = TableCellElement.as(td).getCellIndex(); return new Cell(row, column); }
/** * Given a click event, return the Cell that was clicked, or null if the event * did not hit this table. The cell can also be null if the click event does * not occur on a specific cell. * * @param event A click event of indeterminate origin * @return The appropriate cell, or null */ public Cell getCellForEvent(ClickEvent event) { Element td = getEventTargetCell(Event.as(event.getNativeEvent())); if (td == null) { return null; } int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex(); int column = TableCellElement.as(td).getCellIndex(); return new Cell(row, column); }