Index: Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj =================================================================== diff -u -rd1a8aeaa05c36dfe386de7586dd129819594ee97 -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj (.../Core.Common.Controls.csproj) (revision d1a8aeaa05c36dfe386de7586dd129819594ee97) +++ Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj (.../Core.Common.Controls.csproj) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -97,7 +97,6 @@ True Resources.resx - Fisheye: Tag 18e78f440e1df8cd03e3e337ef385b58266a34a5 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Controls/ViewInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj =================================================================== diff -u -rd1a8aeaa05c36dfe386de7586dd129819594ee97 -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision d1a8aeaa05c36dfe386de7586dd129819594ee97) +++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -123,6 +123,7 @@ MessageWindowDialog.cs + Index: Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewResolver.cs =================================================================== diff -u -re00a8a09daf851d9bf0486ff19f37285e3ad15ef -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewResolver.cs (.../ViewResolver.cs) (revision e00a8a09daf851d9bf0486ff19f37285e3ad15ef) +++ Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewResolver.cs (.../ViewResolver.cs) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -4,6 +4,7 @@ using System.Windows.Forms; using Core.Common.Controls; using Core.Common.Controls.Views; +using Core.Common.Gui.Plugin; using Core.Common.Gui.Properties; using Core.Common.Utils.Reflection; using log4net; Index: Core/Common/src/Core.Common.Gui/GuiPlugin.cs =================================================================== diff -u -r8cae5d69ac2d4cf678486ac2b457c0dfe97089d5 -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Core/Common/src/Core.Common.Gui/GuiPlugin.cs (.../GuiPlugin.cs) (revision 8cae5d69ac2d4cf678486ac2b457c0dfe97089d5) +++ Core/Common/src/Core.Common.Gui/GuiPlugin.cs (.../GuiPlugin.cs) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -4,6 +4,7 @@ using Core.Common.Controls; using Core.Common.Controls.TreeView; using Core.Common.Gui.Forms; +using Core.Common.Gui.Plugin; namespace Core.Common.Gui { Index: Core/Common/src/Core.Common.Gui/IViewResolver.cs =================================================================== diff -u -r1a47be2a9f0336ef0d0d5bd6971e8e1cc3cbbfa4 -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Core/Common/src/Core.Common.Gui/IViewResolver.cs (.../IViewResolver.cs) (revision 1a47be2a9f0336ef0d0d5bd6971e8e1cc3cbbfa4) +++ Core/Common/src/Core.Common.Gui/IViewResolver.cs (.../IViewResolver.cs) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -2,6 +2,7 @@ using System.Collections.Generic; using Core.Common.Controls; using Core.Common.Controls.Views; +using Core.Common.Gui.Plugin; namespace Core.Common.Gui { Index: Core/Common/src/Core.Common.Gui/Plugin/ViewInfo.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/Plugin/ViewInfo.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/Plugin/ViewInfo.cs (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -0,0 +1,182 @@ +using System; +using System.Drawing; +using Core.Common.Controls.Views; + +namespace Core.Common.Gui.Plugin +{ + public class ViewInfo : ICloneable + { + /// + /// Type of the data for this viewInfo + /// + public Type DataType { get; set; } + + /// + /// Type of the data of the view + /// + public Type ViewDataType { get; set; } + + /// + /// Type of the view + /// + public Type ViewType { get; set; } + + /// + /// Description of the view (shown to the user when there is more then one view for an item) + /// + public string Description { get; set; } + + /// + /// Name the view should have + /// + /// The view to get a name for + /// The data of the view + /// out - the view name + /// + /// + public Func GetViewName { get; set; } + + /// + /// Icon of the view (shown top left) + /// + public Image Image { get; set; } + + /// + /// Additional data checking for matching the ViewInfo + /// + /// Data as provided by the ViewProvider + /// out - Check succeeded + /// + /// + public Func AdditionalDataCheck { get; set; } + + /// + /// Function that returns the data for the view (when not set it returns T in ) + /// + /// object - Original data for the view + /// out object - data for the view + /// + /// + public Func GetViewData { get; set; } + + /// + /// Extra actions that can be performed on the view after creation + /// + /// View to modify + /// Data for this viewinfo + /// + /// + public Action AfterCreate { get; set; } + + /// + /// Extra actions that can be performed on the view after the focus has been set on the view. + /// (Will be called after creation and when the user tries to open a view for data while there is an existing view + /// (and only the focus will be set to the existing view)) + /// + /// View to modify + /// Data for this viewinfo + /// + /// + public Action OnActivateView { get; set; } + + /// + /// Override the default closing of the view constructed with this info + /// + /// View to close + /// + /// out - Close succeeded + /// + /// + public Func CloseForData { get; set; } + + public override string ToString() + { + return DataType + " : " + ViewDataType + " : " + ViewType; + } + + public object Clone() + { + return MemberwiseClone(); + } + } + + public class ViewInfo where TView : IView + { + public Type DataType + { + get + { + return typeof(TData); + } + } + + public Type ViewDataType + { + get + { + return typeof(TViewData); + } + } + + public Type ViewType + { + get + { + return typeof(TView); + } + } + + public string Description { get; set; } + + public Func GetViewName { get; set; } + + public Image Image { get; set; } + + public Func AdditionalDataCheck { get; set; } + + public Func GetViewData { get; set; } + + public Action AfterCreate { get; set; } + + public Action OnActivateView { get; set; } + + public Func CloseForData { get; set; } + + public static implicit operator ViewInfo(ViewInfo viewInfo) + { + return new ViewInfo + { + DataType = viewInfo.DataType, + ViewDataType = viewInfo.ViewDataType, + ViewType = viewInfo.ViewType, + Description = viewInfo.Description, + Image = viewInfo.Image, + AdditionalDataCheck = o => viewInfo.AdditionalDataCheck == null || viewInfo.AdditionalDataCheck((TData) o), + GetViewData = o => viewInfo.GetViewData != null ? viewInfo.GetViewData((TData) o) : o, + CloseForData = (v, o) => viewInfo.CloseForData != null && viewInfo.CloseForData((TView) v, o), + AfterCreate = (v, o) => + { + if (viewInfo.AfterCreate != null) + { + viewInfo.AfterCreate((TView) v, (TData) o); + } + }, + OnActivateView = (v, o) => + { + if (viewInfo.OnActivateView != null) + { + viewInfo.OnActivateView((TView) v, o); + } + }, + GetViewName = (v, o) => viewInfo.GetViewName != null ? viewInfo.GetViewName((TView) v, (TViewData) o) : null + }; + } + + public override string ToString() + { + return DataType + " : " + ViewDataType + " : " + ViewType; + } + } + + public class ViewInfo : ViewInfo where TView : IView {} +} \ No newline at end of file Index: Core/Common/test/Core.Common.Test/Gui/ViewListTest.cs =================================================================== diff -u -r60284d242516286b70997e1894fa22b67d7f10ab -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Core/Common/test/Core.Common.Test/Gui/ViewListTest.cs (.../ViewListTest.cs) (revision 60284d242516286b70997e1894fa22b67d7f10ab) +++ Core/Common/test/Core.Common.Test/Gui/ViewListTest.cs (.../ViewListTest.cs) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -5,6 +5,7 @@ using Core.Common.Controls.Views; using Core.Common.Gui; using Core.Common.Gui.Forms.ViewManager; +using Core.Common.Gui.Plugin; using Core.Common.Test.TestObjects; using Core.Common.Utils; using Core.Common.Utils.Events; Index: Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs =================================================================== diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs (.../CommonToolsGuiPlugin.cs) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3) +++ Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs (.../CommonToolsGuiPlugin.cs) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -7,6 +7,7 @@ using Core.Common.Controls.Charting.Series; using Core.Common.Gui; using Core.Common.Gui.Forms; +using Core.Common.Gui.Plugin; using Core.Common.Gui.Swf; using Core.Common.Utils; using Core.Common.Utils.Events; Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs =================================================================== diff -u -r46f5191a65faec434930a191e65f4c23d9ff8cfe -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs (.../SharpMapGisGuiPlugin.cs) (revision 46f5191a65faec434930a191e65f4c23d9ff8cfe) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs (.../SharpMapGisGuiPlugin.cs) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -11,6 +11,7 @@ using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.Forms; +using Core.Common.Gui.Plugin; using Core.Common.Utils.Events; using Core.GIS.GeoAPI.Extensions.Feature; using Core.GIS.GeoAPI.Geometries; Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -r8cae5d69ac2d4cf678486ac2b457c0dfe97089d5 -r18e78f440e1df8cd03e3e337ef385b58266a34a5 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 8cae5d69ac2d4cf678486ac2b457c0dfe97089d5) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5) @@ -5,7 +5,7 @@ using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.Forms; - +using Core.Common.Gui.Plugin; using Ringtoets.Common.Forms.NodePresenters; using Ringtoets.Integration.Data; using Ringtoets.Integration.Data.Contribution;