Manage namedTagData ('<div>').
This commit is contained in:
parent
1b32ee50f7
commit
00e729af30
9 changed files with 293 additions and 103 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
dist/test.jar
vendored
BIN
dist/test.jar
vendored
Binary file not shown.
BIN
dist/xid.jar
vendored
BIN
dist/xid.jar
vendored
Binary file not shown.
|
@ -21,6 +21,15 @@ public class Attributes extends HashMap<String, String>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Useful for the merge attributes.
|
||||||
|
*/
|
||||||
|
public Attributes (Attributes attributes)
|
||||||
|
{
|
||||||
|
super (attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -263,6 +263,89 @@ public class Presenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static public Attributes getNamedTagAttributes (TagsDataById datas, String name)
|
||||||
|
{
|
||||||
|
Attributes result;
|
||||||
|
|
||||||
|
if ((name == null) || (datas == null))
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TagDataCore dataCore = datas.getId ("<" + name + ">");
|
||||||
|
if (dataCore == null)
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
else if (!(dataCore instanceof TagData))
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TagData data = (TagData) dataCore;
|
||||||
|
|
||||||
|
result = data.getAttributes ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static public Attributes mergeAttributes (Attributes target, Attributes source)
|
||||||
|
{
|
||||||
|
Attributes result;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
result = source;
|
||||||
|
}
|
||||||
|
else if (source == null)
|
||||||
|
{
|
||||||
|
result = target;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new Attributes (target);
|
||||||
|
|
||||||
|
Iterator iterator = source.entrySet().iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
Map.Entry<String, String> attribute = (Map.Entry<String, String>) iterator.next();
|
||||||
|
|
||||||
|
String currentValue = target.get (attribute.getKey ());
|
||||||
|
|
||||||
|
if (currentValue == null)
|
||||||
|
{
|
||||||
|
result.put (attribute.getKey (), attribute.getValue ());
|
||||||
|
}
|
||||||
|
else if (attribute.getKey ().equals ("style"))
|
||||||
|
{
|
||||||
|
result.put (attribute.getKey (), currentValue + attribute.getValue ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.put (attribute.getKey (), attribute.getValue ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -622,7 +705,7 @@ public class Presenter
|
||||||
result.append (node.getNodeName());
|
result.append (node.getNodeName());
|
||||||
|
|
||||||
// Build attributes.
|
// Build attributes.
|
||||||
result.append (processAttributes (attrs, data, prefix));
|
result.append (processAttributes (attrs, data.getAttributes (), getNamedTagAttributes (datas, node.getNodeName ()), prefix));
|
||||||
|
|
||||||
if ((node.getChildNodes () == null) &&
|
if ((node.getChildNodes () == null) &&
|
||||||
((data == null) || data.display ().equals ("")))
|
((data == null) || data.display ().equals ("")))
|
||||||
|
@ -668,7 +751,7 @@ public class Presenter
|
||||||
result.append (node.getNodeName());
|
result.append (node.getNodeName());
|
||||||
|
|
||||||
// Build attributes.
|
// Build attributes.
|
||||||
result.append (processAttributes (attrs, data, Integer.toString (nLine)));
|
result.append (processAttributes (attrs, data.getAttributes (), getNamedTagAttributes (datas, node.getNodeName ()), Integer.toString (nLine)));
|
||||||
|
|
||||||
if ((node.getChildNodes () == null) &&
|
if ((node.getChildNodes () == null) &&
|
||||||
((data == null) || data.display ().equals ("")))
|
((data == null) || data.display ().equals ("")))
|
||||||
|
@ -751,7 +834,6 @@ public class Presenter
|
||||||
if (node != null)
|
if (node != null)
|
||||||
{
|
{
|
||||||
log.debug ("nodeName=" + node.getNodeName ());
|
log.debug ("nodeName=" + node.getNodeName ());
|
||||||
|
|
||||||
// Find the name attribute value.
|
// Find the name attribute value.
|
||||||
String name;
|
String name;
|
||||||
name = getClassAttributeValue (node);
|
name = getClassAttributeValue (node);
|
||||||
|
@ -891,27 +973,10 @@ public class Presenter
|
||||||
result.append (node.getNodeName());
|
result.append (node.getNodeName());
|
||||||
|
|
||||||
// Build the tag attributes.
|
// Build the tag attributes.
|
||||||
NamedNodeMap attrs = node.getAttributes ();
|
result.append (processAttributes (node.getAttributes (),
|
||||||
if (attrs != null)
|
getNamedTagAttributes (datas, node.getNodeName ()),
|
||||||
{
|
null,
|
||||||
for (int i = 0; i < attrs.getLength(); i++)
|
prefix));
|
||||||
{
|
|
||||||
Attr attr = (Attr) attrs.item(i);
|
|
||||||
result.append (' ');
|
|
||||||
result.append (attr.getNodeName());
|
|
||||||
result.append ("=\"");
|
|
||||||
result.append (restoreEntities(new StringBuffer(attr.getNodeValue())));
|
|
||||||
|
|
||||||
// Don't forget the list case.
|
|
||||||
if ((attr.getNodeName ().equals ("id")) && (prefix.length () != 0))
|
|
||||||
{
|
|
||||||
result.append (Presenter.INDEX_SEPARATOR);
|
|
||||||
result.append (prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.append ("\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
if (node.getChildNodes () == null)
|
if (node.getChildNodes () == null)
|
||||||
|
@ -928,7 +993,6 @@ public class Presenter
|
||||||
result.append(node.getNodeName());
|
result.append(node.getNodeName());
|
||||||
result.append('>');
|
result.append('>');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1237,11 +1301,11 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer processAttributes (NamedNodeMap attrs, TagData model)
|
static protected StringBuffer processAttributes (NamedNodeMap attrs, Attributes dataAttributes, Attributes namedDataAttributes, String prefix)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
result = processAttributes (attrs, model, "");
|
result = processAttributes (attrs, mergeAttributes (dataAttributes, namedDataAttributes), prefix);
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -1251,7 +1315,35 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer processAttributes (NamedNodeMap attrs, TagData model, String prefix)
|
static protected StringBuffer processAttributes (NamedNodeMap attrs, Attributes dataAttributes)
|
||||||
|
{
|
||||||
|
StringBuffer result;
|
||||||
|
|
||||||
|
result = processAttributes (attrs, dataAttributes, "");
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static protected StringBuffer processAttributes (NamedNodeMap attrs)
|
||||||
|
{
|
||||||
|
StringBuffer result;
|
||||||
|
|
||||||
|
result = processAttributes (attrs, null, null, "");
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static protected StringBuffer processAttributes (NamedNodeMap attrs, Attributes dataAttributes, String prefix)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -1268,13 +1360,9 @@ public class Presenter
|
||||||
|
|
||||||
|
|
||||||
// Put model attributes in the merged attributes list.
|
// Put model attributes in the merged attributes list.
|
||||||
if (model != null)
|
if (dataAttributes != null)
|
||||||
{
|
{
|
||||||
Attributes modelAttributes = model.getAttributes();
|
Iterator iterator = dataAttributes.entrySet().iterator();
|
||||||
|
|
||||||
if (modelAttributes != null)
|
|
||||||
{
|
|
||||||
Iterator iterator = modelAttributes.entrySet().iterator();
|
|
||||||
|
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
|
@ -1297,8 +1385,6 @@ public class Presenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Display the attributes
|
// Display the attributes
|
||||||
Iterator iterator = mergedAttributes.entrySet().iterator();
|
Iterator iterator = mergedAttributes.entrySet().iterator();
|
||||||
|
|
|
@ -57,6 +57,7 @@ class Test
|
||||||
StringBuffer errorMessage;
|
StringBuffer errorMessage;
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
tag = new TagData ();
|
tag = new TagData ();
|
||||||
tag.setContent ("Superman");
|
tag.setContent ("Superman");
|
||||||
|
@ -65,7 +66,6 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("tag = new TagData ();");
|
System.out.println ("tag = new TagData ();");
|
||||||
System.out.println ("tag.setContent (\"Superman\");");
|
System.out.println ("tag.setContent (\"Superman\");");
|
||||||
|
@ -77,13 +77,13 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("name", "Superman");
|
datas.setContent ("name", "Superman");
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"name\", \"Superman\");");
|
System.out.println ("datas.setContent (\"name\", \"Superman\");");
|
||||||
System.out.println ("+");
|
System.out.println ("+");
|
||||||
|
@ -93,6 +93,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
tag = new TagData ();
|
tag = new TagData ();
|
||||||
tag.setContent ("Spiderman");
|
tag.setContent ("Spiderman");
|
||||||
|
@ -105,7 +106,6 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("tag = new TagData ();");
|
System.out.println ("tag = new TagData ();");
|
||||||
System.out.println ("tag.getAttributes ().setAttribute (\"class\", \"lastnameClass\");");
|
System.out.println ("tag.getAttributes ().setAttribute (\"class\", \"lastnameClass\");");
|
||||||
|
@ -120,6 +120,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("lastname", "Spiderman");
|
datas.setContent ("lastname", "Spiderman");
|
||||||
datas.appendAttribute ("lastname", "style", "background: blue;");
|
datas.appendAttribute ("lastname", "style", "background: blue;");
|
||||||
|
@ -130,11 +131,10 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
|
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
|
||||||
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
|
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
|
||||||
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\"");
|
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\");");
|
||||||
System.out.println ("datas.setAttribute (\"lastname\", \"class\", \"nameClass\");");
|
System.out.println ("datas.setAttribute (\"lastname\", \"class\", \"nameClass\");");
|
||||||
System.out.println ("+");
|
System.out.println ("+");
|
||||||
System.out.println ("<div id='lastname'>a last name</div>");
|
System.out.println ("<div id='lastname'>a last name</div>");
|
||||||
|
@ -143,6 +143,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("words", 0, "alpha");
|
datas.setContent ("words", 0, "alpha");
|
||||||
datas.setContent ("words", 1, "bravo");
|
datas.setContent ("words", 1, "bravo");
|
||||||
|
@ -155,7 +156,6 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
html = Presenter.doXid ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"words\", 0, \"alpha\");");
|
System.out.println ("datas.setContent (\"words\", 0, \"alpha\");");
|
||||||
System.out.println ("datas.setContent (\"words\", 1, \"bravo\");");
|
System.out.println ("datas.setContent (\"words\", 1, \"bravo\");");
|
||||||
|
@ -172,6 +172,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("identity", 0, "nom", "Jemba");
|
datas.setContent ("identity", 0, "nom", "Jemba");
|
||||||
datas.setContent ("identity", 0, "prenom", "Epo");
|
datas.setContent ("identity", 0, "prenom", "Epo");
|
||||||
|
@ -182,10 +183,13 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
htmlSource = "<table>\n <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n</table>";
|
StringBuffer source = new StringBuffer ();
|
||||||
|
source.append ("<table>\n");
|
||||||
|
source.append (" <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n");
|
||||||
|
source.append ("</table>");
|
||||||
|
htmlSource = source.toString ();
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||||
|
@ -201,6 +205,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("identity", 0, "nom", "Jemba");
|
datas.setContent ("identity", 0, "nom", "Jemba");
|
||||||
datas.setContent ("identity", 0, "prenom", "Epo");
|
datas.setContent ("identity", 0, "prenom", "Epo");
|
||||||
|
@ -215,7 +220,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
StringBuffer source = new StringBuffer ();
|
source = new StringBuffer ();
|
||||||
source.append ("<table>\n");
|
source.append ("<table>\n");
|
||||||
source.append (" <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n");
|
source.append (" <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n");
|
||||||
source.append (" <tr id='identity2'><td>noid</td><td id='nom2'>un nom</td><td id='prenom2'>un prenom</td></tr>\n");
|
source.append (" <tr id='identity2'><td>noid</td><td id='nom2'>un nom</td><td id='prenom2'>un prenom</td></tr>\n");
|
||||||
|
@ -223,7 +228,6 @@ class Test
|
||||||
source.append ("</table>");
|
source.append ("</table>");
|
||||||
htmlSource = source.toString ();
|
htmlSource = source.toString ();
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||||
|
@ -256,5 +260,38 @@ class Test
|
||||||
System.out.println ("ALL_ROWS:");
|
System.out.println ("ALL_ROWS:");
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
System.out.println (html);
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new TagsData ();
|
||||||
|
datas.setAttribute ("<div>", "class", "aDivClass");
|
||||||
|
datas.setAttribute ("<div>", "style", "background-color: #000000;");
|
||||||
|
datas.setAttribute ("number", "style", "background-color: #0000FF;");
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
source = new StringBuffer ();
|
||||||
|
source.append ("<div>\n");
|
||||||
|
source.append (" <h1>one</h1>\n");
|
||||||
|
source.append ("</div>\n");
|
||||||
|
source.append ("<div id=\"number\">\n");
|
||||||
|
source.append (" <h1>three</h1>\n");
|
||||||
|
source.append ("</div>");
|
||||||
|
htmlSource = source.toString ();
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println (htmlSource);
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println ("datas = new TagsData ();");
|
||||||
|
System.out.println ("datas.setAttribute (\"<div>\", \"class\", \"aDivClass\");");
|
||||||
|
System.out.println ("datas.setAttribute (\"<div>\", \"style\", \"background-color: #000000;\");");
|
||||||
|
System.out.println ("datas.setAttribute (\"number\", \"style\", \"background-color: #0000FF;\");");
|
||||||
|
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ class Test
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
|
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
|
||||||
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
|
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
|
||||||
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\"");
|
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\");");
|
||||||
System.out.println ("datas.setAttribute (\"lastname\", \"class\", \"nameClass\");");
|
System.out.println ("datas.setAttribute (\"lastname\", \"class\", \"nameClass\");");
|
||||||
System.out.println ("+");
|
System.out.println ("+");
|
||||||
System.out.println ("<div id='lastname'>a last name</div>");
|
System.out.println ("<div id='lastname'>a last name</div>");
|
||||||
|
@ -182,40 +182,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<table>\n <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td>\n</table>", datas, "", errorMessage);
|
htmlSource = "<table>\n <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n</table>";
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
|
||||||
System.out.println ("datas.setContent (\"identity\", 1, \"nom\", \"Momon\");");
|
|
||||||
System.out.println ("datas.setContent (\"identity\", 1, \"prenom\", \"Christian\");");
|
|
||||||
System.out.println ("datas.setContent (\"identity\", 2, \"nom\", \"Tronche\");");
|
|
||||||
System.out.println ("datas.setContent (\"identity\", 2, \"prenom\", \"Christophe\");");
|
|
||||||
|
|
||||||
System.out.println ("+");
|
|
||||||
System.out.println ("<table>");
|
|
||||||
System.out.println (" <tr id='identity'><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>");
|
|
||||||
System.out.println (" <tr id='identity2'><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>");
|
|
||||||
System.out.println (" <tr id='identity3'><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>");
|
|
||||||
System.out.println ("</table>");
|
|
||||||
System.out.println ("=>");
|
|
||||||
System.out.println (html);
|
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
|
||||||
datas = new TagsData ();
|
|
||||||
datas.setContent ("identity", 0, "nom", "Jemba");
|
|
||||||
datas.setContent ("identity", 0, "prenom", "Epo");
|
|
||||||
datas.setContent ("identity", 1, "nom", "Momon");
|
|
||||||
datas.setContent ("identity", 1, "prenom", "Christian");
|
|
||||||
datas.setContent ("identity", 2, "nom", "Tronche");
|
|
||||||
datas.setContent ("identity", 2, "prenom", "Christophe");
|
|
||||||
//datas.setIterationStrategy ("table"
|
|
||||||
|
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
|
||||||
htmlSource = "<table id='table'>\n <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td>\n<tr id='identity2'><td>noid</td><td id='nom2'>un nom</td><td id='prenom2'>un prenom</td>\n<tr><td>noid</td><td id='nom3'>un nom</td><td id='prenom3'>un prenom</td>\n</table>";
|
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
|
@ -231,5 +198,96 @@ class Test
|
||||||
System.out.println (htmlSource);
|
System.out.println (htmlSource);
|
||||||
System.out.println ("=>");
|
System.out.println ("=>");
|
||||||
System.out.println (html);
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
datas = new TagsData ();
|
||||||
|
datas.setContent ("identity", 0, "nom", "Jemba");
|
||||||
|
datas.setContent ("identity", 0, "prenom", "Epo");
|
||||||
|
datas.setContent ("identity", 1, "nom", "Momon");
|
||||||
|
datas.setContent ("identity", 1, "prenom", "Christian");
|
||||||
|
datas.setContent ("identity", 2, "nom", "Tronche");
|
||||||
|
datas.setContent ("identity", 2, "prenom", "Christophe");
|
||||||
|
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
|
//datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||||
|
//datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||||
|
//datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ALL_ROWS);
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
StringBuffer source = new StringBuffer ();
|
||||||
|
source.append ("<table>\n");
|
||||||
|
source.append (" <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n");
|
||||||
|
source.append (" <tr id='identity2'><td>noid</td><td id='nom2'>un nom</td><td id='prenom2'>un prenom</td></tr>\n");
|
||||||
|
source.append (" <tr><td>noid</td><td id='nom3'>un nom</td><td id='prenom3'>un prenom</td></tr>\n");
|
||||||
|
source.append ("</table>");
|
||||||
|
htmlSource = source.toString ();
|
||||||
|
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
System.out.println ("datas = new TagsData ();");
|
||||||
|
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||||
|
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||||
|
System.out.println ("datas.setContent (\"identity\", 1, \"nom\", \"Momon\");");
|
||||||
|
System.out.println ("datas.setContent (\"identity\", 1, \"prenom\", \"Christian\");");
|
||||||
|
System.out.println ("datas.setContent (\"identity\", 2, \"nom\", \"Tronche\");");
|
||||||
|
System.out.println ("datas.setContent (\"identity\", 2, \"prenom\", \"Christophe\");");
|
||||||
|
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println (htmlSource);
|
||||||
|
System.out.println ("=>");
|
||||||
|
|
||||||
|
|
||||||
|
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
|
System.out.println ("ONLY_FIRST_ROW:");
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||||
|
System.out.println ("ONLY_ROWS_WITH_ID:");
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||||
|
System.out.println ("ONLY_ROWS_WITHOUT_ID:");
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ALL_ROWS);
|
||||||
|
System.out.println ("ALL_ROWS:");
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new TagsData ();
|
||||||
|
datas.setAttribute ("<div>", "class", "aDivClass");
|
||||||
|
datas.setAttribute ("<div>", "style", "background-color: #000000;");
|
||||||
|
datas.setAttribute ("number", "style", "background-color: #0000FF;");
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
source = new StringBuffer ();
|
||||||
|
source.append ("<div>\n");
|
||||||
|
source.append (" <h1>one</h1>\n");
|
||||||
|
source.append ("</div>\n");
|
||||||
|
source.append ("<div id=\"number\">\n");
|
||||||
|
source.append (" <h1>three</h1>\n");
|
||||||
|
source.append ("</div>");
|
||||||
|
htmlSource = source.toString ();
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println (htmlSource);
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println ("datas = new TagsData ();");
|
||||||
|
System.out.println ("datas.setAttribute (\"<div>\", \"class\", \"aDivClass\");");
|
||||||
|
System.out.println ("datas.setAttribute (\"<div>\", \"style\", \"background-color: #000000;\");");
|
||||||
|
System.out.println ("datas.setAttribute (\"number\", \"style\", \"background-color: #0000FF;\");");
|
||||||
|
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue