public CellState Clone() { CellState cellState = new CellState(); cellState.m_content = m_content; cellState.m_contentBeforeRowEdition = m_contentBeforeRowEdition; cellState.m_contentBeforeCellEdition = m_contentBeforeCellEdition; cellState.m_isDirtyBeforeEdition = m_isDirtyBeforeEdition; cellState.m_cellValidationError = m_cellValidationError; cellState.m_isBeingEdited = m_isBeingEdited; cellState.m_isDirty = m_isDirty; return cellState; }
// Used to initialize/clear Column.CurrentRowInEditionCellState for each cell in the row passed as parameter internal void UpdateCurrentRowInEditionCellStates( Row newCurrentItemContainer, object newCurrentItemInEdition ) { if( newCurrentItemInEdition != m_currentItemInEdition ) { Row currentRowInEdition = null; if( m_currentItemInEdition != null ) { // Get the container for m_currentItemInEdition currentRowInEdition = Row.FromContainer( this.CurrentContext.GetContainerFromItem( m_currentItemInEdition ) ); if( newCurrentItemInEdition != null ) { if( ( currentRowInEdition != null ) && ( currentRowInEdition.IsBeingEdited ) ) throw new InvalidOperationException( "An attempt was made to place a row in edit mode while another row is being edited." ); } } // The newCurrentItemContainer is null if( newCurrentItemContainer == null ) { if( currentRowInEdition != null ) { // We must clear the edition state of the old Row in edition foreach( Cell cell in currentRowInEdition.CreatedCells ) { ColumnBase parentColumn = cell.ParentColumn; if( parentColumn == null ) continue; parentColumn.CurrentRowInEditionCellState = null; } } } m_currentItemInEdition = newCurrentItemInEdition; m_currentRowInEditionState = new RowState(); this.UpdateIsBeingEdited(); } // It may occur that the newCurrentItemInEdition was set for a // Container that is currently out of view, so the newCurrentItemContainer // was null at this time. We must then ensure the CellStates are // create for the newCurrentItemContainer when not null even if // newCurrentItemInEdition == m_currentItemInEdition if( newCurrentItemContainer != null ) { foreach( Cell cell in newCurrentItemContainer.CreatedCells ) { ColumnBase parentColumn = cell.ParentColumn; if( parentColumn == null ) continue; CellState cellState = new CellState(); cellState.SetContentBeforeRowEdition( cell.Content ); parentColumn.CurrentRowInEditionCellState = cellState; } } }
protected internal virtual void PostInitialize() { if( this.ParentRow.IsBeingEdited ) { // Cell was added to the row's CreatedCells. Update the parentColumn's cell in edition state. ColumnBase parentColumn = this.ParentColumn; if( ( parentColumn != null ) && ( parentColumn.CurrentRowInEditionCellState == null ) ) { CellState cellState = new CellState(); cellState.SetContentBeforeRowEdition( this.Content ); parentColumn.CurrentRowInEditionCellState = cellState; } } }