Index: Core/Plugins/src/Core.Plugins.CommonTools/CommonToolsGuiPlugin.cs =================================================================== diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Core/Plugins/src/Core.Plugins.CommonTools/CommonToolsGuiPlugin.cs (.../CommonToolsGuiPlugin.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455) +++ Core/Plugins/src/Core.Plugins.CommonTools/CommonToolsGuiPlugin.cs (.../CommonToolsGuiPlugin.cs) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -22,7 +22,6 @@ using System.Collections.Generic; using Core.Common.Base.Data; using Core.Common.Controls.Views; -using Core.Common.Gui; using Core.Common.Gui.Forms; using Core.Common.Gui.Plugin; using Core.Common.Utils; @@ -32,11 +31,14 @@ namespace Core.Plugins.CommonTools { + /// + /// This class configures general GUI components. + /// public class CommonToolsGuiPlugin : GuiPlugin { public override IEnumerable GetPropertyInfos() { - yield return new PropertyInfo(); + yield return new PropertyInfo(); yield return new PropertyInfo(); } @@ -49,7 +51,7 @@ }; yield return new ViewInfo { - Image = Resources.home, + Image = Resources.HomeIcon, Description = Resources.CommonToolsGuiPlugin_GetViewInfoObjects_Browser, GetViewName = (v, o) => o != null ? o.Name : "" }; Index: Core/Plugins/src/Core.Plugins.CommonTools/Core.Plugins.CommonTools.csproj =================================================================== diff -u -rc8848af0c6f8780634dcce2013e606f090da6577 -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Core/Plugins/src/Core.Plugins.CommonTools/Core.Plugins.CommonTools.csproj (.../Core.Plugins.CommonTools.csproj) (revision c8848af0c6f8780634dcce2013e606f090da6577) +++ Core/Plugins/src/Core.Plugins.CommonTools/Core.Plugins.CommonTools.csproj (.../Core.Plugins.CommonTools.csproj) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -56,7 +56,7 @@ True - + Index: Core/Plugins/src/Core.Plugins.CommonTools/Properties/Resources.Designer.cs =================================================================== diff -u -rc8848af0c6f8780634dcce2013e606f090da6577 -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Core/Plugins/src/Core.Plugins.CommonTools/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c8848af0c6f8780634dcce2013e606f090da6577) +++ Core/Plugins/src/Core.Plugins.CommonTools/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17929 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -88,29 +88,11 @@ } /// - /// Looks up a localized string similar to Folder. - /// - public static string FolderProperties_DisplayName { - get { - return ResourceManager.GetString("FolderProperties_DisplayName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Naam van de getoonde map.. - /// - public static string FolderProperties_Name_Description { - get { - return ResourceManager.GetString("FolderProperties_Name_Description", resourceCulture); - } - } - - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - public static System.Drawing.Bitmap home { + public static System.Drawing.Bitmap HomeIcon { get { - object obj = ResourceManager.GetObject("home", resourceCulture); + object obj = ResourceManager.GetObject("HomeIcon", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } @@ -134,15 +116,6 @@ } /// - /// Looks up a localized string similar to Project. - /// - public static string ProjectProperties_DisplayName { - get { - return ResourceManager.GetString("ProjectProperties_DisplayName", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Naam van het getoonde project.. /// public static string ProjectProperties_Name_Description { @@ -152,15 +125,6 @@ } /// - /// Looks up a localized string similar to URL. - /// - public static string UrlProperties_DisplayName { - get { - return ResourceManager.GetString("UrlProperties_DisplayName", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Naam van de website of waar de URL naar verwijst gegevens.. /// public static string UrlProperties_Name_Description { Index: Core/Plugins/src/Core.Plugins.CommonTools/Properties/Resources.resx =================================================================== diff -u -rdf19cc498388d9252090817c0dbfc1c334caa0ef -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Core/Plugins/src/Core.Plugins.CommonTools/Properties/Resources.resx (.../Resources.resx) (revision df19cc498388d9252090817c0dbfc1c334caa0ef) +++ Core/Plugins/src/Core.Plugins.CommonTools/Properties/Resources.resx (.../Resources.resx) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -123,9 +123,6 @@ Naam - - URL - Naam van de website of waar de URL naar verwijst gegevens. @@ -135,9 +132,6 @@ Locatie waar de URL naar verwijst. - - Project - Naam van het getoonde project. @@ -147,16 +141,11 @@ Omschrijving - - Folder - - - Naam van de getoonde map. - Browser - + + ..\Resources\home.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.CommonTools/Property/ProjectProperties.cs =================================================================== diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Core/Plugins/src/Core.Plugins.CommonTools/Property/ProjectProperties.cs (.../ProjectProperties.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455) +++ Core/Plugins/src/Core.Plugins.CommonTools/Property/ProjectProperties.cs (.../ProjectProperties.cs) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -20,15 +20,16 @@ // All rights reserved. using Core.Common.Base.Data; -using Core.Common.Gui; using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; using Core.Plugins.CommonTools.Properties; namespace Core.Plugins.CommonTools.Property { - [ResourcesDisplayName(typeof(Resources), "ProjectProperties_DisplayName")] + /// + /// This class describes the presentation of properties of a . + /// public class ProjectProperties : ObjectProperties { [PropertyOrder(1)] Fisheye: Tag f4a633bf7b75c0e25f0c5bcd600df6def184962c refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.CommonTools/Property/UrlProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Plugins/src/Core.Plugins.CommonTools/Property/WebLinkProperties.cs =================================================================== diff -u --- Core/Plugins/src/Core.Plugins.CommonTools/Property/WebLinkProperties.cs (revision 0) +++ Core/Plugins/src/Core.Plugins.CommonTools/Property/WebLinkProperties.cs (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -0,0 +1,66 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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. + +using System; + +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils; +using Core.Common.Utils.Attributes; +using Core.Plugins.CommonTools.Properties; + +namespace Core.Plugins.CommonTools.Property +{ + /// + /// This class describes the presentation of properties of a . + /// + public class WebLinkProperties : ObjectProperties + { + [ResourcesCategory(typeof(Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "Common_Name_DisplayName")] + [ResourcesDescription(typeof(Resources), "UrlProperties_Name_Description")] + public string Name + { + get + { + return data.Name; + } + set + { + data.Name = value; + } + } + + [ResourcesCategory(typeof(Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "UrlProperties_Path_DisplayName")] + [ResourcesDescription(typeof(Resources), "UrlProperties_Path_Description")] + public string Path + { + get + { + return data.Path.ToString(); + } + set + { + data.Path = new Uri(value); + } + } + } +} \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.CommonTools.Test/CommonToolsGuiPluginTest.cs =================================================================== diff -u -r770547be3030f73473282742f9a63ca6805ff74b -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Core/Plugins/test/Core.Plugins.CommonTools.Test/CommonToolsGuiPluginTest.cs (.../CommonToolsGuiPluginTest.cs) (revision 770547be3030f73473282742f9a63ca6805ff74b) +++ Core/Plugins/test/Core.Plugins.CommonTools.Test/CommonToolsGuiPluginTest.cs (.../CommonToolsGuiPluginTest.cs) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -2,7 +2,9 @@ using Core.Common.Base.Data; using Core.Common.Controls.Views; using Core.Common.Gui.Forms; +using Core.Common.TestUtil; using Core.Common.Utils; +using Core.Plugins.CommonTools.Properties; using Core.Plugins.CommonTools.Property; using NUnit.Framework; @@ -14,28 +16,116 @@ [Test] public void GetCommonToolsGuiPluginProperties_Always_ReturnProperties() { + // Setup var guiPlugin = new CommonToolsGuiPlugin(); + + // Call var propertyInfos = guiPlugin.GetPropertyInfos().ToList(); + // Assert Assert.AreEqual(2, propertyInfos.Count); var projectPropertyInfo = propertyInfos.First(pi => pi.ObjectType == typeof(Project)); var urlPropertyInfo = propertyInfos.First(pi => pi.ObjectType == typeof(WebLink)); Assert.AreEqual(typeof(ProjectProperties), projectPropertyInfo.PropertyType); - Assert.AreEqual(typeof(UrlProperties), urlPropertyInfo.PropertyType); + Assert.AreEqual(typeof(WebLinkProperties), urlPropertyInfo.PropertyType); } [Test] public void GetCommonToolsGuiPluginProperties_Always_ReturnViews() { + // Setup var guiPlugin = new CommonToolsGuiPlugin(); + + // Call var viewInfos = guiPlugin.GetViewInfoObjects().ToList(); + // Assert Assert.NotNull(viewInfos); Assert.AreEqual(2, viewInfos.Count); - Assert.IsTrue(viewInfos.Any(vi => vi.DataType == typeof(RichTextFile) && vi.ViewType == typeof(RichTextView))); - Assert.IsTrue(viewInfos.Any(vi => vi.DataType == typeof(WebLink) && vi.ViewType == typeof(HtmlPageView))); + + var richTextFileInfo = viewInfos.First(vi => vi.DataType == typeof(RichTextFile)); + var webLinkInfo = viewInfos.First(vi => vi.DataType == typeof(WebLink)); + + Assert.AreEqual(richTextFileInfo.ViewType, typeof(RichTextView)); + Assert.IsNull(richTextFileInfo.Description); + TestHelper.AssertImagesAreEqual(Common.Gui.Properties.Resources.key, richTextFileInfo.Image); + + Assert.AreEqual(webLinkInfo.ViewType, typeof(HtmlPageView)); + Assert.AreEqual(webLinkInfo.Description, Resources.CommonToolsGuiPlugin_GetViewInfoObjects_Browser); + TestHelper.AssertImagesAreEqual(Resources.HomeIcon, webLinkInfo.Image); } + + [Test] + public void RichTextFileViewInfoName_WithoutData_EmptyString() + { + // Setup + var guiPlugin = new CommonToolsGuiPlugin(); + var viewInfos = guiPlugin.GetViewInfoObjects().ToList(); + + var info = viewInfos.First(vi => vi.DataType == typeof(RichTextFile)); + + // Call + var name = info.GetViewName(null, null); + + // Assert + Assert.IsEmpty(name); + } + + [Test] + public void RichTextFileViewInfoName_WithData_NameOfData() + { + // Setup + var expected = "SomeName"; + var guiPlugin = new CommonToolsGuiPlugin(); + var viewInfos = guiPlugin.GetViewInfoObjects().ToList(); + + var info = viewInfos.First(vi => vi.DataType == typeof(RichTextFile)); + var richTextFile = new RichTextFile + { + Name = expected + }; + + // Call + var name = info.GetViewName(null, richTextFile); + + // Assert + Assert.AreEqual(expected, name); + } + + [Test] + public void HtmlPageViewInfoName_WithoutData_EmptyString() + { + // Setup + var guiPlugin = new CommonToolsGuiPlugin(); + var viewInfos = guiPlugin.GetViewInfoObjects().ToList(); + + var info = viewInfos.First(vi => vi.DataType == typeof(WebLink)); + + // Call + var name = info.GetViewName(null, null); + + // Assert + Assert.IsEmpty(name); + } + + [Test] + public void HtmlPageViewInfoName_WithData_NameOfData() + { + // Setup + var expected = "SomeName"; + var guiPlugin = new CommonToolsGuiPlugin(); + var viewInfos = guiPlugin.GetViewInfoObjects().ToList(); + + var info = viewInfos.First(vi => vi.DataType == typeof(WebLink)); + var webLink = new WebLink(expected, null); + + // Call + var name = info.GetViewName(null, webLink); + + // Assert + Assert.AreEqual(expected, name); + } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.CommonTools.Test/Core.Plugins.CommonTools.Test.csproj =================================================================== diff -u -r232a51f976c9b38d71ed9eb959bcf4004cbb4ded -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Core/Plugins/test/Core.Plugins.CommonTools.Test/Core.Plugins.CommonTools.Test.csproj (.../Core.Plugins.CommonTools.Test.csproj) (revision 232a51f976c9b38d71ed9eb959bcf4004cbb4ded) +++ Core/Plugins/test/Core.Plugins.CommonTools.Test/Core.Plugins.CommonTools.Test.csproj (.../Core.Plugins.CommonTools.Test.csproj) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -85,6 +85,10 @@ {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} Core.Common.Utils + + {D749EE4C-CE50-4C17-BF01-9A953028C126} + Core.Common.TestUtil + {93E73FAB-FAE8-49C6-9ABB-27D24DF761F6} Core.Plugins.CommonTools Index: Core/Plugins/test/Core.Plugins.CommonTools.Test/Property/UrlPropertiesTest.cs =================================================================== diff -u -r770547be3030f73473282742f9a63ca6805ff74b -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Core/Plugins/test/Core.Plugins.CommonTools.Test/Property/UrlPropertiesTest.cs (.../UrlPropertiesTest.cs) (revision 770547be3030f73473282742f9a63ca6805ff74b) +++ Core/Plugins/test/Core.Plugins.CommonTools.Test/Property/UrlPropertiesTest.cs (.../UrlPropertiesTest.cs) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -15,7 +15,7 @@ public void DefaultConstructor_ReturnsInstanceOfObjectProperties() { // Call - var urlProperties = new UrlProperties(); + var urlProperties = new WebLinkProperties(); // Assert Assert.IsInstanceOf>(urlProperties); @@ -30,7 +30,7 @@ var otherName = "some other name"; var url = new WebLink(someName, new Uri("https://www.google.nl")); - var properties = new UrlProperties + var properties = new WebLinkProperties { Data = url }; @@ -53,7 +53,7 @@ var otherPath = "http://www.google.nl"; var url = new WebLink(string.Empty, new Uri(somePath)); - var properties = new UrlProperties + var properties = new WebLinkProperties { Data = url }; @@ -76,7 +76,7 @@ var somePath = "http://www.google.nl"; var url = new WebLink(someName, new Uri(somePath)); - var bag = new DynamicPropertyBag(new UrlProperties + var bag = new DynamicPropertyBag(new WebLinkProperties { Data = url }); Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingOutputProperties.cs =================================================================== diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -rf4a633bf7b75c0e25f0c5bcd600df6def184962c --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingOutputProperties.cs (.../PipingOutputProperties.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingOutputProperties.cs (.../PipingOutputProperties.cs) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Core.Common.Gui; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; @@ -29,7 +28,6 @@ namespace Ringtoets.Piping.Forms.PropertyClasses { - [ResourcesDisplayName(typeof(Resources), "PipingOutputPropertiesDisplayName")] public class PipingOutputProperties : ObjectProperties { [ResourcesCategory(typeof(Resources), "Categories_General")]