Rename doXid method as dynamize.

This commit is contained in:
Christian P. MOMON 2013-06-23 01:51:00 +02:00
parent 9c8d7adbb6
commit bc9b2b5dd4
6 changed files with 49 additions and 49 deletions

View file

@ -45,7 +45,7 @@ class XidDemo
StringBuffer htmlTarget; StringBuffer htmlTarget;
try try
{ {
htmlTarget = StringPresenter.doXid(htmlSource, datas); htmlTarget = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -75,7 +75,7 @@ class XidDemo
StringBuffer htmlTarget; StringBuffer htmlTarget;
try try
{ {
htmlTarget = StringPresenter.doXid(htmlSource, datas); htmlTarget = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -111,7 +111,7 @@ class XidDemo
StringBuffer htmlTarget; StringBuffer htmlTarget;
try try
{ {
htmlTarget = StringPresenter.doXid(htmlSource, datas); htmlTarget = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -156,7 +156,7 @@ class XidDemo
StringBuffer htmlTarget; StringBuffer htmlTarget;
try try
{ {
htmlTarget = StringPresenter.doXid(htmlSource, datas); htmlTarget = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -225,7 +225,7 @@ class XidDemo
StringBuffer html; StringBuffer html;
try try
{ {
html = StringPresenter.doXid(htmlSource, datas); html = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -240,7 +240,7 @@ class XidDemo
System.out.println("ONLY_FIRST_TWO_ROWS:"); System.out.println("ONLY_FIRST_TWO_ROWS:");
try try
{ {
html = StringPresenter.doXid(htmlSource, datas); html = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -255,7 +255,7 @@ class XidDemo
System.out.println("ONLY_ROWS_WITH_ID:"); System.out.println("ONLY_ROWS_WITH_ID:");
try try
{ {
html = StringPresenter.doXid(htmlSource, datas); html = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -270,7 +270,7 @@ class XidDemo
System.out.println("ONLY_ROWS_WITHOUT_ID:"); System.out.println("ONLY_ROWS_WITHOUT_ID:");
try try
{ {
html = StringPresenter.doXid(htmlSource, datas); html = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -285,7 +285,7 @@ class XidDemo
System.out.println("ALL_ROWS:"); System.out.println("ALL_ROWS:");
try try
{ {
html = StringPresenter.doXid(htmlSource, datas); html = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {

View file

@ -46,15 +46,7 @@ public class DomPresenter extends Presenter
/** /**
* *
*/ */
public StringBuffer doXid(final Data datas) throws Exception public StringBuffer dynamize(final IdsDataById datas) throws Exception
{
return (doXid(datas.getIdsDataById()));
}
/**
*
*/
public StringBuffer doXid(final IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
@ -69,7 +61,7 @@ public class DomPresenter extends Presenter
{ {
// Build the web page. // Build the web page.
StringWriter htmlCode = new StringWriter(); StringWriter htmlCode = new StringWriter();
Presenter.doXid(htmlCode, this.doc, datas); Presenter.dynamize(htmlCode, this.doc, datas);
result = new StringBuffer(htmlCode.toString()); result = new StringBuffer(htmlCode.toString());
} }
@ -77,6 +69,14 @@ public class DomPresenter extends Presenter
return (result); return (result);
} }
/**
*
*/
public StringBuffer dynamize(final Data datas) throws Exception
{
return (dynamize(datas.getIdsDataById()));
}
/** /**
* *
*/ */
@ -110,7 +110,7 @@ public class DomPresenter extends Presenter
/** /**
* Xid a file with data. * Xid a file with data.
*/ */
static public StringBuffer doXid(final Document doc, final IdsDataById datas) throws Exception static public StringBuffer dynamize(final Document doc, final IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;

View file

@ -42,20 +42,20 @@ public class FilePresenter extends DomPresenter
* *
*/ */
@Override @Override
public StringBuffer doXid(final Data datas) throws Exception public StringBuffer dynamize(final Data datas) throws Exception
{ {
return (doXid(datas.getIdsDataById())); return (dynamize(datas.getIdsDataById()));
} }
/** /**
* No need to be synchronized. * No need to be synchronized.
*/ */
@Override @Override
public StringBuffer doXid(final IdsDataById datas) throws Exception public StringBuffer dynamize(final IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
logger.info("doXid for file [" + this.sourceFilePathname + "]"); logger.info("dynamize file [" + this.sourceFilePathname + "]");
// Get the good tree. // Get the good tree.
File source = new File(this.sourceFilePathname); File source = new File(this.sourceFilePathname);
@ -83,7 +83,7 @@ public class FilePresenter extends DomPresenter
htmlCode.write(doctype); htmlCode.write(doctype);
htmlCode.write('\n'); htmlCode.write('\n');
Presenter.doXid(htmlCode, doc, datas); Presenter.dynamize(htmlCode, doc, datas);
result = htmlCode.getBuffer(); result = htmlCode.getBuffer();
// //
@ -116,30 +116,30 @@ public class FilePresenter extends DomPresenter
} }
/** /**
* Xid a file without data. * Dynamize a file without data.
*/ */
static public StringBuffer doXid(final String filePathname) throws Exception static public StringBuffer dynamize(final String filePathname) throws Exception
{ {
StringBuffer result; StringBuffer result;
FilePresenter presenter = new FilePresenter(filePathname); FilePresenter presenter = new FilePresenter(filePathname);
result = presenter.doXid((Data) null); result = presenter.dynamize((Data) null);
// //
return (result); return (result);
} }
/** /**
* Xid a file. * Dynamize a file.
*/ */
static public StringBuffer doXid(final String filePathname, final Data datas) throws Exception static public StringBuffer dynamize(final String filePathname, final Data datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
FilePresenter presenter = new FilePresenter(filePathname); FilePresenter presenter = new FilePresenter(filePathname);
result = presenter.doXid(datas); result = presenter.dynamize(datas);
// //
return (result); return (result);

View file

@ -137,7 +137,7 @@ public class Presenter
/** /**
* Xid a file with data. * Xid a file with data.
*/ */
static public void doXid(final Writer result, final Document doc, final IdsDataById datas) throws Exception static public void dynamize(final Writer result, final Document doc, final IdsDataById datas) throws Exception
{ {
Presenter.process(result, doc, datas); Presenter.process(result, doc, datas);
} }

View file

@ -39,16 +39,16 @@ public class StringPresenter extends DomPresenter
* *
*/ */
@Override @Override
public StringBuffer doXid(final Data datas) throws Exception public StringBuffer dynamize(final Data datas) throws Exception
{ {
return (doXid(datas.getIdsDataById())); return (dynamize(datas.getIdsDataById()));
} }
/** /**
* *
*/ */
@Override @Override
public StringBuffer doXid(final IdsDataById datas) throws Exception public StringBuffer dynamize(final IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
@ -76,7 +76,7 @@ public class StringPresenter extends DomPresenter
{ {
htmlCode.write(this.html.substring(0, this.html.indexOf('>'))); htmlCode.write(this.html.substring(0, this.html.indexOf('>')));
} }
Presenter.doXid(htmlCode, doc, datas); Presenter.dynamize(htmlCode, doc, datas);
StringBuffer htmlTarget = htmlCode.getBuffer(); StringBuffer htmlTarget = htmlCode.getBuffer();
if (htmlTarget == null) if (htmlTarget == null)
@ -131,21 +131,21 @@ public class StringPresenter extends DomPresenter
/** /**
* *
*/ */
static public StringBuffer doXid(final String html, final Data datas) throws Exception static public StringBuffer dynamize(final String html, final Data datas) throws Exception
{ {
return (doXid(html, datas.getIdsDataById())); return (dynamize(html, datas.getIdsDataById()));
} }
/** /**
* Xid a string with html in. * Xid a string with html in.
*/ */
static public StringBuffer doXid(final String html, final IdsDataById datas) throws Exception static public StringBuffer dynamize(final String html, final IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
StringPresenter presenter = new StringPresenter(html); StringPresenter presenter = new StringPresenter(html);
result = presenter.doXid(datas); result = presenter.dynamize(datas);
// //
return (result); return (result);

View file

@ -66,7 +66,7 @@ class XidTest
datas.setContent("name", "Superman"); datas.setContent("name", "Superman");
try try
{ {
html = StringPresenter.doXid("<div id='name'>a name</div >", datas); html = StringPresenter.dynamize("<div id='name'>a name</div >", datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -86,7 +86,7 @@ class XidTest
try try
{ {
html = StringPresenter.doXid("<div id='lastname'>a last name</div >", datas); html = StringPresenter.dynamize("<div id='lastname'>a last name</div >", datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -107,7 +107,7 @@ class XidTest
try try
{ {
html = StringPresenter.doXid("<ul>\n <li id='words'>a word</li>\n</ul>", datas); html = StringPresenter.dynamize("<ul>\n <li id='words'>a word</li>\n</ul>", datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -139,7 +139,7 @@ class XidTest
htmlSource = source.toString(); htmlSource = source.toString();
try try
{ {
html = StringPresenter.doXid(htmlSource, datas); html = StringPresenter.dynamize(htmlSource, datas);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -197,22 +197,22 @@ class XidTest
* *
* datas.setIterationStrategy ("identity", * datas.setIterationStrategy ("identity",
* IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW); System.out.println * IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW); System.out.println
* ("ONLY_FIRST_ROW:"); html = Presenter.doXid (htmlSource, datas, "", * ("ONLY_FIRST_ROW:"); html = Presenter.dynamize (htmlSource, datas, "",
* errorMessage); System.out.println (html); * errorMessage); System.out.println (html);
* *
* datas.setIterationStrategy ("identity", * datas.setIterationStrategy ("identity",
* IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID); * IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
* System.out.println ("ONLY_ROWS_WITH_ID:"); html = Presenter.doXid * System.out.println ("ONLY_ROWS_WITH_ID:"); html = Presenter.dynamize
* (htmlSource, datas, "", errorMessage); System.out.println (html); * (htmlSource, datas, "", errorMessage); System.out.println (html);
* *
* datas.setIterationStrategy ("identity", * datas.setIterationStrategy ("identity",
* IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID); * IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
* System.out.println ("ONLY_ROWS_WITHOUT_ID:"); html = Presenter.doXid * System.out.println ("ONLY_ROWS_WITHOUT_ID:"); html = Presenter.dynamize
* (htmlSource, datas, "", errorMessage); System.out.println (html); * (htmlSource, datas, "", errorMessage); System.out.println (html);
* *
* datas.setIterationStrategy ("identity", * datas.setIterationStrategy ("identity",
* IdsDataByIndex.IterationStrategy.ALL_ROWS); System.out.println * IdsDataByIndex.IterationStrategy.ALL_ROWS); System.out.println
* ("ALL_ROWS:"); html = Presenter.doXid (htmlSource, datas, "", * ("ALL_ROWS:"); html = Presenter.dynamize (htmlSource, datas, "",
* errorMessage); System.out.println (html); * errorMessage); System.out.println (html);
* *
* *
@ -227,7 +227,7 @@ class XidTest
* source.append ("<div>\n"); source.append (" <h1>one</h1>\n"); * source.append ("<div>\n"); source.append (" <h1>one</h1>\n");
* source.append ("</div>\n"); source.append ("<div id=\"number\">\n"); * source.append ("</div>\n"); source.append ("<div id=\"number\">\n");
* source.append (" <h1>three</h1>\n"); source.append ("</div>"); * source.append (" <h1>three</h1>\n"); source.append ("</div>");
* htmlSource = source.toString (); html = Presenter.doXid (htmlSource, * htmlSource = source.toString (); html = Presenter.dynamize (htmlSource,
* datas, "", errorMessage); * datas, "", errorMessage);
* *
* System.out.println (htmlSource); System.out.println ("+"); * System.out.println (htmlSource); System.out.println ("+");