public void clearHighlightRow(String rowKey, String removeThisStyle){ if(rowMap.containsKey(rowKey)){ this.getRowFormatter().removeStyleName(rowMap.get(rowKey).intValue(), removeThisStyle); } }
/** * {@inheritDoc} */ public void selectRows(int toRow) { super.selectRows(toRow); HTMLTable.RowFormatter formatter = getRowFormatter(); int from = Math.min(getCurrentRow(), toRow); int to = Math.max(getCurrentRow(), toRow); for (int i = from; i <= to; i++) { if (formatter.getStyleName(i).contains(HierarchicalGrid.SUBGRID_ROW_STYLE)) { formatter.removeStyleName(i, "selected-row"); getSelectionModel().remove(i); } } }
/** * Setter for property 'currentRow'. * * @param currentRow Value to set for property 'currentRow'. */ public void setCurrentRow(int currentRow) { HTMLTable.RowFormatter rowFormatter = getRowFormatter(); int[] oldRows = getCurrentRows(); boolean same = false; for (int oldRow : oldRows) { if (oldRow >= 0 && oldRow < getRowCount()) rowFormatter.removeStyleName(oldRow, "selected-row"); if (oldRow == currentRow) same = true; } if (currentRow >= 0 && currentRow < getRowCount()) { getSelectionModel().clear(); selectRow(currentRow); } for (Iterator iterator = getSelectRowListeners().iterator(); !same && iterator.hasNext();) { SelectRowListener selectRowListener = (SelectRowListener) iterator.next(); selectRowListener.onSelect(this, currentRow); } }
table.setWidget(row, 2, warning); } else { table.getRowFormatter().removeStyleName(row, "warning"); table.setWidget(row, 2, new KSLabel(""));
HTMLTable.RowFormatter rowFormatter = getRowFormatter(); for (int i = 0; i < rowCount; i++) { rowFormatter.removeStyleName(i, "selected-row");
/*************************************** * Updates the odd/even row styles for all visible rows beginning with a * certain starting row. * * @param nRow The starting row */ private void updateRowStyles(int nRow) { RowFormatter rRowFormatter = aDataTable.getRowFormatter(); int nMax = nVisibleDataRows; boolean bOdd = (nRow % 2) == 1; while (nRow < nMax) { if (bOdd) { rRowFormatter.addStyleName(nRow, CSS.ewtOdd()); } else { rRowFormatter.removeStyleName(nRow, CSS.ewtOdd()); } bOdd = !bOdd; nRow++; } } }
/** * This method deselects the specified cell. * * @param row is a row number in the grid. * @param column is a column number in the grid. */ public void deselectCell(int row, int column) { if (row >= 0 && row < getRowCount()) { getSelectionModel().remove(row); HTMLTable.RowFormatter rowFormatter = getRowFormatter(); rowFormatter.removeStyleName(row, "selected-row"); if (column >= 0 && column < getCellCount(row)) { getColumnFormatter().removeStyleName(column, "selected-column"); getCellFormatter().removeStyleName(row, column, "selected-cell"); this.currentColumn = -1; } } }
/** * This method marks the specified row as selected.<p/> * It works similarly to the {@link #setCurrentRow(int)} method but doesn't clear a previous selection. * If the multiple rows selection is disabled it checks whether there is at least one selected row and if no * it makes selection. Otherwise it does nothing.<p/> * If multiple mode is enabled it always selects a row. * * @param row is a row number to make selected. */ public void selectRow(int row) { if ((isMultiRowModeEnabled() || getSelectionModel().size() <= 0) && row >= 0 && row < getRowCount()) { HTMLTable.RowFormatter rowFormatter = getRowFormatter(); rowFormatter.removeStyleName(row, "selected-row"); rowFormatter.addStyleName(row, "selected-row"); getSelectionModel().add(row, getGridRowByRowNumber(row)); } }
public void markDiffs(String style){ //skip first row, will always be title related for(int i = 1; i < rowIndex; i++){ if(getFlexCellFormatter().getColSpan(i, 0) == 1 && getFlexCellFormatter().getColSpan(i, 1) == 1 && getFlexCellFormatter().getColSpan(i, 2) == 1){ Element cell1 = this.getCellFormatter().getElement(i, 1); Element cell2 = this.getCellFormatter().getElement(i, 2); if(!cell1.getInnerText().equals(cell2.getInnerText())){ this.getRowFormatter().addStyleName(i, style); } else{ this.getRowFormatter().removeStyleName(i, style); } } } }
/*************************************** * Sets the style of a row to be unselected. * * @param nRow The row to set to be unselected */ void setRowUnselected(int nRow) { if (nRow >= 0 && nRow < nVisibleDataRows) { RowFormatter rRowFormatter = aDataTable.getRowFormatter(); rRowFormatter.removeStyleName(nRow, CSS.ewtSelected()); } }
public void clearHighlightedRows(String removeThisStyle){ for(int i = 0; i < rowIndex; i++){ this.getRowFormatter().removeStyleName(i, removeThisStyle); } }
private void styleRow(final int row, final boolean selected) { String style = resources.css().browserTabSelectedRow(); if (selected) { table.getRowFormatter().addStyleName(row, style); } else { table.getRowFormatter().removeStyleName(row, style); } }