diff --git a/demo/XidynDemo.java b/demo/XidynDemo.java
index 24efb65..45077d9 100644
--- a/demo/XidynDemo.java
+++ b/demo/XidynDemo.java
@@ -45,11 +45,6 @@ class XidynDemo
{
System.out.println("Hello World!");
- // test ();
-
- //
- TagDataManager data;
-
// Step #01.
{
try
@@ -58,7 +53,7 @@ class XidynDemo
String htmlSource = "
a pseudo
";
- data = new TagDataManager();
+ TagDataManager data = new TagDataManager();
data.setContent("name", "Superman");
String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
@@ -83,23 +78,23 @@ class XidynDemo
{
System.out.println("----------------------------");
- String htmlSource = "a last name
";
+ String htmlSource = "a pseudo
";
- data = new TagDataManager();
+ TagDataManager data = new TagDataManager();
data.setContent("pseudo", "Spiderman");
data.appendAttribute("pseudo", "style", "background: blue;");
data.appendAttribute("pseudo", "style", "foreground: red;");
- data.setAttribute("pseudo", "class", "nameClass");
+ data.setAttribute("pseudo", "class", "superhero");
String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
- System.out.println("a last name
");
+ System.out.println(htmlSource);
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("datas.setAttribute (\"pseudo\", \"class\", \"superhero\");");
System.out.println("=>");
System.out.println(htmlTarget);
System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
@@ -122,7 +117,7 @@ class XidynDemo
String htmlSource = source.toString();
// Populate attributes.
- data = new TagDataManager();
+ TagDataManager data = new TagDataManager();
data.setContent("words", 0, "alpha");
data.setContent("words", 1, "bravo");
data.setContent("words", 2, "charlie");
@@ -157,14 +152,14 @@ class XidynDemo
{
System.out.println("----------------------------");
- StringBuffer source = new StringBuffer();
+ StringList source = new StringList();
source.append("\n");
source.append(" noid | Jean | Reve |
\n");
source.append("
");
String htmlSource = source.toString();
// Populate attributes.
- data = new TagDataManager();
+ TagDataManager data = new TagDataManager();
data.setContent("identity", 0, "last_name", "Jemba");
data.setContent("identity", 0, "first_name", "Epo");
data.setContent("identity", 1, "last_name", "Momon");
@@ -198,43 +193,23 @@ class XidynDemo
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");
+ StringList source = new StringList();
+ source.appendln("");
+ source.appendln(" - alpha
");
+ source.appendln(" - bravo
");
+ source.appendln(" - charlie
");
+ source.appendln(" - delta
");
+ source.appendln("
");
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");
- // datas.setIterationStrategy ("identity",
- // IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
- // datas.setIterationStrategy ("identity",
- // IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
- // datas.setIterationStrategy ("identity",
- // IdsDataByIndex.IterationStrategy.ALL_ROWS);
+ TagDataManager data = new TagDataManager();
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\");");
- System.out.println("datas.setContent (\"identity\", 1, \"first_name\", \"Christian\");");
- 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("=>");
// #05.1
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_FIRST_ROW);
+ data.setIterationStrategy("words", SimpleTagData.IterationStrategy.ONLY_FIRST_ROW);
System.out.println("ONLY_FIRST_ROW:");
StringBuffer html;
try
@@ -250,7 +225,7 @@ class XidynDemo
System.out.println("");
// #05.2
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_FIRST_TWO_ROWS);
+ data.setIterationStrategy("words", SimpleTagData.IterationStrategy.ONLY_FIRST_TWO_ROWS);
System.out.println("ONLY_FIRST_TWO_ROWS:");
try
{
@@ -265,7 +240,7 @@ class XidynDemo
System.out.println("");
// #05.3
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_ROWS_WITH_ID);
+ data.setIterationStrategy("words", SimpleTagData.IterationStrategy.ONLY_ROWS_WITH_ID);
System.out.println("ONLY_ROWS_WITH_ID:");
try
{
@@ -280,7 +255,7 @@ class XidynDemo
System.out.println("");
// #05.4
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
+ data.setIterationStrategy("words", SimpleTagData.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
System.out.println("ONLY_ROWS_WITHOUT_ID:");
try
{
@@ -295,7 +270,7 @@ class XidynDemo
System.out.println("");
// #05.5
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ALL_ROWS);
+ data.setIterationStrategy("words", SimpleTagData.IterationStrategy.ALL_ROWS);
System.out.println("ALL_ROWS:");
try
{
diff --git a/src/fr/devinsy/xidyn/data/TagDataManager.java b/src/fr/devinsy/xidyn/data/TagDataManager.java
index 2282cab..c1ffd2e 100644
--- a/src/fr/devinsy/xidyn/data/TagDataManager.java
+++ b/src/fr/devinsy/xidyn/data/TagDataManager.java
@@ -51,9 +51,8 @@ public class TagDataManager
if (tags == null)
{
- this.idsDataById.setId(id, new TagDataListByIndex());
-
- tags = (TagDataListByIndex) this.idsDataById.getId(id);
+ tags = new TagDataListByIndex();
+ this.idsDataById.setId(id, tags);
}
// Be sure that lines are existing.