// Copy values from one (transient) model column into another private void populateModelColumn( final ActionInsertFactCol col, final ActionInsertFactCol editingCol) { col.setBoundName(editingCol.getBoundName()); col.setType(editingCol.getType()); col.setFactField(editingCol.getFactField()); col.setHeader(editingCol.getHeader()); col.setValueList(editingCol.getValueList()); col.setDefaultValue(editingCol.getDefaultValue()); col.setHideColumn(editingCol.isHideColumn()); col.setFactType(editingCol.getFactType()); col.setInsertLogical(editingCol.isInsertLogical()); }
/** * Update an ActionSetFieldCol column * * @param origCol The existing column in the grid * @param editColumn A copy (not clone) of the original column containing the modified values */ public void updateColumn( final ActionInsertFactCol origColumn, final ActionInsertFactCol editColumn) { if (origColumn == null) { throw new IllegalArgumentException("origColumn cannot be null"); } if (editColumn == null) { throw new IllegalArgumentException("editColumn cannot be null"); } boolean bRedrawColumn = false; boolean bRedrawHeader = false; DynamicColumn<DTColumnConfig> column = getDynamicColumn(origColumn); // Update column's visibility if (origColumn.isHideColumn() != editColumn.isHideColumn()) { setColumnVisibility(origColumn, !editColumn.isHideColumn()); } // Change in column's binding forces an update and redraw if FactType or // FactField are different; otherwise only need to update and redraw if // the FactType or FieldType have changed if (!isEqualOrNull(origColumn.getBoundName(), editColumn.getBoundName())) { if (!isEqualOrNull(origColumn.getFactType(), editColumn.getFactType()) || !isEqualOrNull(origColumn.getFactField(), editColumn.getFactField())) { bRedrawColumn = true; updateCellsForDataType(editColumn, column); } } else if (!isEqualOrNull(origColumn.getFactType(), editColumn.getFactType()) || !isEqualOrNull(origColumn.getFactField(), editColumn.getFactField())) { bRedrawColumn = true; updateCellsForDataType(editColumn, column); } // Update column's cell content if the Optional Value list has changed if (!isEqualOrNull(origColumn.getValueList(), editColumn.getValueList())) { bRedrawColumn = updateCellsForOptionValueList(editColumn, column); } // Update column header in Header Widget if (!origColumn.getHeader().equals(editColumn.getHeader())) { bRedrawHeader = true; } // Copy new values into original column definition populateModelColumn(origColumn, editColumn); if (bRedrawColumn) { int maxColumnIndex = widget.getGridWidget().getColumns().size() - 1; widget.getGridWidget().redrawColumns(column.getColumnIndex(), maxColumnIndex); } if (bRedrawHeader) { // Schedule redraw event after column has been redrawn Scheduler.get() .scheduleFinally( new ScheduledCommand() { public void execute() { widget.getHeaderWidget().redraw(); } }); } }