Refactored demo.
This commit is contained in:
parent
11baf9644d
commit
1d574e700f
2 changed files with 24 additions and 50 deletions
|
@ -45,11 +45,6 @@ class XidynDemo
|
||||||
{
|
{
|
||||||
System.out.println("Hello World!");
|
System.out.println("Hello World!");
|
||||||
|
|
||||||
// test ();
|
|
||||||
|
|
||||||
//
|
|
||||||
TagDataManager data;
|
|
||||||
|
|
||||||
// Step #01.
|
// Step #01.
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -58,7 +53,7 @@ class XidynDemo
|
||||||
|
|
||||||
String htmlSource = "<div id='pseudo'>a pseudo</div >";
|
String htmlSource = "<div id='pseudo'>a pseudo</div >";
|
||||||
|
|
||||||
data = new TagDataManager();
|
TagDataManager data = new TagDataManager();
|
||||||
data.setContent("name", "Superman");
|
data.setContent("name", "Superman");
|
||||||
|
|
||||||
String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
|
String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
|
||||||
|
@ -83,23 +78,23 @@ class XidynDemo
|
||||||
{
|
{
|
||||||
System.out.println("----------------------------");
|
System.out.println("----------------------------");
|
||||||
|
|
||||||
String htmlSource = "<div id='lastname'>a last name</div >";
|
String htmlSource = "<div id=\"pseudo\">a pseudo</div >";
|
||||||
|
|
||||||
data = new TagDataManager();
|
TagDataManager data = new TagDataManager();
|
||||||
data.setContent("pseudo", "Spiderman");
|
data.setContent("pseudo", "Spiderman");
|
||||||
data.appendAttribute("pseudo", "style", "background: blue;");
|
data.appendAttribute("pseudo", "style", "background: blue;");
|
||||||
data.appendAttribute("pseudo", "style", "foreground: red;");
|
data.appendAttribute("pseudo", "style", "foreground: red;");
|
||||||
data.setAttribute("pseudo", "class", "nameClass");
|
data.setAttribute("pseudo", "class", "superhero");
|
||||||
|
|
||||||
String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
|
String htmlTarget = PresenterUtils.dynamize(htmlSource, data).toString();
|
||||||
|
|
||||||
System.out.println("<div id='lastname'>a last name</div>");
|
System.out.println(htmlSource);
|
||||||
System.out.println("+");
|
System.out.println("+");
|
||||||
System.out.println("datas = new Data ();");
|
System.out.println("datas = new Data ();");
|
||||||
System.out.println("datas.setContent (\"pseudo\", \"Spiderman\");");
|
System.out.println("datas.setContent (\"pseudo\", \"Spiderman\");");
|
||||||
System.out.println("datas.appendAttribute (\"pseudo\", \"style\", \"background: blue;\");");
|
System.out.println("datas.appendAttribute (\"pseudo\", \"style\", \"background: blue;\");");
|
||||||
System.out.println("datas.appendAttribute (\"pseudo\", \"style\", \"foreground: red;\");");
|
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("=>");
|
||||||
System.out.println(htmlTarget);
|
System.out.println(htmlTarget);
|
||||||
System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
|
System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
|
||||||
|
@ -122,7 +117,7 @@ class XidynDemo
|
||||||
String htmlSource = source.toString();
|
String htmlSource = source.toString();
|
||||||
|
|
||||||
// Populate attributes.
|
// Populate attributes.
|
||||||
data = new TagDataManager();
|
TagDataManager data = new TagDataManager();
|
||||||
data.setContent("words", 0, "alpha");
|
data.setContent("words", 0, "alpha");
|
||||||
data.setContent("words", 1, "bravo");
|
data.setContent("words", 1, "bravo");
|
||||||
data.setContent("words", 2, "charlie");
|
data.setContent("words", 2, "charlie");
|
||||||
|
@ -157,14 +152,14 @@ class XidynDemo
|
||||||
{
|
{
|
||||||
System.out.println("----------------------------");
|
System.out.println("----------------------------");
|
||||||
|
|
||||||
StringBuffer source = new StringBuffer();
|
StringList source = new StringList();
|
||||||
source.append("<table>\n");
|
source.append("<table>\n");
|
||||||
source.append(" <tr id='identity'><td>noid</td><td id='first_name'>Jean</td><td id='last_name'>Reve</td></tr>\n");
|
source.append(" <tr id='identity'><td>noid</td><td id='first_name'>Jean</td><td id='last_name'>Reve</td></tr>\n");
|
||||||
source.append("</table>");
|
source.append("</table>");
|
||||||
String htmlSource = source.toString();
|
String htmlSource = source.toString();
|
||||||
|
|
||||||
// Populate attributes.
|
// Populate attributes.
|
||||||
data = new TagDataManager();
|
TagDataManager data = new TagDataManager();
|
||||||
data.setContent("identity", 0, "last_name", "Jemba");
|
data.setContent("identity", 0, "last_name", "Jemba");
|
||||||
data.setContent("identity", 0, "first_name", "Epo");
|
data.setContent("identity", 0, "first_name", "Epo");
|
||||||
data.setContent("identity", 1, "last_name", "Momon");
|
data.setContent("identity", 1, "last_name", "Momon");
|
||||||
|
@ -198,43 +193,23 @@ class XidynDemo
|
||||||
System.out.println("----------------------------");
|
System.out.println("----------------------------");
|
||||||
|
|
||||||
//
|
//
|
||||||
StringBuffer source = new StringBuffer();
|
StringList source = new StringList();
|
||||||
source.append("<table id=\"identities\">\n");
|
source.appendln("<ul id=\"words\">");
|
||||||
source.append(" <tr id='the_head'><th>noid</th><th>First Name</th><th>Last Name</th></tr>\n");
|
source.appendln(" <li id=\"first\">alpha</li>");
|
||||||
source.append(" <tr id='identity'><td>noid</td><td id='first_name'>Jean</td><td id='last_name'>Reve</td></tr>\n");
|
source.appendln(" <li id=\"second\">bravo</li>");
|
||||||
source.append(" <tr id='identity_bis'><td>noid</td><td id='first_name_bis'>a first name</td><td id='last_name_bis'>a last name</td></tr>\n");
|
source.appendln(" <li id=\"third\">charlie</li>");
|
||||||
source.append(" <tr><td>noid</td><td id='first_name_ter'>a first name more</td><td id='last_name_ter'>a last name more</td></tr>\n");
|
source.appendln(" <li>delta</li>");
|
||||||
source.append("</table>\n");
|
source.appendln("</ul>");
|
||||||
String htmlSource = source.toString();
|
String htmlSource = source.toString();
|
||||||
|
|
||||||
// Populate attributes.
|
// 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");
|
|
||||||
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);
|
|
||||||
|
|
||||||
System.out.println(htmlSource);
|
System.out.println(htmlSource);
|
||||||
System.out.println("+");
|
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
|
// #05.1
|
||||||
data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_FIRST_ROW);
|
data.setIterationStrategy("words", SimpleTagData.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
System.out.println("ONLY_FIRST_ROW:");
|
System.out.println("ONLY_FIRST_ROW:");
|
||||||
StringBuffer html;
|
StringBuffer html;
|
||||||
try
|
try
|
||||||
|
@ -250,7 +225,7 @@ class XidynDemo
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
|
||||||
// #05.2
|
// #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:");
|
System.out.println("ONLY_FIRST_TWO_ROWS:");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -265,7 +240,7 @@ class XidynDemo
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
|
||||||
// #05.3
|
// #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:");
|
System.out.println("ONLY_ROWS_WITH_ID:");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -280,7 +255,7 @@ class XidynDemo
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
|
||||||
// #05.4
|
// #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:");
|
System.out.println("ONLY_ROWS_WITHOUT_ID:");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -295,7 +270,7 @@ class XidynDemo
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
|
||||||
// #05.5
|
// #05.5
|
||||||
data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ALL_ROWS);
|
data.setIterationStrategy("words", SimpleTagData.IterationStrategy.ALL_ROWS);
|
||||||
System.out.println("ALL_ROWS:");
|
System.out.println("ALL_ROWS:");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,9 +51,8 @@ public class TagDataManager
|
||||||
|
|
||||||
if (tags == null)
|
if (tags == null)
|
||||||
{
|
{
|
||||||
this.idsDataById.setId(id, new TagDataListByIndex());
|
tags = new TagDataListByIndex();
|
||||||
|
this.idsDataById.setId(id, tags);
|
||||||
tags = (TagDataListByIndex) this.idsDataById.getId(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Be sure that lines are existing.
|
// Be sure that lines are existing.
|
||||||
|
|
Loading…
Reference in a new issue