public void updateSystemControlledColumnValues() { final DynamicData data = widget.getGridWidget().getData(); final List<DynamicColumn<DTColumnConfig>> columns = widget.getGridWidget().getColumns(); for (DynamicColumn<DTColumnConfig> col : columns) { DTColumnConfig modelColumn = col.getModelColumn(); if (modelColumn instanceof RowNumberCol) { updateRowNumberColumnValues(data, col.getColumnIndex()); } else if (modelColumn instanceof AttributeCol) { // Update Salience values AttributeCol attrCol = (AttributeCol) modelColumn; if (attrCol.getAttribute().equals(RuleAttributeWidget.SALIENCE_ATTR)) { if (attrCol.isUseRowNumber()) { updateSalienceColumnValues(data, col.getColumnIndex(), attrCol.isReverseOrder()); } // Ensure Salience cells are rendered with the correct Cell col.setCell(cellFactory.getCell(attrCol)); col.setSystemControlled(attrCol.isUseRowNumber()); col.setSortable(!attrCol.isUseRowNumber()); } } } }
// Ensure the values in a column are within the Value List private boolean updateCellsForOptionValueList( final DTColumnConfig editColumn, final DynamicColumn<DTColumnConfig> column) { boolean bRedrawRequired = false; DynamicData data = widget.getGridWidget().getData(); List<String> vals = Arrays.asList(model.getValueList(editColumn, sce)); column.setCell(cellFactory.getCell(editColumn)); int iCol = column.getColumnIndex(); for (int iRow = 0; iRow < data.size(); iRow++) { DynamicDataRow row = data.get(iRow); if (!vals.contains(row.get(iCol).getValue())) { row.get(iCol).setValue(null); bRedrawRequired = true; } } return bRedrawRequired; }
// Ensure the Column cell type and corresponding values are correct private void updateCellsForDataType( final DTColumnConfig editColumn, final DynamicColumn<DTColumnConfig> column) { // Grouping needs to be removed if (widget.getGridWidget().getData().isMerged()) { widget.getGridWidget().toggleMerging(); } DynamicData data = widget.getGridWidget().getData(); column.setCell(cellFactory.getCell(editColumn)); for (int iRow = 0; iRow < data.size(); iRow++) { DynamicDataRow row = data.get(iRow); row.set( column.getColumnIndex(), cellValueFactory.makeCellValue(editColumn, iRow, column.getColumnIndex())); } }