From 91516ebd65a875a647e9f122f2c7fff52837ab2b Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Tue, 13 Jun 2017 21:17:50 -0700 Subject: [PATCH] Renamed TextContent to Text --- Ooui/Node.cs | 6 +++--- Ooui/Text.cs | 22 ---------------------- Ooui/TextNode.cs | 22 ++++++++++++++++++++++ Samples/Program.cs | 2 +- Tests/ButtonTests.cs | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) delete mode 100644 Ooui/Text.cs create mode 100644 Ooui/TextNode.cs diff --git a/Ooui/Node.cs b/Ooui/Node.cs index 82e78fb..6512e57 100644 --- a/Ooui/Node.cs +++ b/Ooui/Node.cs @@ -21,10 +21,10 @@ namespace Ooui .Concat (from c in children from m in c.AllMessages select m) .OrderBy (x => x.Id); - public string TextContent { - get { return String.Join ("", from c in children select c.TextContent); } + public virtual string Text { + get { return String.Join ("", from c in children select c.Text); } set { - ReplaceAll (new Text (value ?? "")); + ReplaceAll (new TextNode (value ?? "")); } } diff --git a/Ooui/Text.cs b/Ooui/Text.cs deleted file mode 100644 index 896f3b0..0000000 --- a/Ooui/Text.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Ooui -{ - public class Text : Node - { - string data = ""; - public string Data { - get => data; - set => SetProperty (ref data, value ?? "", "data"); - } - - public Text () - { - } - - public Text (string text) - { - Data = text; - } - } -} diff --git a/Ooui/TextNode.cs b/Ooui/TextNode.cs new file mode 100644 index 0000000..a199bb3 --- /dev/null +++ b/Ooui/TextNode.cs @@ -0,0 +1,22 @@ +using System; + +namespace Ooui +{ + public class TextNode : Node + { + string text = ""; + public override string Text { + get => text; + set => SetProperty (ref text, value ?? "", "data"); + } + + public TextNode () + { + } + + public TextNode (string text) + { + Text = text; + } + } +} diff --git a/Samples/Program.cs b/Samples/Program.cs index a0cb439..0e3ee33 100644 --- a/Samples/Program.cs +++ b/Samples/Program.cs @@ -12,7 +12,7 @@ namespace Samples Title = "The best button", Name = "TestButton", Value = "Click Me", - TextContent = "I am a button, click me!" + Text = "I am a button, click me!" }; server.Publish ("/button", button); server.RunAsync ("http://*:8080/").Wait (); diff --git a/Tests/ButtonTests.cs b/Tests/ButtonTests.cs index 64f375e..caa03a1 100644 --- a/Tests/ButtonTests.cs +++ b/Tests/ButtonTests.cs @@ -12,7 +12,7 @@ namespace Tests public void DefaultCtor () { var b = new Button (); - Assert.AreEqual ("", b.TextContent); + Assert.AreEqual ("", b.Text); } } }