/** * Apply a style to a row and all cells in the row. * * @param tr the row element * @param rowStyle the style to apply to the row * @param cellStyle the style to apply to the cells * @param add true to add the style, false to remove */ private void setRowStyleName(TableRowElement tr, String rowStyle, String cellStyle, boolean add) { setStyleName(tr, rowStyle, add); NodeList<TableCellElement> cells = tr.getCells(); for (int i = 0; i < cells.getLength(); i++) { setStyleName(cells.getItem(i), cellStyle, add); } }
/** * 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; }
boolean updatedSelection = !selected || isFocused || stealFocus; setRowStyleName(tr, style.keyboardSelectedRow(), style.keyboardSelectedRowCell(), selected); NodeList<TableCellElement> cells = tr.getCells(); int keyboardColumn = Math.min(getKeyboardSelectedColumn(), cells.getLength() - 1); for (int i = 0; i < cells.getLength(); i++) {
private List<TableCellElement> getCells(NodeList<TableRowElement> rows, int columnIndex) { List<TableCellElement> result = new ArrayList<>(); for (int i = 0; i < rows.getLength(); i++) { TableCellElement cell = rows.getItem(i).getCells().getItem(columnIndex); if (cell != null) { result.add(cell); } } return result; }
private void setCursorType( Cursor cursor ) { for ( int iRow = 0; iRow < widget.rowHeaders.length; iRow++ ) { TableRowElement tre = widget.rowHeaders[ iRow ].<TableRowElement>cast(); for ( int iCol = 0; iCol < tre.getCells().getLength(); iCol++ ) { TableCellElement tce = tre.getCells().getItem( iCol ); tce.getStyle().setCursor( cursor ); } } }
private void setCursorType( Cursor cursor ) { for ( int iRow = 0; iRow < widget.headerRows.length; iRow++ ) { TableRowElement tre = widget.headerRows[ iRow ].<TableRowElement>cast(); for ( int iCol = 0; iCol < tre.getCells().getLength(); iCol++ ) { TableCellElement tce = tre.getCells().getItem( iCol ); tce.getStyle().setCursor( cursor ); } } }
public static void setTooltip( DataGrid<ProcessVariableSummary> varListGrid, String idCurrentRow, int column, String newValue, String oldValue ) { for ( int i = 0; i < getCurrentRowCount( varListGrid ); i++ ) { if ( varListGrid.getRowElement( i ).getCells().getItem( 0 ).getInnerText().equals( newValue.substring( 0, 20 ) + "..." ) ) { varListGrid.getRowElement( i ).getCells().getItem( column ).setTitle( "New Value: " + newValue + ", Old Value: " + oldValue ); break; } } }
@PatchMethod static TableCellElement insertCell(TableRowElement element, int index) { List<Node> innerList = JsoUtils.getChildNodeInnerList(element); TableCellElement newCell = Document.get().createTDElement(); if (index == -1 || index >= element.getCells().getLength()) { innerList.add(newCell); } else { innerList.add(index, newCell); } return newCell; }
@PatchMethod static TableCellElement insertCell(TableRowElement element, int index) { List<Node> innerList = JsoUtils.getChildNodeInnerList(element); TableCellElement newCell = Document.get().createTDElement(); if (index == -1 || index >= element.getCells().getLength()) { innerList.add(newCell); } else { innerList.add(index, newCell); } return newCell; }
public void setTooltip( int row, int column, String description ) { dataGrid.getRowElement( row ).getCells().getItem( column ).setTitle( description ); }
public void setTooltip(int row, int column, String description) { dataGrid.getRowElement(row).getCells().getItem(column).setTitle(description); }
public static String getProcessInstanceVersionRowSelected( DataGrid<ProcessInstanceSummary> myProcessInstanceListGrid ) { String processDefVersion = null; for ( int i = 0; i < myProcessInstanceListGrid.getRowCount(); i++ ) { if ( myProcessInstanceListGrid.getRowElement( i ).getCells().getItem( 3 ).getStyle().getBackgroundColor().equals( BG_ROW_SELECTED ) ) { processDefVersion = myProcessInstanceListGrid.getRowElement( i ).getCells().getItem( 3 ).getInnerText(); break; } } return processDefVersion; }
public static String getProcessVersionRowSelected( DataGrid<ProcessSummary> myProcessDefListGrid ) { String processDefVersion = null; for ( int i = 0; i < myProcessDefListGrid.getRowCount(); i++ ) { if ( myProcessDefListGrid.getRowElement( i ).getCells().getItem( 1 ).getStyle().getBackgroundColor().equals( BG_ROW_SELECTED ) ) { processDefVersion = myProcessDefListGrid.getRowElement( i ).getCells().getItem( 1 ).getInnerText(); break; } } return processDefVersion; }
public static String getProcessInstanceNameRowSelected( DataGrid<ProcessInstanceSummary> myProcessInstanceListGrid ) { String processDefName = null; for ( int i = 0; i < myProcessInstanceListGrid.getRowCount(); i++ ) { if ( myProcessInstanceListGrid.getRowElement( i ).getCells().getItem( 1 ).getStyle().getBackgroundColor().equals( BG_ROW_SELECTED ) ) { processDefName = myProcessInstanceListGrid.getRowElement( i ).getCells().getItem( 1 ).getInnerText(); break; } } return processDefName; }
public static String getProcessInstanceStartDateRowSelected( DataGrid<ProcessInstanceSummary> myProcessInstanceListGrid ) { String processStartDate = null; for ( int i = 0; i < myProcessInstanceListGrid.getRowCount(); i++ ) { if ( myProcessInstanceListGrid.getRowElement( i ).getCells().getItem( 5 ).getStyle().getBackgroundColor().equals( BG_ROW_SELECTED ) ) { processStartDate = myProcessInstanceListGrid.getRowElement( i ).getCells().getItem( 5 ).getInnerText(); break; } } return processStartDate; }
public static String getProcessNameRowSelected( DataGrid<ProcessSummary> myProcessDefListGrid ) { String processDefName = null; for ( int i = 0; i < myProcessDefListGrid.getRowCount(); i++ ) { if ( myProcessDefListGrid.getRowElement( i ).getCells().getItem( 0 ).getStyle().getBackgroundColor().equals( BG_ROW_SELECTED ) ) { processDefName = myProcessDefListGrid.getRowElement( i ).getCells().getItem( 0 ).getInnerText(); break; } } return processDefName; }
@Override public void onRowOut(int rowNum) { if(!table.isEnabled()) return; if(rowNum<provider.getList().size()) { TableCellElement rollOverItem = table.getRowElement(rowNum).getCells().getItem(2); rollOverItem.getFirstChildElement().getFirstChildElement().removeClassName("row-tools-enabled"); } } }
@Override public void onRowOver(int rowNum) { if(!table.isEnabled()) return; // toggle rollover tools if(rowNum<provider.getList().size()) { TableCellElement rollOverItem = table.getRowElement(rowNum).getCells().getItem(2); rollOverItem.getFirstChildElement().getFirstChildElement().addClassName("row-tools-enabled"); } }
@PatchMethod static int getCellIndex(TableCellElement element) { TableRowElement row = TableRowElement.as(element.getParentElement()); for (int i = 0; i < row.getCells().getLength(); i++) { if (element.equals(row.getChild(i))) { return i; } } return -1; }
@PatchMethod static int getCellIndex(TableCellElement element) { TableRowElement row = TableRowElement.as(element.getParentElement()); for (int i = 0; i < row.getCells().getLength(); i++) { if (element.equals(row.getChild(i))) { return i; } } return -1; }