diff --git a/build/classes/xid/Presenter.class b/build/classes/xid/Presenter.class index 29d02fa..60cd683 100644 Binary files a/build/classes/xid/Presenter.class and b/build/classes/xid/Presenter.class differ diff --git a/build_test/classes/xid/test/Test.class b/build_test/classes/xid/test/Test.class index b3acf4a..0a7ab99 100644 Binary files a/build_test/classes/xid/test/Test.class and b/build_test/classes/xid/test/Test.class differ diff --git a/dist/test.jar b/dist/test.jar index 1c37008..8e52c59 100644 Binary files a/dist/test.jar and b/dist/test.jar differ diff --git a/dist/xid.jar b/dist/xid.jar index b50ff03..7a84700 100644 Binary files a/dist/xid.jar and b/dist/xid.jar differ diff --git a/src/xid/Presenter.java b/src/xid/Presenter.java index f4bfb9e..dbd55d8 100644 --- a/src/xid/Presenter.java +++ b/src/xid/Presenter.java @@ -483,7 +483,47 @@ public class Presenter } else if (dataCore instanceof TagsData) { - TagsData data = (TagsData) dataCore; + TagsData tags = (TagsData) dataCore; + + int nbLines = tags.size (); + for (int nLine = 0; nLine < nbLines; nLine++) + { + TagData data = (TagData) tags.elementAt (nLine); + + // Open the tag. + result.append ("<"); + result.append (node.getNodeName()); + + // Build attributes. + result.append (processAttributes (attrs, data)); + + if ((node.getChildNodes () == null) && + ((data == null) || data.display ().equals (""))) + { + // Close the tag. + result.append (" />\n"); + } + else + { + result.append ('>'); + + // Insert data. + if ((data == null) || + (data.display ().equals (""))) + { + result.append (processChildren (node, datas, webappPath, errorOutput)); + } + else + { + result.append (data.display ()); + } + + // Close the tag. + result.append ("\n"); + } + } } else if (dataCore instanceof TagsDataById) { diff --git a/src/xid/TagsDataById.java b/src/xid/TagsDataById.java index 3db8ff7..a763259 100644 --- a/src/xid/TagsDataById.java +++ b/src/xid/TagsDataById.java @@ -79,9 +79,9 @@ public class TagsDataById extends HashMap implements TagDat // Be sure that lines are existing. int nbLines = tags.size (); - for (int nLine = nbLines; nLine < line; nLine++) + for (int nLine = nbLines; nLine < line + 1; nLine++) { - tags.set (nLine, new TagData ()); + tags.add (nLine, new TagData ()); } // Get item. @@ -110,9 +110,9 @@ public class TagsDataById extends HashMap implements TagDat // Be sure that lines are existing. int nbLines = tags.size (); - for (int nLine = nbLines; nLine < line; nLine++) + for (int nLine = nbLines; nLine < line + 1; nLine++) { - tags.set (nLine, new TagsDataById ()); + tags.add (nLine, new TagsDataById ()); } // Get item. diff --git a/test/xid/test/Test.java b/test/xid/test/Test.java index 63108f6..f1fd338 100644 --- a/test/xid/test/Test.java +++ b/test/xid/test/Test.java @@ -210,7 +210,7 @@ class Test errorMessage = new StringBuffer (); - html = Presenter.doXid ("
a last name
", datas, "", errorMessage); + html = Presenter.doXid ("
a last name
", datas, "", errorMessage); System.out.println ("----------------------------"); System.out.println ("datas = new TagsDataId ();"); @@ -222,6 +222,35 @@ class Test System.out.println ("
a last name
"); System.out.println ("=>"); System.out.println (html); + + + // Populate attributes of Test 03. + datas = new TagsDataById (); + datas.setContent ("words", 0, "alpha"); + datas.setContent ("words", 1, "bravo"); + datas.setContent ("words", 2, "charlie"); + datas.setContent ("words", 3, "delta"); + datas.setContent ("words", 4, "echo"); + datas.setContent ("words", 5, "fox"); + + + errorMessage = new StringBuffer (); + html = Presenter.doXid ("", datas, "", errorMessage); + + System.out.println ("----------------------------"); + System.out.println ("datas = new TagsDataId ();"); + 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 ("=>"); + System.out.println (html); System.out.println ("----------------------------"); } }