Used Appendable parameter.

This commit is contained in:
Christian P. MOMON 2018-03-05 15:54:44 +01:00
parent 399b5eb971
commit 204fd284b0

View file

@ -19,7 +19,6 @@
package fr.devinsy.xidyn.presenters; package fr.devinsy.xidyn.presenters;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -51,6 +50,40 @@ public class DomPresenterCore
public static final char INDEX_SEPARATOR = '_'; public static final char INDEX_SEPARATOR = '_';
public static final String NODISPLAY_CLASS = "xid:nodisplay"; public static final String NODISPLAY_CLASS = "xid:nodisplay";
/**
* Dynamize a doc with data.
*
* @param result
* the result
* @param doc
* the doc
* @param data
* the data
* @throws Exception
* the exception
*/
public static void dynamize(final Appendable result, final Document doc, final TagDataListById data) throws Exception
{
process(result, doc, data);
}
/**
* Dynamize a doc with data.
*
* @param result
* the result
* @param doc
* the doc
* @param data
* the data
* @throws Exception
* the exception
*/
public static void dynamize(final Appendable result, final Document doc, final TagDataManager data) throws Exception
{
dynamize(result, doc, data.getIdsDataById());
}
/** /**
* Dynamize a doc with data. * Dynamize a doc with data.
* *
@ -95,40 +128,6 @@ public class DomPresenterCore
return result; return result;
} }
/**
* Dynamize a doc with data.
*
* @param result
* the result
* @param doc
* the doc
* @param data
* the data
* @throws Exception
* the exception
*/
public static void dynamize(final Writer result, final Document doc, final TagDataListById data) throws Exception
{
process(result, doc, data);
}
/**
* Dynamize a doc with data.
*
* @param result
* the result
* @param doc
* the doc
* @param data
* the data
* @throws Exception
* the exception
*/
public static void dynamize(final Writer result, final Document doc, final TagDataManager data) throws Exception
{
dynamize(result, doc, data.getIdsDataById());
}
/** /**
* Gets the class attribute value. * Gets the class attribute value.
* *
@ -302,7 +301,7 @@ public class DomPresenterCore
* @throws Exception * @throws Exception
* the exception * the exception
*/ */
private static void process(final Writer result, final Node node, final TagDataListById data) throws Exception private static void process(final Appendable result, final Node node, final TagDataListById data) throws Exception
{ {
process(result, node, data, ""); process(result, node, data, "");
} }
@ -321,7 +320,7 @@ public class DomPresenterCore
* @throws Exception * @throws Exception
* the exception * the exception
*/ */
private static void process(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception private static void process(final Appendable result, final Node node, final TagDataListById datas, final String suffix) throws Exception
{ {
logger.debug("process - started"); logger.debug("process - started");
String TRANSITIONAL_DTD = "xhtml1-transitional.dtd"; String TRANSITIONAL_DTD = "xhtml1-transitional.dtd";
@ -583,7 +582,7 @@ public class DomPresenterCore
* @throws Exception * @throws Exception
* the exception * the exception
*/ */
private static void processChildren(final Writer result, final Node node, final TagDataListById datas) throws Exception private static void processChildren(final Appendable result, final Node node, final TagDataListById datas) throws Exception
{ {
processChildren(result, node, datas, ""); processChildren(result, node, datas, "");
} }
@ -602,7 +601,7 @@ public class DomPresenterCore
* @throws Exception * @throws Exception
* the exception * the exception
*/ */
private static void processChildren(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception private static void processChildren(final Appendable result, final Node node, final TagDataListById datas, final String suffix) throws Exception
{ {
// Get the iteration strategy. // Get the iteration strategy.
SimpleTagData.IterationStrategy strategy; SimpleTagData.IterationStrategy strategy;
@ -742,7 +741,7 @@ public class DomPresenterCore
* @throws Exception * @throws Exception
* the exception * the exception
*/ */
private static void processElementBasically(final Writer result, final Node node, final TagDataListById datas) throws Exception private static void processElementBasically(final Appendable result, final Node node, final TagDataListById datas) throws Exception
{ {
processElementBasically(result, node, datas, ""); processElementBasically(result, node, datas, "");
} }
@ -761,7 +760,7 @@ public class DomPresenterCore
* @throws Exception * @throws Exception
* the exception * the exception
*/ */
private static void processElementBasically(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception private static void processElementBasically(final Appendable result, final Node node, final TagDataListById datas, final String suffix) throws Exception
{ {
logger.debug("processElementBasically - started [{}]", node.getNodeName()); logger.debug("processElementBasically - started [{}]", node.getNodeName());
@ -810,8 +809,7 @@ public class DomPresenterCore
* @throws Exception * @throws Exception
* the exception * the exception
*/ */
private static void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagDataListById datas) throws Exception private static void processElementWithId(final Appendable result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagDataListById datas) throws Exception
{ {
processElementWithId(result, node, attrs, idAttr, datas, ""); processElementWithId(result, node, attrs, idAttr, datas, "");
} }
@ -835,7 +833,7 @@ public class DomPresenterCore
* @throws Exception * @throws Exception
* the exception * the exception
*/ */
private static void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagDataListById datas, final String suffix) throws Exception private static void processElementWithId(final Appendable result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagDataListById datas, final String suffix) throws Exception
{ {
String tag = node.getNodeName(); String tag = node.getNodeName();