Index: Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs
===================================================================
diff -u -r75fe077813084ef8a06b38bd149cf443acf73d27 -r28e867674791c1111107ea44e960313f43fc6aea
--- Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs (.../DataGridViewControlTest.cs) (revision 75fe077813084ef8a06b38bd149cf443acf73d27)
+++ Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs (.../DataGridViewControlTest.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -1292,6 +1292,7 @@
// Call
control.RemoveCellClickHandler(dataGridViewCellEventHandler);
+ gridTester.FireEvent("CellClick", new DataGridViewCellEventArgs(0, 0));
// Assert
Assert.AreEqual(1, counter);
@@ -1360,7 +1361,6 @@
int counter = 0;
DataGridViewCellEventHandler dataGridViewCellEventHandler = (sender, args) => counter++;
-
control.AddCellValueChangedHandler(dataGridViewCellEventHandler);
// Precondition
@@ -1369,7 +1369,8 @@
Assert.AreEqual(1, counter);
// Call
- control.RemoveCellClickHandler(dataGridViewCellEventHandler);
+ control.RemoveCellValueChangedHandler(dataGridViewCellEventHandler);
+ gridTester.FireEvent("CellValueChanged", new DataGridViewCellEventArgs(0, 0));
// Assert
Assert.AreEqual(1, counter);
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r75fe077813084ef8a06b38bd149cf443acf73d27 -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 75fe077813084ef8a06b38bd149cf443acf73d27)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -1,25 +1,4 @@
-// Copyright (C) Stichting Deltares 2016. All rights reserved.
-//
-// This file is part of Ringtoets.
-//
-// Ringtoets is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
-//
-// All names, logos, and references to "Deltares" are registered trademarks of
-// Stichting Deltares and remain full property of Stichting Deltares at all times.
-// All rights reserved.
-
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
@@ -289,7 +268,7 @@
}
///
- /// Looks up a localized string similar to Alles &berekenen.
+ /// Looks up a localized string similar to Alles be&rekenen.
///
public static string DesignWaterLevel_Calculate_All {
get {
@@ -673,20 +652,20 @@
}
///
- /// Looks up a localized string similar to &Berekenen.
+ /// Looks up a localized string similar to Alles be&rekenen.
///
- public static string WaveHeight_Calculate {
+ public static string WaveHeight_Calculate_All {
get {
- return ResourceManager.GetString("WaveHeight_Calculate", resourceCulture);
+ return ResourceManager.GetString("WaveHeight_Calculate_All", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Bereken de golfhoogtes..
+ /// Looks up a localized string similar to Alle golfhoogtes berekenen..
///
- public static string WaveHeight_Calculate_ToolTip {
+ public static string WaveHeight_Calculate_All_ToolTip {
get {
- return ResourceManager.GetString("WaveHeight_Calculate_ToolTip", resourceCulture);
+ return ResourceManager.GetString("WaveHeight_Calculate_All_ToolTip", resourceCulture);
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx
===================================================================
diff -u -r75fe077813084ef8a06b38bd149cf443acf73d27 -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 75fe077813084ef8a06b38bd149cf443acf73d27)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -145,7 +145,7 @@
Weet u zeker dat u wilt doorgaan?
- Alles &berekenen
+ Alles be&rekenen
Alle toetspeilen berekenen.
@@ -291,11 +291,11 @@
Er is geen hydraulische randvoorwaardendatabase beschikbaar om de golfhoogtes te berekenen.
-
- &Berekenen
+
+ Alles be&rekenen
-
- Bereken de golfhoogtes.
+
+ Alle golfhoogtes berekenen.
Berekende golfhoogte.
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r161308cb864a66713f62357c6bcdb6ede03b619f -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 161308cb864a66713f62357c6bcdb6ede03b619f)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -102,6 +102,12 @@
DesignWaterLevelLocationsView.cs
+
+ UserControl
+
+
+ HydraulicBoundaryLocationsView.cs
+
@@ -281,6 +287,9 @@
DesignWaterLevelLocationsView.cs
Designer
+
+ HydraulicBoundaryLocationsView.cs
+
WaveHeightLocationsView.cs
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.Designer.cs
===================================================================
diff -u -r75fe077813084ef8a06b38bd149cf443acf73d27 -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.Designer.cs (.../DesignWaterLevelLocationsView.Designer.cs) (revision 75fe077813084ef8a06b38bd149cf443acf73d27)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.Designer.cs (.../DesignWaterLevelLocationsView.Designer.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -36,90 +36,28 @@
///
private void InitializeComponent()
{
- this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl();
- this.SelectAllButton = new System.Windows.Forms.Button();
- this.DeselectAllButton = new System.Windows.Forms.Button();
- this.CalculateForSelectedButton = new System.Windows.Forms.Button();
- this.ButtonGroupBox = new System.Windows.Forms.GroupBox();
- this.ButtonGroupBox.SuspendLayout();
this.SuspendLayout();
//
// dataGridViewControl
//
- this.dataGridViewControl.Dock = System.Windows.Forms.DockStyle.Fill;
- this.dataGridViewControl.Location = new System.Drawing.Point(0, 0);
- this.dataGridViewControl.MultiSelect = true;
- this.dataGridViewControl.Name = "dataGridViewControl";
- this.dataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
- this.dataGridViewControl.Size = new System.Drawing.Size(523, 346);
- this.dataGridViewControl.TabIndex = 0;
+ this.dataGridViewControl.Size = new System.Drawing.Size(523, 344);
//
- // SelectAllButton
- //
- this.SelectAllButton.Location = new System.Drawing.Point(6, 22);
- this.SelectAllButton.Name = "SelectAllButton";
- this.SelectAllButton.Size = new System.Drawing.Size(98, 23);
- this.SelectAllButton.TabIndex = 0;
- this.SelectAllButton.Text = "Selecteer alles";
- this.SelectAllButton.UseVisualStyleBackColor = true;
- this.SelectAllButton.Click += new System.EventHandler(this.SelectAllButton_Click);
- //
- // DeselectAllButton
- //
- this.DeselectAllButton.Location = new System.Drawing.Point(110, 22);
- this.DeselectAllButton.Name = "DeselectAllButton";
- this.DeselectAllButton.Size = new System.Drawing.Size(111, 23);
- this.DeselectAllButton.TabIndex = 1;
- this.DeselectAllButton.Text = "Deselecteer alles";
- this.DeselectAllButton.UseVisualStyleBackColor = true;
- this.DeselectAllButton.Click += new System.EventHandler(this.DeselectAllButton_Click);
- //
- // CalculateForSelectedButton
- //
- this.CalculateForSelectedButton.Enabled = false;
- this.CalculateForSelectedButton.Location = new System.Drawing.Point(227, 22);
- this.CalculateForSelectedButton.Name = "CalculateForSelectedButton";
- this.CalculateForSelectedButton.Size = new System.Drawing.Size(207, 23);
- this.CalculateForSelectedButton.TabIndex = 2;
- this.CalculateForSelectedButton.Text = "Bereken voor geselecteerde locaties";
- this.CalculateForSelectedButton.UseVisualStyleBackColor = true;
- this.CalculateForSelectedButton.Click += new System.EventHandler(this.CalculateForSelectedButton_Click);
- //
// ButtonGroupBox
//
- this.ButtonGroupBox.Controls.Add(this.CalculateForSelectedButton);
- this.ButtonGroupBox.Controls.Add(this.DeselectAllButton);
- this.ButtonGroupBox.Controls.Add(this.SelectAllButton);
- this.ButtonGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.ButtonGroupBox.Location = new System.Drawing.Point(0, 346);
- this.ButtonGroupBox.MinimumSize = new System.Drawing.Size(438, 59);
- this.ButtonGroupBox.Name = "ButtonGroupBox";
- this.ButtonGroupBox.Size = new System.Drawing.Size(523, 59);
- this.ButtonGroupBox.TabIndex = 1;
- this.ButtonGroupBox.TabStop = false;
+ this.ButtonGroupBox.Location = new System.Drawing.Point(0, 344);
+ this.ButtonGroupBox.Size = new System.Drawing.Size(523, 61);
this.ButtonGroupBox.Text = "Toetspeilen berekenen";
//
// DesignWaterLevelLocationsView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoScroll = true;
- this.AutoScrollMinSize = new System.Drawing.Size(520, 342);
- this.Controls.Add(this.dataGridViewControl);
- this.Controls.Add(this.ButtonGroupBox);
this.Name = "DesignWaterLevelLocationsView";
this.Size = new System.Drawing.Size(523, 405);
- this.ButtonGroupBox.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
-
- private Core.Common.Controls.DataGrid.DataGridViewControl dataGridViewControl;
- private System.Windows.Forms.Button SelectAllButton;
- private System.Windows.Forms.Button DeselectAllButton;
- private System.Windows.Forms.Button CalculateForSelectedButton;
- private System.Windows.Forms.GroupBox ButtonGroupBox;
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs
===================================================================
diff -u -rf6506495b1779b035fa6a39d8ab52f7420ceca7a -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision f6506495b1779b035fa6a39d8ab52f7420ceca7a)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -19,18 +19,10 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Windows.Forms;
-using Core.Common.Base;
-using Core.Common.Controls.Views;
-using Core.Common.Gui.Selection;
-using Core.Common.Utils.Extensions;
using Core.Common.Utils.Reflection;
-using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.HydraRing.Data;
-using Ringtoets.Integration.Forms.Commands;
using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.Properties;
@@ -39,82 +31,28 @@
///
/// View for the with .
///
- public partial class DesignWaterLevelLocationsView : UserControl, ISelectionProvider
+ public partial class DesignWaterLevelLocationsView : HydraulicBoundaryLocationsView
{
- private const int locationCalculateColumnIndex = 0;
- private readonly Observer assessmentSectionObserver;
- private readonly Observer hydraulicBoundaryDatabaseObserver;
- private IAssessmentSection assessmentSection;
- private bool updatingDataSource;
-
///
/// Creates a new instance of .
///
public DesignWaterLevelLocationsView()
{
InitializeComponent();
InitializeDataGridView();
-
- assessmentSectionObserver = new Observer(UpdateDataGridViewDataSource);
- hydraulicBoundaryDatabaseObserver = new Observer(() => dataGridViewControl.RefreshDataGridView());
}
- ///
- /// Gets or sets the .
- ///
- public IApplicationSelection ApplicationSelection { get; set; }
-
- ///
- /// Sets the .
- ///
- public IHydraulicBoundaryLocationCalculationCommandHandler CalculationCommandHandler { get; set; }
-
- public object Data
+ protected override void SetDataSource()
{
- get
- {
- return assessmentSection;
- }
- set
- {
- assessmentSection = value as IAssessmentSection;
-
- UpdateDataGridViewDataSource();
- assessmentSectionObserver.Observable = assessmentSection;
- }
+ dataGridViewControl.SetDataSource(AssessmentSection != null && AssessmentSection.HydraulicBoundaryDatabase != null
+ ? AssessmentSection.HydraulicBoundaryDatabase.Locations.Select(
+ hl => new DesignWaterLevelLocationContextRow(
+ new DesignWaterLevelLocationContext(AssessmentSection.HydraulicBoundaryDatabase, hl))).ToArray()
+ : null);
}
- public object Selection
- {
- get
- {
- return CreateSelectedItemFromCurrentRow();
- }
- }
-
- protected override void Dispose(bool disposing)
- {
- assessmentSectionObserver.Dispose();
- hydraulicBoundaryDatabaseObserver.Dispose();
-
- if (disposing && (components != null))
- {
- components.Dispose();
- }
-
- base.Dispose(disposing);
- }
-
- private void SetHydraulicBoundaryDatabaseObserver()
- {
- hydraulicBoundaryDatabaseObserver.Observable = assessmentSection != null ? assessmentSection.HydraulicBoundaryDatabase : null;
- }
-
private void InitializeDataGridView()
{
- dataGridViewControl.AddCellClickHandler(DataGridViewOnCellClick);
- dataGridViewControl.AddCellValueChangedHandler(DataGridViewCellValueChanged);
-
dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName(row => row.ToCalculate),
Resources.HydraulicBoundaryLocationsView_Calculate);
dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Name),
@@ -127,108 +65,9 @@
Resources.HydraulicBoundaryDatabase_Locations_DesignWaterLevel_DisplayName);
}
- private void UpdateDataGridViewDataSource()
+ protected override void HandleCalculateSelectedLocations(IEnumerable locations)
{
- SetHydraulicBoundaryDatabaseObserver();
-
- updatingDataSource = true;
- dataGridViewControl.SetDataSource(assessmentSection != null && assessmentSection.HydraulicBoundaryDatabase != null
- ? assessmentSection.HydraulicBoundaryDatabase.Locations.Select(
- hl => new DesignWaterLevelLocationContextRow(
- new DesignWaterLevelLocationContext(assessmentSection.HydraulicBoundaryDatabase, hl))).ToArray()
- : null);
- updatingDataSource = false;
- UpdateCalculateForSelectedButton();
- }
-
- private IEnumerable GetDesignWaterLevelLocationContextRows()
- {
- return dataGridViewControl.Rows.Cast().Select(row => (DesignWaterLevelLocationContextRow) row.DataBoundItem);
- }
-
- private IEnumerable GetSelectedHydraulicBoundaryLocationContext()
- {
- return GetDesignWaterLevelLocationContextRows().Where(r => r.ToCalculate).Select(r => r.HydraulicBoundaryLocationContext.HydraulicBoundaryLocation);
- }
-
- private void UpdateCalculateForSelectedButton()
- {
- CalculateForSelectedButton.Enabled = GetDesignWaterLevelLocationContextRows().Any(r => r.ToCalculate);
- }
-
- #region Event handling
-
- private void DataGridViewCellValueChanged(object sender, DataGridViewCellEventArgs e)
- {
- if (updatingDataSource || e.ColumnIndex != locationCalculateColumnIndex)
- {
- return;
- }
- UpdateCalculateForSelectedButton();
- }
-
- private void DataGridViewOnCellClick(object sender, DataGridViewCellEventArgs e)
- {
- if (updatingDataSource)
- {
- return;
- }
-
- UpdateApplicationSelection();
- }
-
- private void UpdateApplicationSelection()
- {
- if (ApplicationSelection == null)
- {
- return;
- }
-
- HydraulicBoundaryLocationContext selection = CreateSelectedItemFromCurrentRow();
- if ((ApplicationSelection.Selection == null && selection != null) ||
- (ApplicationSelection.Selection != null && !ReferenceEquals(selection, ApplicationSelection.Selection)))
- {
- ApplicationSelection.Selection = selection;
- }
- }
-
- private HydraulicBoundaryLocationContext CreateSelectedItemFromCurrentRow()
- {
- var currentRow = dataGridViewControl.CurrentRow;
-
- var designWaterLevelRow = currentRow != null
- ? (DesignWaterLevelLocationContextRow) currentRow.DataBoundItem
- : null;
-
- return designWaterLevelRow != null
- ? designWaterLevelRow.HydraulicBoundaryLocationContext
- : null;
- }
-
- private void SelectAllButton_Click(object sender, EventArgs e)
- {
- GetDesignWaterLevelLocationContextRows().ForEachElementDo(row => row.ToCalculate = true);
- dataGridViewControl.RefreshDataGridView();
- UpdateCalculateForSelectedButton();
- }
-
- private void DeselectAllButton_Click(object sender, EventArgs e)
- {
- GetDesignWaterLevelLocationContextRows().ForEachElementDo(row => row.ToCalculate = false);
- dataGridViewControl.RefreshDataGridView();
- UpdateCalculateForSelectedButton();
- }
-
- private void CalculateForSelectedButton_Click(object sender, EventArgs e)
- {
- if (CalculationCommandHandler == null)
- {
- return;
- }
- var locations = GetSelectedHydraulicBoundaryLocationContext();
CalculationCommandHandler.CalculateDesignWaterLevels(locations);
}
-
- #endregion
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs
===================================================================
diff -u -rbbd38351e339c3d74a5f4748883ae042e06a90fa -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision bbd38351e339c3d74a5f4748883ae042e06a90fa)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -271,7 +271,7 @@
private void NormInputLeave(object sender, EventArgs e)
{
- ResetTextIfEmtpy();
+ ResetTextIfEmpty();
}
private void NormValueChanged(object sender, EventArgs eventArgs)
@@ -307,7 +307,7 @@
}
}
- private void ResetTextIfEmtpy()
+ private void ResetTextIfEmpty()
{
if (string.IsNullOrEmpty(normInput.Text))
{
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.Designer.cs
===================================================================
diff -u -r2c4339dd2b2ab14a652ba543f43a377718250c00 -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.Designer.cs (.../HydraulicBoundaryLocationsView.Designer.cs) (revision 2c4339dd2b2ab14a652ba543f43a377718250c00)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.Designer.cs (.../HydraulicBoundaryLocationsView.Designer.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -36,7 +36,6 @@
///
private void InitializeComponent()
{
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HydraulicBoundaryLocationsView));
this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl();
this.CalculateForSelectedButton = new System.Windows.Forms.Button();
this.DeselectAllButton = new System.Windows.Forms.Button();
@@ -47,29 +46,43 @@
//
// dataGridViewControl
//
- resources.ApplyResources(this.dataGridViewControl, "dataGridViewControl");
+ this.dataGridViewControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridViewControl.Location = new System.Drawing.Point(0, 0);
this.dataGridViewControl.MultiSelect = true;
this.dataGridViewControl.Name = "dataGridViewControl";
+ this.dataGridViewControl.Padding = new System.Windows.Forms.Padding(0, 0, 0, 5);
this.dataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
+ this.dataGridViewControl.Size = new System.Drawing.Size(533, 85);
+ this.dataGridViewControl.TabIndex = 2;
//
// CalculateForSelectedButton
//
- resources.ApplyResources(this.CalculateForSelectedButton, "CalculateForSelectedButton");
+ this.CalculateForSelectedButton.Enabled = false;
+ this.CalculateForSelectedButton.Location = new System.Drawing.Point(227, 29);
this.CalculateForSelectedButton.Name = "CalculateForSelectedButton";
+ this.CalculateForSelectedButton.Size = new System.Drawing.Size(207, 23);
+ this.CalculateForSelectedButton.TabIndex = 2;
+ this.CalculateForSelectedButton.Text = "Bereken voor geselecteerde locaties";
this.CalculateForSelectedButton.UseVisualStyleBackColor = true;
this.CalculateForSelectedButton.Click += new System.EventHandler(this.CalculateForSelectedButton_Click);
//
// DeselectAllButton
//
- resources.ApplyResources(this.DeselectAllButton, "DeselectAllButton");
+ this.DeselectAllButton.Location = new System.Drawing.Point(110, 29);
this.DeselectAllButton.Name = "DeselectAllButton";
+ this.DeselectAllButton.Size = new System.Drawing.Size(111, 23);
+ this.DeselectAllButton.TabIndex = 1;
+ this.DeselectAllButton.Text = "Deselecteer alles";
this.DeselectAllButton.UseVisualStyleBackColor = true;
this.DeselectAllButton.Click += new System.EventHandler(this.DeselectAllButton_Click);
//
// SelectAllButton
//
- resources.ApplyResources(this.SelectAllButton, "SelectAllButton");
+ this.SelectAllButton.Location = new System.Drawing.Point(6, 29);
this.SelectAllButton.Name = "SelectAllButton";
+ this.SelectAllButton.Size = new System.Drawing.Size(98, 23);
+ this.SelectAllButton.TabIndex = 0;
+ this.SelectAllButton.Text = "Selecteer alles";
this.SelectAllButton.UseVisualStyleBackColor = true;
this.SelectAllButton.Click += new System.EventHandler(this.SelectAllButton_Click);
//
@@ -78,17 +91,25 @@
this.ButtonGroupBox.Controls.Add(this.CalculateForSelectedButton);
this.ButtonGroupBox.Controls.Add(this.DeselectAllButton);
this.ButtonGroupBox.Controls.Add(this.SelectAllButton);
- resources.ApplyResources(this.ButtonGroupBox, "ButtonGroupBox");
+ this.ButtonGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.ButtonGroupBox.Location = new System.Drawing.Point(0, 85);
+ this.ButtonGroupBox.MinimumSize = new System.Drawing.Size(445, 61);
this.ButtonGroupBox.Name = "ButtonGroupBox";
+ this.ButtonGroupBox.Size = new System.Drawing.Size(533, 61);
+ this.ButtonGroupBox.TabIndex = 3;
this.ButtonGroupBox.TabStop = false;
+ this.ButtonGroupBox.Text = "Berekenen";
//
// HydraulicBoundaryLocationsView
//
- resources.ApplyResources(this, "$this");
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScroll = true;
+ this.AutoScrollMinSize = new System.Drawing.Size(516, 85);
this.Controls.Add(this.dataGridViewControl);
this.Controls.Add(this.ButtonGroupBox);
this.Name = "HydraulicBoundaryLocationsView";
+ this.Size = new System.Drawing.Size(533, 146);
this.ButtonGroupBox.ResumeLayout(false);
this.ResumeLayout(false);
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.cs
===================================================================
diff -u -r1cb502fa23ab44e793e419f99ef20039e3c4c87a -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.cs (.../HydraulicBoundaryLocationsView.cs) (revision 1cb502fa23ab44e793e419f99ef20039e3c4c87a)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.cs (.../HydraulicBoundaryLocationsView.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -27,12 +27,10 @@
using Core.Common.Controls.Views;
using Core.Common.Gui.Selection;
using Core.Common.Utils.Extensions;
-using Core.Common.Utils.Reflection;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.HydraRing.Data;
-using Ringtoets.Integration.Forms.GuiServices;
+using Ringtoets.Integration.Forms.Commands;
using Ringtoets.Integration.Forms.PresentationObjects;
-using Ringtoets.Integration.Forms.Properties;
namespace Ringtoets.Integration.Forms.Views
{
@@ -65,9 +63,9 @@
public IApplicationSelection ApplicationSelection { get; set; }
///
- /// Gets or sets the .
+ /// Gets or sets the .
///
- public IHydraulicBoundaryLocationCalculationGuiService CalculationGuiService { get; set; }
+ public IHydraulicBoundaryLocationCalculationCommandHandler CalculationCommandHandler { get; set; }
public object Data
{
@@ -92,27 +90,6 @@
}
}
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- InitializeDataGridView();
- }
-
- ///
- /// Initializes the .
- ///
- protected virtual void InitializeDataGridView()
- {
- dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName(row => row.ToCalculate),
- Resources.HydraulicBoundaryLocationsView_Calculate);
- dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Name),
- Resources.HydraulicBoundaryDatabase_Locations_Name_DisplayName);
- dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Id),
- Resources.HydraulicBoundaryDatabase_Locations_Id_DisplayName);
- dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Location),
- Resources.HydraulicBoundaryDatabase_Locations_Coordinates_DisplayName);
- }
-
protected override void Dispose(bool disposing)
{
assessmentSectionObserver.Dispose();
@@ -232,7 +209,7 @@
private void CalculateForSelectedButton_Click(object sender, EventArgs e)
{
- if (CalculationGuiService == null)
+ if (CalculationCommandHandler == null)
{
return;
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.resx
===================================================================
diff -u -r2c4339dd2b2ab14a652ba543f43a377718250c00 -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.resx (.../HydraulicBoundaryLocationsView.resx) (revision 2c4339dd2b2ab14a652ba543f43a377718250c00)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationsView.resx (.../HydraulicBoundaryLocationsView.resx) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -117,160 +117,4 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- Fill
-
-
-
- 0, 0
-
-
- 0, 0, 0, 5
-
-
- 533, 85
-
-
-
- 2
-
-
- dataGridViewControl
-
-
- Core.Common.Controls.DataGrid.DataGridViewControl, Core.Common.Controls, Version=16.1.1.4918, Culture=neutral, PublicKeyToken=null
-
-
- $this
-
-
- 0
-
-
- False
-
-
- 227, 29
-
-
- 207, 23
-
-
- 2
-
-
- Bereken voor geselecteerde locaties
-
-
- CalculateForSelectedButton
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ButtonGroupBox
-
-
- 0
-
-
- 110, 29
-
-
- 111, 23
-
-
- 1
-
-
- Deselecteer alles
-
-
- DeselectAllButton
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ButtonGroupBox
-
-
- 1
-
-
- 6, 29
-
-
- 98, 23
-
-
- 0
-
-
- Selecteer alles
-
-
- SelectAllButton
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ButtonGroupBox
-
-
- 2
-
-
- Bottom
-
-
- 0, 85
-
-
- 445, 61
-
-
- 533, 61
-
-
- 3
-
-
- Berekenen
-
-
- ButtonGroupBox
-
-
- System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
-
-
- 1
-
-
- True
-
-
- 6, 13
-
-
- True
-
-
- 516, 85
-
-
- 533, 146
-
-
- HydraulicBoundaryLocationsView
-
-
- System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.Designer.cs
===================================================================
diff -u -r161308cb864a66713f62357c6bcdb6ede03b619f -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.Designer.cs (.../WaveHeightLocationsView.Designer.cs) (revision 161308cb864a66713f62357c6bcdb6ede03b619f)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.Designer.cs (.../WaveHeightLocationsView.Designer.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -36,107 +36,28 @@
///
private void InitializeComponent()
{
- this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl();
- this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
- this.ButtonGroupBox = new System.Windows.Forms.GroupBox();
- this.CalculateForSelectedButton = new System.Windows.Forms.Button();
- this.DeselectAllButton = new System.Windows.Forms.Button();
- this.SelectAllButton = new System.Windows.Forms.Button();
- this.tableLayoutPanel.SuspendLayout();
- this.ButtonGroupBox.SuspendLayout();
this.SuspendLayout();
//
// dataGridViewControl
//
- this.dataGridViewControl.Dock = System.Windows.Forms.DockStyle.Fill;
- this.dataGridViewControl.Location = new System.Drawing.Point(3, 3);
- this.dataGridViewControl.MultiSelect = true;
- this.dataGridViewControl.Name = "dataGridViewControl";
- this.dataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
- this.dataGridViewControl.Size = new System.Drawing.Size(529, 264);
- this.dataGridViewControl.TabIndex = 0;
+ this.dataGridViewControl.Size = new System.Drawing.Size(523, 344);
//
- // tableLayoutPanel
- //
- this.tableLayoutPanel.ColumnCount = 1;
- this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel.Controls.Add(this.dataGridViewControl, 0, 0);
- this.tableLayoutPanel.Controls.Add(this.ButtonGroupBox, 0, 1);
- this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0);
- this.tableLayoutPanel.Name = "tableLayoutPanel";
- this.tableLayoutPanel.RowCount = 2;
- this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tableLayoutPanel.Size = new System.Drawing.Size(535, 329);
- this.tableLayoutPanel.TabIndex = 2;
- //
// ButtonGroupBox
//
- this.ButtonGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.ButtonGroupBox.Controls.Add(this.CalculateForSelectedButton);
- this.ButtonGroupBox.Controls.Add(this.DeselectAllButton);
- this.ButtonGroupBox.Controls.Add(this.SelectAllButton);
- this.ButtonGroupBox.Location = new System.Drawing.Point(3, 275);
- this.ButtonGroupBox.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
- this.ButtonGroupBox.Name = "ButtonGroupBox";
- this.ButtonGroupBox.Size = new System.Drawing.Size(529, 51);
- this.ButtonGroupBox.TabIndex = 1;
- this.ButtonGroupBox.TabStop = false;
- this.ButtonGroupBox.Text = "Toetspeilen berekenen";
+ this.ButtonGroupBox.Location = new System.Drawing.Point(0, 344);
+ this.ButtonGroupBox.Size = new System.Drawing.Size(523, 61);
+ this.ButtonGroupBox.Text = "Golfhoogtes berekenen";
//
- // CalculateForSelectedButton
- //
- this.CalculateForSelectedButton.Location = new System.Drawing.Point(227, 19);
- this.CalculateForSelectedButton.Name = "CalculateForSelectedButton";
- this.CalculateForSelectedButton.Size = new System.Drawing.Size(207, 23);
- this.CalculateForSelectedButton.TabIndex = 2;
- this.CalculateForSelectedButton.Text = "Bereken voor geselecteerde locaties";
- this.CalculateForSelectedButton.UseVisualStyleBackColor = true;
- this.CalculateForSelectedButton.Click += new System.EventHandler(this.CalculateForSelectedButton_Click);
- //
- // DeselectAllButton
- //
- this.DeselectAllButton.Location = new System.Drawing.Point(110, 19);
- this.DeselectAllButton.Name = "DeselectAllButton";
- this.DeselectAllButton.Size = new System.Drawing.Size(111, 23);
- this.DeselectAllButton.TabIndex = 1;
- this.DeselectAllButton.Text = "Deselecteer alles";
- this.DeselectAllButton.UseVisualStyleBackColor = true;
- this.DeselectAllButton.Click += new System.EventHandler(this.DeselectAllButton_Click);
- //
- // SelectAllButton
- //
- this.SelectAllButton.Location = new System.Drawing.Point(6, 19);
- this.SelectAllButton.Name = "SelectAllButton";
- this.SelectAllButton.Size = new System.Drawing.Size(98, 23);
- this.SelectAllButton.TabIndex = 0;
- this.SelectAllButton.Text = "Selecteer alles";
- this.SelectAllButton.UseVisualStyleBackColor = true;
- this.SelectAllButton.Click += new System.EventHandler(this.SelectAllButton_Click);
- //
// WaveHeightLocationsView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.tableLayoutPanel);
this.Name = "WaveHeightLocationsView";
- this.Size = new System.Drawing.Size(535, 329);
- this.tableLayoutPanel.ResumeLayout(false);
- this.ButtonGroupBox.ResumeLayout(false);
+ this.Size = new System.Drawing.Size(523, 405);
this.ResumeLayout(false);
}
#endregion
-
- private Core.Common.Controls.DataGrid.DataGridViewControl dataGridViewControl;
- private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
- private System.Windows.Forms.GroupBox ButtonGroupBox;
- private System.Windows.Forms.Button CalculateForSelectedButton;
- private System.Windows.Forms.Button DeselectAllButton;
- private System.Windows.Forms.Button SelectAllButton;
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs
===================================================================
diff -u -r161308cb864a66713f62357c6bcdb6ede03b619f -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision 161308cb864a66713f62357c6bcdb6ede03b619f)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -19,18 +19,10 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Windows.Forms;
-using Core.Common.Base;
-using Core.Common.Controls.Views;
-using Core.Common.Gui.Selection;
-using Core.Common.Utils.Extensions;
using Core.Common.Utils.Reflection;
-using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.HydraRing.Data;
-using Ringtoets.Integration.Forms.Commands;
using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.Properties;
@@ -39,80 +31,28 @@
///
/// View for the with .
///
- public partial class WaveHeightLocationsView : UserControl, ISelectionProvider
+ public partial class WaveHeightLocationsView : HydraulicBoundaryLocationsView
{
- private readonly Observer assessmentSectionObserver;
- private readonly Observer hydraulicBoundaryDatabaseObserver;
- private IAssessmentSection assessmentSection;
- private bool updatingDataSource;
-
///
/// Creates a new instance of .
///
public WaveHeightLocationsView()
{
InitializeComponent();
InitializeDataGridView();
-
- assessmentSectionObserver = new Observer(UpdateDataGridViewDataSource);
- hydraulicBoundaryDatabaseObserver = new Observer(() => dataGridViewControl.RefreshDataGridView());
}
- ///
- /// Gets or sets the .
- ///
- public IApplicationSelection ApplicationSelection { get; set; }
-
- ///
- /// Gets or sets the .
- ///
- public IHydraulicBoundaryLocationCalculationCommandHandler CalculationCommandHandler { get; set; }
-
- public object Data
+ protected override void SetDataSource()
{
- get
- {
- return assessmentSection;
- }
- set
- {
- assessmentSection = value as IAssessmentSection;
-
- UpdateDataGridViewDataSource();
- assessmentSectionObserver.Observable = assessmentSection;
- }
+ dataGridViewControl.SetDataSource(AssessmentSection != null && AssessmentSection.HydraulicBoundaryDatabase != null
+ ? AssessmentSection.HydraulicBoundaryDatabase.Locations.Select(
+ hl => new WaveHeightLocationContextRow(
+ new WaveHeightLocationContext(AssessmentSection.HydraulicBoundaryDatabase, hl))).ToArray()
+ : null);
}
- public object Selection
- {
- get
- {
- return CreateSelectedItemFromCurrentRow();
- }
- }
-
- protected override void Dispose(bool disposing)
- {
- assessmentSectionObserver.Dispose();
- hydraulicBoundaryDatabaseObserver.Dispose();
-
- if (disposing && (components != null))
- {
- components.Dispose();
- }
-
- base.Dispose(disposing);
- }
-
- private void SetHydraulicBoundaryDatabaseObserver()
- {
- hydraulicBoundaryDatabaseObserver.Observable = assessmentSection != null ? assessmentSection.HydraulicBoundaryDatabase : null;
- }
-
private void InitializeDataGridView()
{
- dataGridViewControl.AddCellClickHandler(DataGridViewOnCellClick);
-
dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName(row => row.ToCalculate),
Resources.HydraulicBoundaryLocationsView_Calculate);
dataGridViewControl.AddTextBoxColumn(TypeUtils.GetMemberName(row => row.Name),
@@ -125,91 +65,9 @@
Resources.HydraulicBoundaryDatabase_Locations_WaveHeight_DisplayName);
}
- private void UpdateDataGridViewDataSource()
+ protected override void HandleCalculateSelectedLocations(IEnumerable locations)
{
- SetHydraulicBoundaryDatabaseObserver();
-
- updatingDataSource = true;
- dataGridViewControl.SetDataSource(assessmentSection != null && assessmentSection.HydraulicBoundaryDatabase != null
- ? assessmentSection.HydraulicBoundaryDatabase.Locations.Select(
- hl => new WaveHeightLocationContextRow(
- new WaveHeightLocationContext(assessmentSection.HydraulicBoundaryDatabase, hl))).ToArray()
- : null);
- updatingDataSource = false;
- }
-
- private IEnumerable GetWaveHeightLocationContextRows()
- {
- return dataGridViewControl.Rows.Cast().Select(row => (WaveHeightLocationContextRow) row.DataBoundItem);
- }
-
- private IEnumerable GetSelectedHydraulicBoundaryLocationContext()
- {
- return GetWaveHeightLocationContextRows().Where(r => r.ToCalculate).Select(r => r.HydraulicBoundaryLocationContext.HydraulicBoundaryLocation);
- }
-
- #region Event handling
-
- private void DataGridViewOnCellClick(object sender, DataGridViewCellEventArgs e)
- {
- if (updatingDataSource)
- {
- return;
- }
-
- UpdateApplicationSelection();
- }
-
- private void UpdateApplicationSelection()
- {
- if (ApplicationSelection == null)
- {
- return;
- }
-
- HydraulicBoundaryLocationContext selection = CreateSelectedItemFromCurrentRow();
- if ((ApplicationSelection.Selection == null && selection != null) ||
- (ApplicationSelection.Selection != null && !ReferenceEquals(selection, ApplicationSelection.Selection)))
- {
- ApplicationSelection.Selection = selection;
- }
- }
-
- private HydraulicBoundaryLocationContext CreateSelectedItemFromCurrentRow()
- {
- var currentRow = dataGridViewControl.CurrentRow;
-
- var waterLevelRow = currentRow != null
- ? (WaveHeightLocationContextRow) currentRow.DataBoundItem
- : null;
-
- return waterLevelRow != null
- ? waterLevelRow.HydraulicBoundaryLocationContext
- : null;
- }
-
- private void SelectAllButton_Click(object sender, EventArgs e)
- {
- GetWaveHeightLocationContextRows().ForEachElementDo(row => row.ToCalculate = true);
- dataGridViewControl.RefreshDataGridView();
- }
-
- private void DeselectAllButton_Click(object sender, EventArgs e)
- {
- GetWaveHeightLocationContextRows().ForEachElementDo(row => row.ToCalculate = false);
- dataGridViewControl.RefreshDataGridView();
- }
-
- private void CalculateForSelectedButton_Click(object sender, EventArgs e)
- {
- if (CalculationCommandHandler == null)
- {
- return;
- }
- var locations = GetSelectedHydraulicBoundaryLocationContext();
CalculationCommandHandler.CalculateWaveHeights(locations);
}
-
- #endregion
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r8dbe192f0fd57f64130aa0ca5eeba42aa75a17c6 -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 8dbe192f0fd57f64130aa0ca5eeba42aa75a17c6)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -1043,7 +1043,7 @@
var designWaterLevelItem = new StrictContextMenuItem(
RingtoetsFormsResources.DesignWaterLevel_Calculate_All,
RingtoetsFormsResources.DesignWaterLevel_Calculate_All_ToolTip,
- RingtoetsCommonFormsResources.FailureMechanismIcon,
+ RingtoetsCommonFormsResources.CalculateAllIcon,
(sender, args) =>
{
var command = new HydraulicBoundaryLocationCalculationCommandHandler(Gui.MainWindow, nodeData.WrappedData);
@@ -1058,6 +1058,7 @@
return Gui.Get(nodeData, treeViewControl)
.AddOpenItem()
+ .AddSeparator()
.AddCustomItem(designWaterLevelItem)
.AddSeparator()
.AddPropertiesItem()
@@ -1067,9 +1068,9 @@
private ContextMenuStrip WaveHeightLocationsContextMenuStrip(WaveHeightLocationsContext nodeData, object parentData, TreeViewControl treeViewControl)
{
var waveHeightItem = new StrictContextMenuItem(
- RingtoetsFormsResources.WaveHeight_Calculate,
- RingtoetsFormsResources.WaveHeight_Calculate_ToolTip,
- RingtoetsCommonFormsResources.FailureMechanismIcon,
+ RingtoetsFormsResources.WaveHeight_Calculate_All,
+ RingtoetsFormsResources.WaveHeight_Calculate_All_ToolTip,
+ RingtoetsCommonFormsResources.CalculateAllIcon,
(sender, args) =>
{
var command = new HydraulicBoundaryLocationCalculationCommandHandler(Gui.MainWindow, nodeData.WrappedData);
@@ -1083,6 +1084,8 @@
}
return Gui.Get(nodeData, treeViewControl)
+ .AddOpenItem()
+ .AddSeparator()
.AddCustomItem(waveHeightItem)
.AddSeparator()
.AddPropertiesItem()
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r161308cb864a66713f62357c6bcdb6ede03b619f -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 161308cb864a66713f62357c6bcdb6ede03b619f)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -124,6 +124,7 @@
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs
===================================================================
diff -u -r75fe077813084ef8a06b38bd149cf443acf73d27 -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelLocationsContextTreeNodeInfoTest.cs) (revision 75fe077813084ef8a06b38bd149cf443acf73d27)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelLocationsContextTreeNodeInfoTest.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -123,6 +123,7 @@
var nodeData = new DesignWaterLevelLocationsContext(assessmentSectionMock);
menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock);
@@ -177,10 +178,10 @@
ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl);
// Assert
- const string expectedItemText = "Alles &berekenen";
+ const string expectedItemText = "Alles be&rekenen";
const string expectedItemTooltip = "Er is geen hydraulische randvoorwaardendatabase beschikbaar om de toetspeilen te berekenen.";
- TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, RingtoetsCommonFormsResources.FailureMechanismIcon, false);
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu, 1, expectedItemText, expectedItemTooltip, RingtoetsCommonFormsResources.CalculateAllIcon, false);
}
}
@@ -214,10 +215,10 @@
ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl);
// Assert
- const string expectedItemText = @"Alles &berekenen";
+ const string expectedItemText = @"Alles be&rekenen";
const string expectedItemTooltip = @"Alle toetspeilen berekenen.";
- TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, RingtoetsCommonFormsResources.FailureMechanismIcon);
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu, 1, expectedItemText, expectedItemTooltip, RingtoetsCommonFormsResources.CalculateAllIcon);
}
}
@@ -229,7 +230,7 @@
{
// Given
var guiMock = mockRepository.DynamicMock();
- var contextMenuRunAssessmentLevelCalculationsIndex = 0;
+ var contextMenuRunAssessmentLevelCalculationsIndex = 1;
RoundedDouble designWaterLevel = (RoundedDouble) 4.2;
var hydraulicBoundaryLocation1 = new HydraulicBoundaryLocation(100001, "", 1.1, 2.2);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs
===================================================================
diff -u -rae8af28b6d5528cbbaa329dcffea6c8dbbe2a39f -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs (.../WaveHeightLocationsContextTreeNodeInfoTest.cs) (revision ae8af28b6d5528cbbaa329dcffea6c8dbbe2a39f)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs (.../WaveHeightLocationsContextTreeNodeInfoTest.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -122,6 +122,8 @@
var nodeData = new WaveHeightLocationsContext(assessmentSectionMock);
+ menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock);
@@ -176,9 +178,9 @@
var contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl);
// Assert
- const string expectedItemText = "&Berekenen";
+ const string expectedItemText = "Alles be&rekenen";
const string expectedItemTooltip = "Er is geen hydraulische randvoorwaardendatabase beschikbaar om de golfhoogtes te berekenen.";
- TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, Resources.FailureMechanismIcon, false);
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu, 1, expectedItemText, expectedItemTooltip, Resources.CalculateAllIcon, false);
}
}
@@ -217,10 +219,10 @@
ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl);
// Assert
- const string expectedItemText = "&Berekenen";
- const string expectedItemTooltip = "Bereken de golfhoogtes.";
+ const string expectedItemText = "Alles be&rekenen";
+ const string expectedItemTooltip = "Alle golfhoogtes berekenen.";
- TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, Resources.FailureMechanismIcon);
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu, 1, expectedItemText, expectedItemTooltip, Resources.CalculateAllIcon);
}
}
@@ -278,7 +280,7 @@
// Given
var guiMock = mockRepository.DynamicMock();
- var contextMenuRunWaveHeightCalculationsIndex = 0;
+ var contextMenuRunWaveHeightCalculationsIndex = 1;
RoundedDouble waveHeight = (RoundedDouble) 4.2;
var hydraulicBoundaryLocation1 = new HydraulicBoundaryLocation(100001, "", 1.1, 2.2);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs
===================================================================
diff -u -r75fe077813084ef8a06b38bd149cf443acf73d27 -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision 75fe077813084ef8a06b38bd149cf443acf73d27)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -27,7 +27,6 @@
using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
-using Core.Common.Controls.Views;
using Core.Common.Gui.Selection;
using NUnit.Extensions.Forms;
using NUnit.Framework;
@@ -66,8 +65,7 @@
using (var view = new DesignWaterLevelLocationsView())
{
// Assert
- Assert.IsInstanceOf(view);
- Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
Assert.IsNull(view.Data);
}
}
@@ -369,12 +367,10 @@
DesignWaterLevelLocationsView view = ShowFullyConfiguredDesignWaterLevelLocationsView();
view.CalculationCommandHandler = commandHandlerMock;
- var buttonTester = new ButtonTester("CalculateForSelectedButton", testForm);
- // Call
- var button = (Button) buttonTester.TheObject;
-
// Assert
+ var buttonTester = new ButtonTester("CalculateForSelectedButton", testForm);
+ var button = (Button) buttonTester.TheObject;
Assert.IsFalse(button.Enabled);
mockRepository.VerifyAll();
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs
===================================================================
diff -u -rcd7fd343b85d2c9272033a59a0f1bc50bc8a8d0d -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs (.../HydraulicBoundaryLocationsViewTest.cs) (revision cd7fd343b85d2c9272033a59a0f1bc50bc8a8d0d)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs (.../HydraulicBoundaryLocationsViewTest.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -25,29 +25,25 @@
using System.Windows.Forms;
using Core.Common.Base;
using Core.Common.Base.Data;
-using Core.Common.Base.Geometry;
using Core.Common.Controls.Views;
using Core.Common.Gui.Selection;
+using Core.Common.Utils.Reflection;
using NUnit.Extensions.Forms;
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Contribution;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.HydraRing.Data;
-using Ringtoets.Integration.Forms.GuiServices;
+using Ringtoets.Integration.Forms.Commands;
using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.Views;
namespace Ringtoets.Integration.Forms.Test.Views
{
- [TestFixture]
public class HydraulicBoundaryLocationsViewTest
{
private const int locationCalculateColumnIndex = 0;
- private const int locationNameColumnIndex = 1;
- private const int locationIdColumnIndex = 2;
- private const int locationColumnIndex = 3;
private Form testForm;
[SetUp]
@@ -70,7 +66,7 @@
{
// Assert
Assert.IsInstanceOf(view);
- Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
Assert.IsNull(view.Data);
}
}
@@ -87,37 +83,6 @@
}
[Test]
- public void Constructor_DataGridViewCorrectlyInitialized()
- {
- // Setup & Call
- ShowTestHydraulicBoundaryLocationsView();
-
- // Assert
- var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
- Assert.AreEqual(4, dataGridView.ColumnCount);
-
- var locationCalculateColumn = (DataGridViewCheckBoxColumn) dataGridView.Columns[locationCalculateColumnIndex];
- const string expectedLocationCalculateHeaderText = "Berekenen";
- Assert.AreEqual(expectedLocationCalculateHeaderText, locationCalculateColumn.HeaderText);
-
- var locationNameColumn = (DataGridViewTextBoxColumn) dataGridView.Columns[locationNameColumnIndex];
- const string expectedLocationNameHeaderText = "Naam";
- Assert.AreEqual(expectedLocationNameHeaderText, locationNameColumn.HeaderText);
-
- var locationIdColumn = (DataGridViewTextBoxColumn) dataGridView.Columns[locationIdColumnIndex];
- const string expectedLocationIdHeaderText = "ID";
- Assert.AreEqual(expectedLocationIdHeaderText, locationIdColumn.HeaderText);
-
- var locationColumn = (DataGridViewTextBoxColumn) dataGridView.Columns[locationColumnIndex];
- const string expectedLocationHeaderText = "Coördinaten [m]";
- Assert.AreEqual(expectedLocationHeaderText, locationColumn.HeaderText);
-
- var buttonTester = new ButtonTester("CalculateForSelectedButton", testForm);
- var button = (Button) buttonTester.TheObject;
- Assert.IsFalse(button.Enabled);
- }
-
- [Test]
public void Data_IAssessmentSection_DataSet()
{
// Setup
@@ -150,76 +115,11 @@
}
[Test]
- public void HydraulicBoundaryLocationsView_AssessmentSectionWithData_DataGridViewCorrectlyInitialized()
+ public void TestHydraulicBoundaryLocationsView_SelectingCellInRow_ApplicationSelectionCorrectlySynced()
{
- // Setup & Call
- ShowFullyConfiguredTestHydraulicBoundaryLocationsView();
-
- // Assert
- var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
- var rows = dataGridView.Rows;
- Assert.AreEqual(3, rows.Count);
-
- var cells = rows[0].Cells;
- Assert.AreEqual(4, cells.Count);
- Assert.AreEqual(false, cells[locationCalculateColumnIndex].FormattedValue);
- Assert.AreEqual("1", cells[locationNameColumnIndex].FormattedValue);
- Assert.AreEqual("1", cells[locationIdColumnIndex].FormattedValue);
- Assert.AreEqual(new Point2D(1, 1).ToString(), cells[locationColumnIndex].FormattedValue);
-
- cells = rows[1].Cells;
- Assert.AreEqual(4, cells.Count);
- Assert.AreEqual(false, cells[locationCalculateColumnIndex].FormattedValue);
- Assert.AreEqual("2", cells[locationNameColumnIndex].FormattedValue);
- Assert.AreEqual("2", cells[locationIdColumnIndex].FormattedValue);
- Assert.AreEqual(new Point2D(2, 2).ToString(), cells[locationColumnIndex].FormattedValue);
-
- cells = rows[2].Cells;
- Assert.AreEqual(4, cells.Count);
- Assert.AreEqual(false, cells[locationCalculateColumnIndex].FormattedValue);
- Assert.AreEqual("3", cells[locationNameColumnIndex].FormattedValue);
- Assert.AreEqual("3", cells[locationIdColumnIndex].FormattedValue);
- Assert.AreEqual(new Point2D(3, 3).ToString(), cells[locationColumnIndex].FormattedValue);
- }
-
- [Test]
- public void HydraulicBoundaryLocationsView_HydraulicBoundaryDatabaseUpdated_DataGridViewCorrectlyUpdated()
- {
// Setup
var view = ShowFullyConfiguredTestHydraulicBoundaryLocationsView();
IAssessmentSection assessmentSection = (IAssessmentSection) view.Data;
- HydraulicBoundaryDatabase newHydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(10, "10", 10.0, 10.0)
- {
- DesignWaterLevel = (RoundedDouble) 10.23
- };
- newHydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
-
- // Precondition
- var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
- var rows = dataGridView.Rows;
- Assert.AreEqual(3, rows.Count);
-
- // Call
- assessmentSection.HydraulicBoundaryDatabase = newHydraulicBoundaryDatabase;
- assessmentSection.NotifyObservers();
-
- // Assert
- Assert.AreEqual(1, rows.Count);
- var cells = rows[0].Cells;
- Assert.AreEqual(4, cells.Count);
- Assert.AreEqual(false, cells[locationCalculateColumnIndex].FormattedValue);
- Assert.AreEqual("10", cells[locationNameColumnIndex].FormattedValue);
- Assert.AreEqual("10", cells[locationIdColumnIndex].FormattedValue);
- Assert.AreEqual(new Point2D(10, 10).ToString(), cells[locationColumnIndex].FormattedValue);
- }
-
- [Test]
- public void HydraulicBoundaryLocationsView_SelectingCellInRow_ApplicationSelectionCorrectlySynced()
- {
- // Setup
- var view = ShowFullyConfiguredTestHydraulicBoundaryLocationsView();
- IAssessmentSection assessmentSection = (IAssessmentSection) view.Data;
var secondHydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.Skip(1).First();
var mocks = new MockRepository();
@@ -243,7 +143,7 @@
}
[Test]
- public void HydraulicBoundaryLocationsView_SelectingCellInAlreadySelectedRow_ApplicationSelectionNotSyncedRedundantly()
+ public void TestHydraulicBoundaryLocationsView_SelectingCellInAlreadySelectedRow_ApplicationSelectionNotSyncedRedundantly()
{
// Setup
var view = ShowFullyConfiguredTestHydraulicBoundaryLocationsView();
@@ -344,11 +244,11 @@
{
// Setup
var mockRepository = new MockRepository();
- var guiServiceMock = mockRepository.StrictMock();
+ var commandHandlerMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
TestHydraulicBoundaryLocationsView view = ShowFullyConfiguredTestHydraulicBoundaryLocationsView();
- view.CalculationGuiService = guiServiceMock;
+ view.CalculationCommandHandler = commandHandlerMock;
var buttonTester = new ButtonTester("CalculateForSelectedButton", testForm);
// Call
@@ -361,7 +261,7 @@
}
[Test]
- public void CalculateForSelectedButton_OneSelected_CallsCalculateHandleCalculateSelectedLocations()
+ public void CalculateForSelectedButton_OneSelected_CallsCalculateDesignWaterLevels()
{
// Setup
TestHydraulicBoundaryLocationsView view = ShowFullyConfiguredTestHydraulicBoundaryLocationsView();
@@ -371,10 +271,10 @@
rows[0].Cells[locationCalculateColumnIndex].Value = true;
var mockRepository = new MockRepository();
- var guiServiceMock = mockRepository.StrictMock();
+ var commandHandlerMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
- view.CalculationGuiService = guiServiceMock;
+ view.CalculationCommandHandler = commandHandlerMock;
var buttonTester = new ButtonTester("CalculateForSelectedButton", testForm);
// Call
@@ -388,7 +288,7 @@
}
[Test]
- public void CalculateForSelectedButton_OneSelectedButCalculationGuiServiceNotSet_DoesNotThrowException()
+ public void CalculateForSelectedButton_OneSelectedButCalculationCommandHandlerNotSet_DoesNotThrowException()
{
// Setup
ShowFullyConfiguredTestHydraulicBoundaryLocationsView();
@@ -473,21 +373,21 @@
: base(wrappedData, hydraulicBoundaryLocation) {}
}
- private class TestHydraulicBoundaryLocationContextRow : HydraulicBoundaryLocationContextRow
- {
- public TestHydraulicBoundaryLocationContextRow(HydraulicBoundaryLocationContext hydraulicBoundaryLocationContext)
+ private class TestHydraulicBoundaryLocationContextRow : HydraulicBoundaryLocationContextRow {
+ public TestHydraulicBoundaryLocationContextRow(HydraulicBoundaryLocationContext hydraulicBoundaryLocationContext)
: base(hydraulicBoundaryLocationContext) {}
}
- private sealed class TestHydraulicBoundaryLocationsView : HydraulicBoundaryLocationsView
+ private class TestHydraulicBoundaryLocationsView : HydraulicBoundaryLocationsView
{
+
+
public TestHydraulicBoundaryLocationsView()
{
+ dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName(row => row.ToCalculate), "");
LocationsToCalculate = new List();
}
- public IEnumerable LocationsToCalculate { get; private set; }
-
protected override void SetDataSource()
{
dataGridViewControl.SetDataSource(AssessmentSection != null && AssessmentSection.HydraulicBoundaryDatabase != null
@@ -501,6 +401,8 @@
{
LocationsToCalculate = locations;
}
+
+ public IEnumerable LocationsToCalculate { get; private set; }
}
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs
===================================================================
diff -u -r161308cb864a66713f62357c6bcdb6ede03b619f -r28e867674791c1111107ea44e960313f43fc6aea
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 161308cb864a66713f62357c6bcdb6ede03b619f)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 28e867674791c1111107ea44e960313f43fc6aea)
@@ -27,7 +27,6 @@
using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
-using Core.Common.Controls.Views;
using Core.Common.Gui.Selection;
using NUnit.Extensions.Forms;
using NUnit.Framework;
@@ -66,8 +65,7 @@
using (var view = new WaveHeightLocationsView())
{
// Assert
- Assert.IsInstanceOf(view);
- Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
Assert.IsNull(view.Data);
}
}
@@ -356,27 +354,20 @@
}
[Test]
- public void CalculateForSelectedButton_NoneSelected_CallsCalculateWaveHeights()
+ public void CalculateForSelectedButton_NoneSelected_CalculateForSelectedButtonDisabled()
{
// Setup
- WaveHeightLocationsView view = ShowFullyConfiguredWaveHeightLocationsView();
-
var mockRepository = new MockRepository();
var commandHandlerMock = mockRepository.StrictMock();
-
- IEnumerable locations = null;
- commandHandlerMock.Expect(ch => ch.CalculateWaveHeights(null)).IgnoreArguments().WhenCalled(
- invocation => { locations = (IEnumerable) invocation.Arguments[0]; });
mockRepository.ReplayAll();
+ WaveHeightLocationsView view = ShowFullyConfiguredWaveHeightLocationsView();
view.CalculationCommandHandler = commandHandlerMock;
- var button = new ButtonTester("CalculateForSelectedButton", testForm);
- // Call
- button.Click();
-
// Assert
- Assert.AreEqual(0, locations.Count());
+ var buttonTester = new ButtonTester("CalculateForSelectedButton", testForm);
+ var button = (Button) buttonTester.TheObject;
+ Assert.IsFalse(button.Enabled);
mockRepository.VerifyAll();
}
@@ -413,10 +404,15 @@
}
[Test]
- public void CalculateForSelectedButton_CalculationCommandHandlerNotSet_DoesNotThrowException()
+ public void CalculateForSelectedButton_OneSelectedButCalculationCommandHandlerNotSet_DoesNotThrowException()
{
// Setup
ShowFullyConfiguredWaveHeightLocationsView();
+
+ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
+ var rows = dataGridView.Rows;
+ rows[0].Cells[locationCalculateColumnIndex].Value = true;
+
var button = new ButtonTester("CalculateForSelectedButton", testForm);
// Call