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); } /** * */ public static void main (String[] args) { System.out.println("Hello World!"); //test (); // Data datas; IdData tag; String htmlSource; StringBuffer html; StringBuffer errorMessage; // Populate attributes of Test 03. System.out.println ("----------------------------"); datas = new Data (); datas.setContent ("name", "Superman"); errorMessage = new StringBuffer (); html = StringPresenter.doXid ("
a name
", datas, errorMessage); System.out.println ("datas = new Data ();"); System.out.println ("datas.setContent (\"name\", \"Superman\");"); System.out.println ("+"); System.out.println ("
a name
"); System.out.println ("=>"); System.out.println (html); // Populate attributes of Test 03. System.out.println ("----------------------------"); datas = new Data (); 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 = StringPresenter.doXid ("
a last name
", datas, errorMessage); System.out.println ("datas = new Data ();"); 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 ("
a last name
"); System.out.println ("=>"); System.out.println (html); // Populate attributes of Test 03. System.out.println ("----------------------------"); datas = new Data (); 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 = StringPresenter.doXid ("", datas, errorMessage); System.out.println ("datas = new Data ();"); 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); // Populate attributes of Test 03. System.out.println ("----------------------------"); datas = new Data (); datas.setContent ("identity", 0, "last_name", "Jemba"); datas.setContent ("identity", 0, "first_name", "Epo"); datas.setContent ("identity", 1, "last_name", "Momon"); datas.setContent ("identity", 1, "first_name", "Christian"); datas.setContent ("identity", 2, "last_name", "Tronche"); datas.setContent ("identity", 2, "first_name", "Christophe"); errorMessage = new StringBuffer (); StringBuffer source = new StringBuffer (); source.append ("\n"); source.append (" \n"); source.append ("
noidJeanReve
"); htmlSource = source.toString (); html = StringPresenter.doXid (htmlSource, datas, errorMessage); System.out.println ("datas = new Data ();"); System.out.println ("datas.setContent (\"identity\", 0, \"last_name\", \"Jemba\");"); System.out.println ("datas.setContent (\"identity\", 0, \"first_name\", \"Epo\");"); System.out.println ("datas.setContent (\"identity\", 1, \"last_name\", \"Momon\");"); System.out.println ("datas.setContent (\"identity\", 1, \"first_name\", \"Christian\");"); System.out.println ("datas.setContent (\"identity\", 2, \"last_name\", \"Tronche\");"); System.out.println ("datas.setContent (\"identity\", 2, \"first_name\", \"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 Data (); datas.setContent ("identity", 0, "last_name", "Jemba"); datas.setContent ("identity", 0, "first_name", "Epo"); datas.setContent ("identity", 1, "last_name", "Momon"); datas.setContent ("identity", 1, "first_name", "Christian"); datas.setContent ("identity", 2, "last_name", "Tronche"); datas.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); errorMessage = new StringBuffer (); source = new StringBuffer (); source.append ("\n"); source.append (" \n"); source.append (" \n"); source.append (" \n"); source.append (" \n"); source.append ("
noidFirst NameLast Name
noidJeanReve
noida first namea last name
noida first name morea last name more
\n"); htmlSource = source.toString (); 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 ("+"); System.out.println (htmlSource); System.out.println ("=>"); datas.setIterationStrategy ("identities", IdData.IterationStrategy.ONLY_FIRST_ROW); System.out.println ("ONLY_FIRST_ROW:"); html = StringPresenter.doXid (htmlSource, datas, errorMessage); System.out.println (html); System.out.println (""); datas.setIterationStrategy ("identities", IdData.IterationStrategy.ONLY_FIRST_TWO_ROWS); System.out.println ("ONLY_FIRST_TWO_ROWS:"); html = StringPresenter.doXid (htmlSource, datas, errorMessage); System.out.println (html); System.out.println (""); datas.setIterationStrategy ("identities", IdData.IterationStrategy.ONLY_ROWS_WITH_ID); System.out.println ("ONLY_ROWS_WITH_ID:"); html = StringPresenter.doXid (htmlSource, datas, errorMessage); System.out.println (html); System.out.println (""); datas.setIterationStrategy ("identities", IdData.IterationStrategy.ONLY_ROWS_WITHOUT_ID); System.out.println ("ONLY_ROWS_WITHOUT_ID:"); html = StringPresenter.doXid (htmlSource, datas, errorMessage); System.out.println (html); System.out.println (""); datas.setIterationStrategy ("identities", IdData.IterationStrategy.ALL_ROWS); System.out.println ("ALL_ROWS:"); html = StringPresenter.doXid (htmlSource, datas, errorMessage); System.out.println (html); // Populate attributes of Test 03. System.out.println ("----------------------------"); datas = new Data (); datas.setAttribute ("
", "class", "aDivClass"); datas.setAttribute ("
", "style", "background-color: #000000;"); datas.setAttribute ("number", "style", "background-color: #0000FF;"); errorMessage = new StringBuffer (); source = new StringBuffer (); source.append ("
\n"); source.append ("

one

\n"); source.append ("
\n"); source.append ("
\n"); source.append ("

three

\n"); source.append ("
"); htmlSource = source.toString (); html = StringPresenter.doXid (htmlSource, datas, errorMessage); System.out.println (htmlSource); System.out.println ("+"); System.out.println ("datas = new Data ();"); System.out.println ("datas.setAttribute (\"
\", \"class\", \"aDivClass\");"); System.out.println ("datas.setAttribute (\"
\", \"style\", \"background-color: #000000;\");"); System.out.println ("datas.setAttribute (\"number\", \"style\", \"background-color: #0000FF;\");"); System.out.println ("=>"); System.out.println (html); } }