Index: Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj
===================================================================
diff -u -rb389b4d34dab98838a8c2f087b18cfdac544f01f -r883c1c27b5590d21a05a293a74206dc45e203cee
--- Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj (.../Core.Common.Controls.csproj) (revision b389b4d34dab98838a8c2f087b18cfdac544f01f)
+++ Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj (.../Core.Common.Controls.csproj) (revision 883c1c27b5590d21a05a293a74206dc45e203cee)
@@ -71,8 +71,10 @@
3.5
+
+
@@ -95,6 +97,12 @@
Component
+
+ UserControl
+
+
+ RichTextBoxControl.cs
+
UserControl
@@ -154,6 +162,9 @@
Resources.Designer.cs
Designer
+
+ RichTextBoxControl.cs
+
HtmlPageView.cs
Index: Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.Designer.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.Designer.cs (revision 0)
+++ Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.Designer.cs (revision 883c1c27b5590d21a05a293a74206dc45e203cee)
@@ -0,0 +1,57 @@
+namespace Core.Common.Controls.TextEditor
+{
+ partial class RichTextBoxControl
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.richTextBox = new System.Windows.Forms.RichTextBox();
+ this.SuspendLayout();
+ //
+ // richTextBox
+ //
+ this.richTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.richTextBox.Location = new System.Drawing.Point(0, 0);
+ this.richTextBox.Name = "richTextBox";
+ this.richTextBox.Size = new System.Drawing.Size(150, 150);
+ this.richTextBox.TabIndex = 0;
+ this.richTextBox.Text = "";
+ //
+ // RichTextBoxControl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.richTextBox);
+ this.Name = "RichTextBoxControl";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.RichTextBox richTextBox;
+ }
+}
Index: Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.cs (revision 0)
+++ Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.cs (revision 883c1c27b5590d21a05a293a74206dc45e203cee)
@@ -0,0 +1,67 @@
+// 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 System.Windows.Forms;
+
+namespace Core.Common.Controls.TextEditor
+{
+ ///
+ /// Wrapper for the .
+ ///
+ public partial class RichTextBoxControl : UserControl
+ {
+ ///
+ /// The event which is send when the text changes.
+ ///
+ public event EventHandler TextBoxValueChanged;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ public RichTextBoxControl()
+ {
+ InitializeComponent();
+
+ richTextBox.TextChanged += OnTextChanged;
+ }
+
+ public override string Text
+ {
+ get
+ {
+ return richTextBox.Text;
+ }
+ set
+ {
+ richTextBox.Text = value;
+ }
+ }
+
+ private void OnTextChanged(object sender, EventArgs e)
+ {
+ if (TextBoxValueChanged != null)
+ {
+ TextBoxValueChanged(sender, e);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.resx
===================================================================
diff -u
--- Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.resx (revision 0)
+++ Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.resx (revision 883c1c27b5590d21a05a293a74206dc45e203cee)
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
Index: Core/Common/test/Core.Common.Controls.Test/Core.Common.Controls.Test.csproj
===================================================================
diff -u -r2bece99f4c12df81fb2a6854a24c0e9f4d4d3c42 -r883c1c27b5590d21a05a293a74206dc45e203cee
--- Core/Common/test/Core.Common.Controls.Test/Core.Common.Controls.Test.csproj (.../Core.Common.Controls.Test.csproj) (revision 2bece99f4c12df81fb2a6854a24c0e9f4d4d3c42)
+++ Core/Common/test/Core.Common.Controls.Test/Core.Common.Controls.Test.csproj (.../Core.Common.Controls.Test.csproj) (revision 883c1c27b5590d21a05a293a74206dc45e203cee)
@@ -57,6 +57,7 @@
+
Index: Core/Common/test/Core.Common.Controls.Test/TextEditor/RichTextBoxControlTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Controls.Test/TextEditor/RichTextBoxControlTest.cs (revision 0)
+++ Core/Common/test/Core.Common.Controls.Test/TextEditor/RichTextBoxControlTest.cs (revision 883c1c27b5590d21a05a293a74206dc45e203cee)
@@ -0,0 +1,34 @@
+using System.Windows.Forms;
+using Core.Common.Controls.TextEditor;
+using NUnit.Framework;
+
+namespace Core.Common.Controls.Test.TextEditor
+{
+ [TestFixture]
+ public class RichTextBoxControlTest
+ {
+ [Test]
+ public void Constructor_DefaultValues()
+ {
+ // Call
+ var control = new RichTextBoxControl();
+
+ // Assert
+ Assert.IsInstanceOf(control);
+ }
+
+ [Test]
+ public void Text_ValueSet_ReturnsValue()
+ {
+ // Setup
+ var data = "";
+ var control = new RichTextBoxControl();
+
+ // Call
+ control.Text = data;
+
+ // Assert
+ Assert.AreEqual(data, control.Text);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs
===================================================================
diff -u -r504f726111ede24adc838a345fdcd1c47227c79b -r883c1c27b5590d21a05a293a74206dc45e203cee
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs (.../AssessmentSectionCommentView.cs) (revision 504f726111ede24adc838a345fdcd1c47227c79b)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs (.../AssessmentSectionCommentView.cs) (revision 883c1c27b5590d21a05a293a74206dc45e203cee)
@@ -19,7 +19,9 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Windows.Forms;
+using Core.Common.Controls.TextEditor;
using Core.Common.Controls.Views;
using Ringtoets.Common.Data;
@@ -30,14 +32,17 @@
///
public partial class AssessmentSectionCommentView : UserControl, IView
{
- private object data;
+ private IAssessmentSection data;
+ private RichTextBoxControl richTextEditor;
///
/// Creates a new instance of .
///
public AssessmentSectionCommentView()
{
InitializeComponent();
+
+ InitializeRichTextEditor();
}
public object Data
@@ -49,7 +54,28 @@
set
{
data = value as IAssessmentSection;
+
+ if (data != null)
+ {
+ richTextEditor.Text = data.Comments;
+ }
}
}
+
+ private void InitializeRichTextEditor()
+ {
+ richTextEditor = new RichTextBoxControl
+ {
+ Dock = DockStyle.Fill
+ };
+ Controls.Add(richTextEditor);
+
+ richTextEditor.TextBoxValueChanged += RichTextEditorOnTextChanged;
+ }
+
+ private void RichTextEditorOnTextChanged(object sender, EventArgs eventArgs)
+ {
+ data.Comments = richTextEditor.Text;
+ }
}
-}
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionCommentViewTest.cs
===================================================================
diff -u -r504f726111ede24adc838a345fdcd1c47227c79b -r883c1c27b5590d21a05a293a74206dc45e203cee
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionCommentViewTest.cs (.../AssessmentSectionCommentViewTest.cs) (revision 504f726111ede24adc838a345fdcd1c47227c79b)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionCommentViewTest.cs (.../AssessmentSectionCommentViewTest.cs) (revision 883c1c27b5590d21a05a293a74206dc45e203cee)
@@ -20,6 +20,7 @@
// All rights reserved.
using System.Windows.Forms;
+using Core.Common.Controls.TextEditor;
using Core.Common.Controls.Views;
using NUnit.Framework;
using Rhino.Mocks;
@@ -41,16 +42,18 @@
Assert.IsInstanceOf(view);
Assert.IsInstanceOf(view);
Assert.IsNull(view.Data);
+ Assert.AreEqual(1, view.Controls.Count);
+ var control = view.Controls[0];
+ Assert.IsInstanceOf(control);
}
-
[Test]
public void Data_AssessmentSection_DataSet()
{
// Setup
var mocks = new MockRepository();
var view = new AssessmentSectionCommentView();
- var data = mocks.StrictMock();
+ var data = mocks.Stub();
mocks.ReplayAll();
@@ -74,5 +77,24 @@
// Assert
Assert.IsNull(view.Data);
}
+
+ [Test]
+ public void Data_AssessmentSectionContainsComment_CommentSetOnRichTextEditor()
+ {
+ // Setup
+ var expectedText = "";
+ var mocks = new MockRepository();
+ var view = new AssessmentSectionCommentView();
+ var data = mocks.StrictMock();
+ data.Expect(d => d.Comments).Return(expectedText);
+
+ mocks.ReplayAll();
+
+ // Call
+ view.Data = data;
+
+ // Assert
+ Assert.AreEqual(expectedText, view.Controls[0].Text);
+ }
}
-}
+}
\ No newline at end of file