Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r995becdffe0f118fd5d6167196ade69a4b650622 -r7c3122d2253a734d538d9a58b46c6c55ce7989bf --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 995becdffe0f118fd5d6167196ade69a4b650622) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7c3122d2253a734d538d9a58b46c6c55ce7989bf) @@ -716,6 +716,24 @@ } /// + /// Looks up a localized string similar to Bewerken. + /// + public static string WmtsConnectionDialog_ActionButton_Edit { + get { + return ResourceManager.GetString("WmtsConnectionDialog_ActionButton_Edit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WMTS locatie aanpassen. + /// + public static string WmtsConnectionDialog_Text_Edit { + get { + return ResourceManager.GetString("WmtsConnectionDialog_Text_Edit", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Het is niet mogelijk om WMTS connectie {0} aan te maken met URL '{1}'.. /// public static string WmtsConnectionInfoReader_Unable_To_Create_WmtsConnectionInfo { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -r995becdffe0f118fd5d6167196ade69a4b650622 -r7c3122d2253a734d538d9a58b46c6c55ce7989bf --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 995becdffe0f118fd5d6167196ade69a4b650622) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 7c3122d2253a734d538d9a58b46c6c55ce7989bf) @@ -330,4 +330,10 @@ Het is niet mogelijk om WMTS connectie {0} aan te maken met URL '{1}'. + + Bewerken + + + WMTS locatie aanpassen + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.Designer.cs =================================================================== diff -u -r06ebe792539a9463beb33a304ffc9b33dbf2fb5a -r7c3122d2253a734d538d9a58b46c6c55ce7989bf --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.Designer.cs (.../WmtsConnectionDialog.Designer.cs) (revision 06ebe792539a9463beb33a304ffc9b33dbf2fb5a) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.Designer.cs (.../WmtsConnectionDialog.Designer.cs) (revision 7c3122d2253a734d538d9a58b46c6c55ce7989bf) @@ -36,6 +36,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WmtsConnectionDialog)); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.nameTextBox = new System.Windows.Forms.TextBox(); @@ -45,6 +46,7 @@ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.cancelButton = new System.Windows.Forms.Button(); this.actionButton = new System.Windows.Forms.Button(); + this.urlToolTip = new System.Windows.Forms.ToolTip(this.components); this.tableLayoutPanel2.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -77,6 +79,7 @@ // resources.ApplyResources(this.urlLabel, "urlLabel"); this.urlLabel.Name = "urlLabel"; + this.urlToolTip.SetToolTip(this.urlLabel, resources.GetString("urlLabel.ToolTip")); // // flowLayoutPanel1 // @@ -97,6 +100,13 @@ this.actionButton.Name = "actionButton"; this.actionButton.UseVisualStyleBackColor = true; // + // urlToolTip + // + this.urlToolTip.IsBalloon = true; + this.urlToolTip.ShowAlways = true; + this.urlToolTip.Tag = ""; + this.urlToolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; + // // WmtsConnectionDialog // resources.ApplyResources(this, "$this"); @@ -121,5 +131,6 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.Label nameLabel; private System.Windows.Forms.Label urlLabel; + private System.Windows.Forms.ToolTip urlToolTip; } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.cs =================================================================== diff -u -r06ebe792539a9463beb33a304ffc9b33dbf2fb5a -r7c3122d2253a734d538d9a58b46c6c55ce7989bf --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.cs (.../WmtsConnectionDialog.cs) (revision 06ebe792539a9463beb33a304ffc9b33dbf2fb5a) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.cs (.../WmtsConnectionDialog.cs) (revision 7c3122d2253a734d538d9a58b46c6c55ce7989bf) @@ -22,6 +22,7 @@ using System; using System.Windows.Forms; using Core.Common.Controls.Dialogs; +using Ringtoets.Integration.Forms.Properties; using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources; namespace Ringtoets.Integration.Forms.Views @@ -44,6 +45,25 @@ } /// + /// Creates a new instance of in edit mode. + /// + /// The parent of the dialog. + /// The information to set in the input boxes. + /// Thrown when any of the input parameters is null. + public WmtsConnectionDialog(IWin32Window dialogParent, WmtsConnectionInfo wmtsConnectionInfo) : this(dialogParent) + { + if (wmtsConnectionInfo == null) + { + throw new ArgumentNullException(nameof(wmtsConnectionInfo)); + } + + nameTextBox.Text = wmtsConnectionInfo.Name; + urlTextBox.Text = wmtsConnectionInfo.Url; + actionButton.Text = Resources.WmtsConnectionDialog_ActionButton_Edit; + Text = Resources.WmtsConnectionDialog_Text_Edit; + } + + /// /// Gets the name that was set in the dialog. /// public string WmtsConnectionName { get; private set; } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.resx =================================================================== diff -u -r06ebe792539a9463beb33a304ffc9b33dbf2fb5a -r7c3122d2253a734d538d9a58b46c6c55ce7989bf --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.resx (.../WmtsConnectionDialog.resx) (revision 06ebe792539a9463beb33a304ffc9b33dbf2fb5a) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsConnectionDialog.resx (.../WmtsConnectionDialog.resx) (revision 7c3122d2253a734d538d9a58b46c6c55ce7989bf) @@ -231,6 +231,12 @@ URL + + 17, 17 + + + URL naar het WMTS dataservice inclusief 'capabilities'. + urlLabel @@ -361,8 +367,14 @@ 373, 142 - WmtsConnectionDialog + Nieuwe WMTS locatie toevoegen + + urlToolTip + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + WmtsConnectionDialog Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsConnectionDialogTest.cs =================================================================== diff -u -r06ebe792539a9463beb33a304ffc9b33dbf2fb5a -r7c3122d2253a734d538d9a58b46c6c55ce7989bf --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsConnectionDialogTest.cs (.../WmtsConnectionDialogTest.cs) (revision 06ebe792539a9463beb33a304ffc9b33dbf2fb5a) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsConnectionDialogTest.cs (.../WmtsConnectionDialogTest.cs) (revision 7c3122d2253a734d538d9a58b46c6c55ce7989bf) @@ -45,21 +45,54 @@ } [Test] - public void WmtsConnection_WithDialogParent_ExpectedProperties() + public void WmtsConnectionInfoConstructor_WithoutDialogParent_ThrowsArgumentNullException() { // Setup + var info = new WmtsConnectionInfo("name", "url"); + + // Call + TestDelegate test = () => new WmtsConnectionDialog(null, info); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("dialogParent", paramName); + } + + [Test] + public void WmtsConnectionInfoConstructor_WithoutWmtsConnectionInfo_ThrowsArgumentNullException() + { + // Setup var mocks = new MockRepository(); var dialogParent = mocks.StrictMock(); mocks.ReplayAll(); // Call + TestDelegate test = () => new WmtsConnectionDialog(dialogParent, null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("wmtsConnectionInfo", paramName); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_WithDialogParent_ExpectedProperties() + { + // Setup + var mocks = new MockRepository(); + var dialogParent = mocks.StrictMock(); + mocks.ReplayAll(); + + // Call using (var dialog = new WmtsConnectionDialog(dialogParent)) { // Assert Assert.IsInstanceOf(dialog); Assert.IsNull(dialog.WmtsConnectionName); Assert.IsNull(dialog.WmtsConnectionUrl); + Assert.AreEqual("Nieuwe WMTS locatie toevoegen", dialog.Text); + var nameLabel = new LabelTester("nameLabel", dialog); Assert.AreEqual("Omschrijving", nameLabel.Text); @@ -84,6 +117,50 @@ } [Test] + public void WmtsConnectionInfoConstructor_WithDialogParent_ExpectedProperties() + { + // Setup + var mocks = new MockRepository(); + var dialogParent = mocks.StrictMock(); + mocks.ReplayAll(); + const string connectionName = @"name"; + const string connectionUrl = @"url"; + var info = new WmtsConnectionInfo(connectionName, connectionUrl); + + // Call + using (var dialog = new WmtsConnectionDialog(dialogParent, info)) + { + // Assert + Assert.IsInstanceOf(dialog); + Assert.IsNull(dialog.WmtsConnectionName); + Assert.IsNull(dialog.WmtsConnectionUrl); + + Assert.AreEqual("WMTS locatie aanpassen", dialog.Text); + + var nameLabel = new LabelTester("nameLabel", dialog); + Assert.AreEqual("Omschrijving", nameLabel.Text); + + var urlLabel = new LabelTester("urlLabel", dialog); + Assert.AreEqual("URL", urlLabel.Text); + + var actionButton = (Button) new ButtonTester("actionButton", dialog).TheObject; + Assert.AreEqual("Bewerken", actionButton.Text); + Assert.IsTrue(actionButton.Enabled); + + var cancelButton = new ButtonTester("cancelButton", dialog); + Assert.AreEqual("Annuleren", cancelButton.Text); + + var nameTextBox = new TextBoxTester("nameTextBox", dialog); + Assert.AreEqual(connectionName, nameTextBox.Text); + + var urlTextBox = new TextBoxTester("urlTextBox", dialog); + Assert.AreEqual(connectionUrl, urlTextBox.Text); + } + + mocks.VerifyAll(); + } + + [Test] [Apartment(ApartmentState.STA)] public void ShowDialog_DefaultProperties() {