diff --git a/demo/XidynDemo.java b/demo/XidynDemo.java
index 60676be..24efb65 100644
--- a/demo/XidynDemo.java
+++ b/demo/XidynDemo.java
@@ -20,6 +20,7 @@ import org.apache.log4j.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import fr.devinsy.util.strings.StringList;
import fr.devinsy.xidyn.data.SimpleTagData;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
@@ -51,153 +52,161 @@ class XidynDemo
// Step #01.
{
- System.out.println("----------------------------");
-
- // Populate attributes.
- data = new TagDataManager();
- data.setContent("name", "Superman");
-
- String htmlSource = "
a name
";
- StringBuffer htmlTarget;
try
{
- htmlTarget = PresenterUtils.dynamize(htmlSource, data);
+ System.out.println("----------------------------");
+
+ String htmlSource = "a pseudo
";
+
+ data = new TagDataManager();
+ data.setContent("name", "Superman");
+
+ String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
+
+ System.out.println("datas = new Data ();");
+ System.out.println("datas.setContent (\"pseudo\", \"Superman\");");
+ System.out.println("+");
+ System.out.println("a pseudo
");
+ System.out.println("=>");
+ System.out.println(htmlTarget);
+ System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
- htmlTarget = null;
}
- System.out.println("datas = new Data ();");
- System.out.println("datas.setContent (\"name\", \"Superman\");");
- System.out.println("+");
- System.out.println("a name
");
- System.out.println("=>");
- System.out.println(htmlTarget);
- System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #02.
{
- System.out.println("----------------------------");
- // Populate attributes.
- data = new TagDataManager();
- data.setContent("lastname", "Spiderman");
- data.appendAttribute("lastname", "style", "background: blue;");
- data.appendAttribute("lastname", "style", "foreground: red;");
- data.setAttribute("lastname", "class", "nameClass");
-
- String htmlSource = "a last name
";
- StringBuffer htmlTarget;
try
{
- htmlTarget = PresenterUtils.dynamize(htmlSource, data);
+ System.out.println("----------------------------");
+
+ String htmlSource = "a last name
";
+
+ data = new TagDataManager();
+ data.setContent("pseudo", "Spiderman");
+ data.appendAttribute("pseudo", "style", "background: blue;");
+ data.appendAttribute("pseudo", "style", "foreground: red;");
+ data.setAttribute("pseudo", "class", "nameClass");
+
+ String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
+
+ System.out.println("a last name
");
+ System.out.println("+");
+ System.out.println("datas = new Data ();");
+ System.out.println("datas.setContent (\"pseudo\", \"Spiderman\");");
+ System.out.println("datas.appendAttribute (\"pseudo\", \"style\", \"background: blue;\");");
+ System.out.println("datas.appendAttribute (\"pseudo\", \"style\", \"foreground: red;\");");
+ System.out.println("datas.setAttribute (\"pseudo\", \"class\", \"nameClass\");");
+ System.out.println("=>");
+ System.out.println(htmlTarget);
+ System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
- htmlTarget = null;
}
-
- System.out.println("datas = new Data ();");
- System.out.println("datas.setContent (\"lastname\", \"Spiderman\");");
- System.out.println("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
- System.out.println("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\");");
- System.out.println("datas.setAttribute (\"lastname\", \"class\", \"nameClass\");");
- System.out.println("+");
- System.out.println("a last name
");
- System.out.println("=>");
- System.out.println(htmlTarget);
- System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #03.
{
System.out.println("----------------------------");
- // Populate attributes.
- data = new TagDataManager();
- data.setContent("words", 0, "alpha");
- data.setContent("words", 1, "bravo");
- data.setContent("words", 2, "charlie");
- data.setContent("words", 3, "delta");
- data.setContent("words", 4, "echo");
- data.setContent("words", 5, "fox");
-
- String htmlSource = "";
- StringBuffer htmlTarget;
try
{
- htmlTarget = PresenterUtils.dynamize(htmlSource, data);
+ StringList source = new StringList();
+ source.appendln("");
+ source.appendln(" - a word
");
+ source.appendln("
");
+ String htmlSource = source.toString();
+
+ // Populate attributes.
+ data = new TagDataManager();
+ data.setContent("words", 0, "alpha");
+ data.setContent("words", 1, "bravo");
+ data.setContent("words", 2, "charlie");
+ data.setContent("words", 3, "delta");
+ data.setContent("words", 4, "echo");
+ data.setContent("words", 5, "fox");
+
+ String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
+
+ System.out.println(htmlSource);
+ System.out.println("+");
+ System.out.println("datas = new Data ();");
+ System.out.println("datas.setContent (\"words\", 0, \"alpha\");");
+ System.out.println("datas.setContent (\"words\", 1, \"bravo\");");
+ System.out.println("datas.setContent (\"words\", 2, \"charlie\");");
+ System.out.println("datas.setContent (\"words\", 3, \"delta\");");
+ System.out.println("datas.setContent (\"words\", 4, \"echo\");");
+ System.out.println("datas.setContent (\"words\", 5, \"fox\");");
+ System.out.println("=>");
+ System.out.println(htmlTarget);
+ System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
- htmlTarget = null;
}
-
- System.out.println("datas = new Data ();");
- System.out.println("datas.setContent (\"words\", 0, \"alpha\");");
- System.out.println("datas.setContent (\"words\", 1, \"bravo\");");
- System.out.println("datas.setContent (\"words\", 2, \"charlie\");");
- System.out.println("datas.setContent (\"words\", 3, \"delta\");");
- System.out.println("datas.setContent (\"words\", 4, \"echo\");");
- System.out.println("datas.setContent (\"words\", 5, \"fox\");");
- System.out.println("+");
- System.out.println("");
- System.out.println(" - a word
");
- System.out.println("
");
- System.out.println("=>");
- System.out.println(htmlTarget);
- System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #04.
{
- System.out.println("----------------------------");
- // Populate attributes.
- data = new TagDataManager();
- data.setContent("identity", 0, "last_name", "Jemba");
- data.setContent("identity", 0, "first_name", "Epo");
- data.setContent("identity", 1, "last_name", "Momon");
- data.setContent("identity", 1, "first_name", "Christian");
- data.setContent("identity", 2, "last_name", "Tronche");
- data.setContent("identity", 2, "first_name", "Christophe");
-
- StringBuffer source = new StringBuffer();
- source.append("\n");
- source.append(" noid | Jean | Reve |
\n");
- source.append("
");
-
- String htmlSource = source.toString();
- StringBuffer htmlTarget;
try
{
- htmlTarget = PresenterUtils.dynamize(htmlSource, data);
+ System.out.println("----------------------------");
+
+ StringBuffer source = new StringBuffer();
+ source.append("\n");
+ source.append(" noid | Jean | Reve |
\n");
+ source.append("
");
+ String htmlSource = source.toString();
+
+ // Populate attributes.
+ data = new TagDataManager();
+ data.setContent("identity", 0, "last_name", "Jemba");
+ data.setContent("identity", 0, "first_name", "Epo");
+ data.setContent("identity", 1, "last_name", "Momon");
+ data.setContent("identity", 1, "first_name", "Christian");
+ data.setContent("identity", 2, "last_name", "Tronche");
+ data.setContent("identity", 2, "first_name", "Christophe");
+
+ StringBuffer htmlTarget = PresenterUtils.dynamize(htmlSource, data);
+
+ System.out.println(htmlSource);
+ System.out.println("+");
+ System.out.println("datas = new Data ();");
+ System.out.println("datas.setContent (\"identity\", 0, \"last_name\", \"Jemba\");");
+ System.out.println("datas.setContent (\"identity\", 0, \"first_name\", \"Epo\");");
+ System.out.println("datas.setContent (\"identity\", 1, \"last_name\", \"Momon\");");
+ System.out.println("datas.setContent (\"identity\", 1, \"first_name\", \"Christian\");");
+ System.out.println("datas.setContent (\"identity\", 2, \"last_name\", \"Tronche\");");
+ System.out.println("datas.setContent (\"identity\", 2, \"first_name\", \"Christophe\");");
+ System.out.println("=>");
+ System.out.println(htmlTarget);
+ System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
- htmlTarget = null;
}
-
- System.out.println("datas = new Data ();");
- System.out.println("datas.setContent (\"identity\", 0, \"last_name\", \"Jemba\");");
- System.out.println("datas.setContent (\"identity\", 0, \"first_name\", \"Epo\");");
- System.out.println("datas.setContent (\"identity\", 1, \"last_name\", \"Momon\");");
- System.out.println("datas.setContent (\"identity\", 1, \"first_name\", \"Christian\");");
- System.out.println("datas.setContent (\"identity\", 2, \"last_name\", \"Tronche\");");
- System.out.println("datas.setContent (\"identity\", 2, \"first_name\", \"Christophe\");");
-
- System.out.println("+");
- System.out.println(htmlSource);
- System.out.println("=>");
- System.out.println(htmlTarget);
- System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #05.
{
System.out.println("----------------------------");
+
+ //
+ StringBuffer source = new StringBuffer();
+ source.append("\n");
+ source.append(" noid | First Name | Last Name |
\n");
+ source.append(" noid | Jean | Reve |
\n");
+ source.append(" noid | a first name | a last name |
\n");
+ source.append(" noid | a first name more | a last name more |
\n");
+ source.append("
\n");
+ String htmlSource = source.toString();
+
// Populate attributes.
data = new TagDataManager();
data.setContent("identity", 0, "last_name", "Jemba");
@@ -213,16 +222,8 @@ class XidynDemo
// datas.setIterationStrategy ("identity",
// IdsDataByIndex.IterationStrategy.ALL_ROWS);
- //
- StringBuffer source = new StringBuffer();
- source.append("\n");
- source.append(" noid | First Name | Last Name |
\n");
- source.append(" noid | Jean | Reve |
\n");
- source.append(" noid | a first name | a last name |
\n");
- source.append(" noid | a first name more | a last name more |
\n");
- source.append("
\n");
- String htmlSource = source.toString();
-
+ System.out.println(htmlSource);
+ System.out.println("+");
System.out.println("datas = new Data ();");
System.out.println("datas.setContent (\"identity\", 0, \"first_name\", \"Epo\");");
System.out.println("datas.setContent (\"identity\", 0, \"last_name\", \"Jemba\");");
@@ -230,9 +231,6 @@ class XidynDemo
System.out.println("datas.setContent (\"identity\", 1, \"last_name\", \"Momon\");");
System.out.println("datas.setContent (\"identity\", 2, \"first_name\", \"Christophe\");");
System.out.println("datas.setContent (\"identity\", 2, \"last_name\", \"Tronche\");");
-
- System.out.println("+");
- System.out.println(htmlSource);
System.out.println("=>");
// #05.1