Create demo section.
This commit is contained in:
parent
16e7939445
commit
c686420613
4 changed files with 628 additions and 2 deletions
36
build.xml
36
build.xml
|
@ -11,12 +11,13 @@
|
||||||
<property name="resources" value="resources"/>
|
<property name="resources" value="resources"/>
|
||||||
<property name="debug" value="on"/>
|
<property name="debug" value="on"/>
|
||||||
|
|
||||||
<target name="all" depends="build_xid,dist_xid,build_test,dist_test,examples" />
|
<target name="all" depends="build_xid,dist_xid,build_test,dist_test,build_demo,dist_demo" />
|
||||||
|
|
||||||
<!-- ******* Init ******* -->
|
<!-- ******* Init ******* -->
|
||||||
<target name="init">
|
<target name="init">
|
||||||
<tstamp/>
|
<tstamp/>
|
||||||
<mkdir dir="${build}"/>
|
<mkdir dir="${build}"/>
|
||||||
|
<mkdir dir="build_demo/classes"/>
|
||||||
<mkdir dir="build_test/classes"/>
|
<mkdir dir="build_test/classes"/>
|
||||||
<mkdir dir="${build}/classes"/>
|
<mkdir dir="${build}/classes"/>
|
||||||
<mkdir dir="${dist}"/>
|
<mkdir dir="${dist}"/>
|
||||||
|
@ -75,6 +76,39 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ******* build_demo ******* -->
|
||||||
|
<target name="build_demo" depends="dist_xid">
|
||||||
|
<javac srcdir="demo" destdir="build_demo/classes" debug="${debug}" deprecation="on">
|
||||||
|
<classpath>
|
||||||
|
<fileset dir="lib" includes="**/*.jar"/>
|
||||||
|
<pathelement path="dist/xid.jar"/>
|
||||||
|
</classpath>
|
||||||
|
</javac>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ****** dist_demo ****** -->
|
||||||
|
<target name="dist_demo" depends="build_demo">
|
||||||
|
<jar update="no" jarfile="dist/demo.jar">
|
||||||
|
<fileset dir="build_demo/classes" includes="**.class" />
|
||||||
|
<fileset dir="resources" includes="**" />
|
||||||
|
</jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- *********** dodemo ******** -->
|
||||||
|
<target name="dodemo" depends="dist_demo">
|
||||||
|
<java classname="Demo" maxmemory="20m" fork="true">
|
||||||
|
<classpath>
|
||||||
|
<fileset dir="lib" includes="**/*.jar" />
|
||||||
|
<fileset dir="resources" includes="**" />
|
||||||
|
<pathelement path="dist/xid.jar"/>
|
||||||
|
<pathelement path="dist/demo.jar"/>
|
||||||
|
</classpath>
|
||||||
|
</java>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<!-- ******* Examples (the webapp). ******* -->
|
<!-- ******* Examples (the webapp). ******* -->
|
||||||
<target name="examples" depends="dist_xid">
|
<target name="examples" depends="dist_xid">
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,9 @@
|
||||||
<java classname="xid.test.Test" maxmemory="20m" fork="true">
|
<java classname="xid.test.Test" maxmemory="20m" fork="true">
|
||||||
<classpath>
|
<classpath>
|
||||||
<fileset dir="lib" includes="**/*.jar" />
|
<fileset dir="lib" includes="**/*.jar" />
|
||||||
|
<fileset dir="resources" includes="**" />
|
||||||
<pathelement path="dist/xid.jar"/>
|
<pathelement path="dist/xid.jar"/>
|
||||||
<pathelement path="dist/test.jar"/>
|
<pathelement path="dist/test.jar"/>
|
||||||
<pathelement path="test/log4j.properties"/>
|
|
||||||
</classpath>
|
</classpath>
|
||||||
</java>
|
</java>
|
||||||
</target>
|
</target>
|
||||||
|
|
295
demo/Demo.java
Normal file
295
demo/Demo.java
Normal file
|
@ -0,0 +1,295 @@
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
import xid.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Demo
|
||||||
|
{
|
||||||
|
static private org.apache.log4j.Logger log;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
// Initialize log.
|
||||||
|
org.apache.log4j.Logger log = null;
|
||||||
|
|
||||||
|
org.apache.log4j.BasicConfigurator.configure ();
|
||||||
|
|
||||||
|
|
||||||
|
log = org.apache.log4j.Logger.getRootLogger ();
|
||||||
|
//log.setLevel (org.apache.log4j.Level.INFO);
|
||||||
|
log.setLevel (org.apache.log4j.Level.INFO);
|
||||||
|
|
||||||
|
log.info ("Enter");
|
||||||
|
|
||||||
|
//
|
||||||
|
log.info ("Set the log file format...");
|
||||||
|
|
||||||
|
|
||||||
|
// log = org.apache.log4j.Category.getInstance(Application.class.getName());
|
||||||
|
log.info ("... done.");
|
||||||
|
|
||||||
|
log.debug ("Exit");
|
||||||
|
log = org.apache.log4j.Logger.getLogger (Demo.class.getName ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static void main (String[] args)
|
||||||
|
{
|
||||||
|
System.out.println("Hello World!");
|
||||||
|
|
||||||
|
//test ();
|
||||||
|
|
||||||
|
//
|
||||||
|
IdsData datas;
|
||||||
|
IdData tag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String htmlSource;
|
||||||
|
StringBuffer html;
|
||||||
|
StringBuffer errorMessage;
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
tag = new IdData ();
|
||||||
|
tag.setContent ("Superman");
|
||||||
|
datas.put ("name", tag);
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
System.out.println ("tag = new IdData ();");
|
||||||
|
System.out.println ("tag.setContent (\"Superman\");");
|
||||||
|
System.out.println ("datas.put (\"name\", tag););");
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println ("<div id='name'>a name</div >");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
datas.setContent ("name", "Superman");
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
System.out.println ("datas.setContent (\"name\", \"Superman\");");
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println ("<div id='name'>a name</div >");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
tag = new IdData ();
|
||||||
|
tag.setContent ("Spiderman");
|
||||||
|
tag.getAttributes ().appendAttribute ("style", "background: blue;");
|
||||||
|
tag.getAttributes ().appendAttribute ("style", "foreground: red;");
|
||||||
|
tag.getAttributes ().setAttribute ("class", "nameClass");
|
||||||
|
datas.put ("lastname", tag);
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
System.out.println ("tag = new IdData ();");
|
||||||
|
System.out.println ("tag.getAttributes ().setAttribute (\"class\", \"lastnameClass\");");
|
||||||
|
System.out.println ("tag.getAttributes ().appendAttribute (\"style\", \"background: blue;\");");
|
||||||
|
System.out.println ("tag.getAttributes ().appendAttribute (\"style\", \"foreground: red;\");");
|
||||||
|
System.out.println ("tag.setContent (\"Spiderman\");");
|
||||||
|
System.out.println ("datas.put (\"lastname\", tag););");
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println ("<div id='lastname'>a last name</div>");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
datas.setContent ("lastname", "Spiderman");
|
||||||
|
datas.appendAttribute ("lastname", "style", "background: blue;");
|
||||||
|
datas.appendAttribute ("lastname", "style", "foreground: red;");
|
||||||
|
datas.setAttribute ("lastname", "class", "nameClass");
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
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 ("<div id='lastname'>a last name</div>");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
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 ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
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 ("<ul>");
|
||||||
|
System.out.println (" <li id='words'>a word</li>");
|
||||||
|
System.out.println ("</ul>");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
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 ("</table>");
|
||||||
|
htmlSource = source.toString ();
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
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 ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
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", IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
|
//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);
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new 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 ("datas = new IdsData ();");
|
||||||
|
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", IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
|
System.out.println ("ONLY_FIRST_ROW:");
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
datas.setIterationStrategy ("identity", IdsDataByIndex.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", IdsDataByIndex.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", IdsDataByIndex.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 IdsData ();
|
||||||
|
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 IdsData ();");
|
||||||
|
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);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
297
demo/Demo.java~
Normal file
297
demo/Demo.java~
Normal file
|
@ -0,0 +1,297 @@
|
||||||
|
package xid.test;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
import xid.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Test
|
||||||
|
{
|
||||||
|
static private org.apache.log4j.Logger log;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
// Initialize log.
|
||||||
|
org.apache.log4j.Logger log = null;
|
||||||
|
|
||||||
|
org.apache.log4j.BasicConfigurator.configure ();
|
||||||
|
|
||||||
|
|
||||||
|
log = org.apache.log4j.Logger.getRootLogger ();
|
||||||
|
//log.setLevel (org.apache.log4j.Level.INFO);
|
||||||
|
log.setLevel (org.apache.log4j.Level.INFO);
|
||||||
|
|
||||||
|
log.info ("Enter");
|
||||||
|
|
||||||
|
//
|
||||||
|
log.info ("Set the log file format...");
|
||||||
|
|
||||||
|
|
||||||
|
// log = org.apache.log4j.Category.getInstance(Application.class.getName());
|
||||||
|
log.info ("... done.");
|
||||||
|
|
||||||
|
log.debug ("Exit");
|
||||||
|
log = org.apache.log4j.Logger.getLogger (Test.class.getName ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
System.out.println("Hello World!");
|
||||||
|
|
||||||
|
//test ();
|
||||||
|
|
||||||
|
//
|
||||||
|
IdsData datas;
|
||||||
|
IdData tag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String htmlSource;
|
||||||
|
StringBuffer html;
|
||||||
|
StringBuffer errorMessage;
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
tag = new IdData ();
|
||||||
|
tag.setContent ("Superman");
|
||||||
|
datas.put ("name", tag);
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
System.out.println ("tag = new IdData ();");
|
||||||
|
System.out.println ("tag.setContent (\"Superman\");");
|
||||||
|
System.out.println ("datas.put (\"name\", tag););");
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println ("<div id='name'>a name</div >");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
datas.setContent ("name", "Superman");
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
System.out.println ("datas.setContent (\"name\", \"Superman\");");
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println ("<div id='name'>a name</div >");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
tag = new IdData ();
|
||||||
|
tag.setContent ("Spiderman");
|
||||||
|
tag.getAttributes ().appendAttribute ("style", "background: blue;");
|
||||||
|
tag.getAttributes ().appendAttribute ("style", "foreground: red;");
|
||||||
|
tag.getAttributes ().setAttribute ("class", "nameClass");
|
||||||
|
datas.put ("lastname", tag);
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
System.out.println ("tag = new IdData ();");
|
||||||
|
System.out.println ("tag.getAttributes ().setAttribute (\"class\", \"lastnameClass\");");
|
||||||
|
System.out.println ("tag.getAttributes ().appendAttribute (\"style\", \"background: blue;\");");
|
||||||
|
System.out.println ("tag.getAttributes ().appendAttribute (\"style\", \"foreground: red;\");");
|
||||||
|
System.out.println ("tag.setContent (\"Spiderman\");");
|
||||||
|
System.out.println ("datas.put (\"lastname\", tag););");
|
||||||
|
System.out.println ("+");
|
||||||
|
System.out.println ("<div id='lastname'>a last name</div>");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
datas.setContent ("lastname", "Spiderman");
|
||||||
|
datas.appendAttribute ("lastname", "style", "background: blue;");
|
||||||
|
datas.appendAttribute ("lastname", "style", "foreground: red;");
|
||||||
|
datas.setAttribute ("lastname", "class", "nameClass");
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new StringBuffer ();
|
||||||
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
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 ("<div id='lastname'>a last name</div>");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
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 ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
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 ("<ul>");
|
||||||
|
System.out.println (" <li id='words'>a word</li>");
|
||||||
|
System.out.println ("</ul>");
|
||||||
|
System.out.println ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
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 ("</table>");
|
||||||
|
htmlSource = source.toString ();
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
|
||||||
|
System.out.println ("datas = new IdsData ();");
|
||||||
|
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 ("=>");
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
|
||||||
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
|
datas = new IdsData ();
|
||||||
|
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", IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
|
//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);
|
||||||
|
|
||||||
|
|
||||||
|
errorMessage = new 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 ("datas = new IdsData ();");
|
||||||
|
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", IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
|
System.out.println ("ONLY_FIRST_ROW:");
|
||||||
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
System.out.println (html);
|
||||||
|
|
||||||
|
datas.setIterationStrategy ("identity", IdsDataByIndex.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", IdsDataByIndex.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", IdsDataByIndex.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 IdsData ();
|
||||||
|
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 IdsData ();");
|
||||||
|
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