Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs =================================================================== diff -u -r80744f9014a001284116723df29bab8b319c38b7 -r2fca3f7ae1037eaa9c355b64d7cd0c390143ea8f --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision 80744f9014a001284116723df29bab8b319c38b7) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision 2fca3f7ae1037eaa9c355b64d7cd0c390143ea8f) @@ -59,7 +59,7 @@ /// /// Sets the failure mechanism. /// - public IFailureMechanism FailureMechanism + public virtual IFailureMechanism FailureMechanism { set { @@ -127,15 +127,14 @@ } /// - /// Gives the cell at , an - /// enabled style. + /// Restore the initial style of the cell at , . /// /// The row index of the cell. /// The column index of the cell. - protected void EnableCell(int rowIndex, int columnIndex) + protected void RestoreCell(int rowIndex, int columnIndex) { var cell = dataGridView.Rows[rowIndex].Cells[columnIndex]; - cell.ReadOnly = false; + cell.ReadOnly = GetDataGridColumns().ElementAt(columnIndex).ReadOnly; SetCellStyle(cell, CellStyle.Enabled); } @@ -147,11 +146,16 @@ /// The column index of the cell. protected void DisableCell(int rowIndex, int columnIndex) { - var cell = dataGridView.Rows[rowIndex].Cells[columnIndex]; + var cell = GetCell(rowIndex, columnIndex); cell.ReadOnly = true; SetCellStyle(cell, CellStyle.Disabled); } + protected DataGridViewCell GetCell(int rowIndex, int columnIndex) + { + return dataGridView.Rows[rowIndex].Cells[columnIndex]; + } + /// /// Gets all the columns that should be added to the on the /// . @@ -176,6 +180,25 @@ } /// + /// Updates the data source of the data grid view with the current known failure mechanism section results. + /// + protected void UpdataDataGridViewDataSource() + { + EndEdit(); + dataGridView.DataSource = failureMechanismSectionResult.Select(CreateFailureMechanismSectionResultRow).ToList(); + } + + /// + /// Gets data that is visualized on the row a the given . + /// + /// The position of the row in the data source. + /// The data bound to the row at index . + protected object GetDataAtRow(int rowIndex) + { + return dataGridView.Rows[rowIndex].DataBoundItem; + } + + /// /// Creates a display object for which is added to the /// on the . /// @@ -204,13 +227,6 @@ cell.Style.ForeColor = style.TextColor; } - private void UpdataDataGridViewDataSource() - { - EndEdit(); - - dataGridView.DataSource = failureMechanismSectionResult.Select(sr => CreateFailureMechanismSectionResultRow(sr)).ToList(); - } - private void RefreshDataGridView() { dataGridView.Refresh();