Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.cs
===================================================================
diff -u -rb9d3e9f07eb3d45c0b608fc219982c4ddec05d6a -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.cs (.../CalculatableView.cs) (revision b9d3e9f07eb3d45c0b608fc219982c4ddec05d6a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.cs (.../CalculatableView.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -35,14 +35,15 @@
/// Base view for calculatable objects such as views
/// which should be derived in order to get a consistent look and feel.
///
- public abstract partial class CalculatableView : UserControl, ISelectionProvider
+ /// The type of the calculatable object.
+ public abstract partial class CalculatableView : UserControl, ISelectionProvider where T : class
{
private const int calculateColumnIndex = 0;
private bool updatingDataSource;
public event EventHandler SelectionChanged;
///
- /// Creates a new instance of .
+ /// Creates a new instance of .
///
protected CalculatableView()
{
@@ -93,7 +94,7 @@
///
protected virtual void InitializeDataGridView()
{
- dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName(row => row.ToCalculate),
+ dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName>(row => row.ToCalculate),
Resources.HydraulicBoundaryLocationsView_Calculate);
}
@@ -114,11 +115,25 @@
///
protected abstract void CalculateForSelectedRows();
- protected IEnumerable GetCalculatableRows()
+ ///
+ /// Gets all the row items from the .
+ ///
+ /// All row items from the .
+ protected IEnumerable> GetCalculatableRows()
{
- return dataGridViewControl.Rows.Cast().Select(row => (CalculatableRow) row.DataBoundItem);
+ return dataGridViewControl.Rows.Cast().Select(row => (CalculatableRow) row.DataBoundItem);
}
+ ///
+ /// Gets all the selected calculatable objects.
+ ///
+ ///
+ protected IEnumerable GetSelectedLocations()
+ {
+ return GetCalculatableRows().Where(r => r.ToCalculate)
+ .Select(r => r.CalculatableObject);
+ }
+
private void LocalizeControls()
{
CalculateForSelectedButton.Text = Resources.HydraulicBoundaryLocationsView_CalculateForSelectedButton_Text;