Made a code review.
This commit is contained in:
parent
a6c5afe319
commit
0e4c3e4052
10 changed files with 41 additions and 41 deletions
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -33,7 +33,7 @@ import fr.devinsy.xidyn.utils.XidynUtils;
|
||||||
*/
|
*/
|
||||||
public class DomPresenter implements Presenter
|
public class DomPresenter implements Presenter
|
||||||
{
|
{
|
||||||
static private final Logger logger = LoggerFactory.getLogger(DomPresenter.class);
|
private static Logger logger = LoggerFactory.getLogger(DomPresenter.class);
|
||||||
private Document dom;
|
private Document dom;
|
||||||
private boolean isOutdated;
|
private boolean isOutdated;
|
||||||
private StringBuffer defaultHtmlTarget;
|
private StringBuffer defaultHtmlTarget;
|
||||||
|
@ -231,5 +231,4 @@ public class DomPresenter implements Presenter
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -46,13 +46,14 @@ import fr.devinsy.xidyn.utils.XidynUtils;
|
||||||
*/
|
*/
|
||||||
public class DomPresenterCore
|
public class DomPresenterCore
|
||||||
{
|
{
|
||||||
static final public char INDEX_SEPARATOR = '_';
|
private static Logger logger = LoggerFactory.getLogger(DomPresenterCore.class);
|
||||||
static private Logger logger = LoggerFactory.getLogger(DomPresenterCore.class);
|
|
||||||
|
public static final char INDEX_SEPARATOR = '_';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamize a doc with data.
|
* Dynamize a doc with data.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer dynamize(final Document doc, final TagDataListById data) throws Exception
|
public static StringBuffer dynamize(final Document doc, final TagDataListById data) throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
* Dynamize a doc with data.
|
* Dynamize a doc with data.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer dynamize(final Document doc, final TagDataManager data) throws Exception
|
public static StringBuffer dynamize(final Document doc, final TagDataManager data) throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
* Dynamize a doc with data.
|
* Dynamize a doc with data.
|
||||||
*/
|
*/
|
||||||
static public void dynamize(final Writer result, final Document doc, final TagDataListById data) throws Exception
|
public static void dynamize(final Writer result, final Document doc, final TagDataListById data) throws Exception
|
||||||
{
|
{
|
||||||
process(result, doc, data);
|
process(result, doc, data);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +89,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
* Dynamize a doc with data.
|
* Dynamize a doc with data.
|
||||||
*/
|
*/
|
||||||
static public void dynamize(final Writer result, final Document doc, final TagDataManager data) throws Exception
|
public static void dynamize(final Writer result, final Document doc, final TagDataManager data) throws Exception
|
||||||
{
|
{
|
||||||
dynamize(result, doc, data.getIdsDataById());
|
dynamize(result, doc, data.getIdsDataById());
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,7 @@ public class DomPresenterCore
|
||||||
*
|
*
|
||||||
* @param node
|
* @param node
|
||||||
*/
|
*/
|
||||||
static private String getElementText(final Node node)
|
private static String getElementText(final Node node)
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static private TagAttributes mergeAttributes(final TagAttributes target, final TagAttributes source)
|
private static TagAttributes mergeAttributes(final TagAttributes target, final TagAttributes source)
|
||||||
{
|
{
|
||||||
TagAttributes result;
|
TagAttributes result;
|
||||||
|
|
||||||
|
@ -226,7 +227,7 @@ public class DomPresenterCore
|
||||||
* String
|
* String
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
static private String newLinesToSpaces(final String text)
|
private static String newLinesToSpaces(final String text)
|
||||||
{
|
{
|
||||||
StringBuffer result = new StringBuffer(text);
|
StringBuffer result = new StringBuffer(text);
|
||||||
|
|
||||||
|
@ -254,7 +255,7 @@ public class DomPresenterCore
|
||||||
* Recursive method that processes a node and any child nodes.
|
* Recursive method that processes a node and any child nodes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static private void process(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception
|
private static void process(final Writer 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";
|
||||||
|
@ -375,7 +376,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static private StringBuffer processAttributes(final NamedNodeMap attrs)
|
private static StringBuffer processAttributes(final NamedNodeMap attrs)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -388,7 +389,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static private StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes)
|
private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -401,7 +402,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static private StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final String suffix)
|
private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final String suffix)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -466,7 +467,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static private StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final TagAttributes namedDataAttributes, final String suffix)
|
private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final TagAttributes namedDataAttributes, final String suffix)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -479,7 +480,7 @@ public class DomPresenterCore
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static private void processChildren(final Writer result, final Node node, final TagDataListById datas) throws Exception
|
private static void processChildren(final Writer result, final Node node, final TagDataListById datas) throws Exception
|
||||||
{
|
{
|
||||||
processChildren(result, node, datas, "");
|
processChildren(result, node, datas, "");
|
||||||
}
|
}
|
||||||
|
@ -669,7 +670,7 @@ public class DomPresenterCore
|
||||||
* @param idAttr
|
* @param idAttr
|
||||||
* The ID.
|
* The ID.
|
||||||
*/
|
*/
|
||||||
static private void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagDataListById datas) throws Exception
|
private static void processElementWithId(final Writer 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, "");
|
||||||
|
@ -686,7 +687,7 @@ public class DomPresenterCore
|
||||||
* @param idAttr
|
* @param idAttr
|
||||||
* The ID.
|
* The ID.
|
||||||
*/
|
*/
|
||||||
static private 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 Writer 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();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -33,7 +33,7 @@ import fr.devinsy.xidyn.utils.XidynUtils;
|
||||||
*/
|
*/
|
||||||
public class FilePresenter extends StringPresenter
|
public class FilePresenter extends StringPresenter
|
||||||
{
|
{
|
||||||
static Logger logger = LoggerFactory.getLogger(FilePresenter.class);
|
private static Logger logger = LoggerFactory.getLogger(FilePresenter.class);
|
||||||
|
|
||||||
private File source;
|
private File source;
|
||||||
private String sourceFilePathname;
|
private String sourceFilePathname;
|
||||||
|
@ -266,7 +266,7 @@ public class FilePresenter extends StringPresenter
|
||||||
/**
|
/**
|
||||||
* Dynamize a file without data.
|
* Dynamize a file without data.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer dynamize(final String filePathname) throws Exception
|
public static StringBuffer dynamize(final String filePathname) throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ public class FilePresenter extends StringPresenter
|
||||||
/**
|
/**
|
||||||
* Dynamize a file.
|
* Dynamize a file.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer dynamize(final String filePathname, final TagDataManager datas) throws Exception
|
public static StringBuffer dynamize(final String filePathname, final TagDataManager datas) throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||||
public class FilePresenters extends Vector<FilePresenter>
|
public class FilePresenters extends Vector<FilePresenter>
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 7058868685681354293L;
|
private static final long serialVersionUID = 7058868685681354293L;
|
||||||
static private Logger logger = LoggerFactory.getLogger(FilePresenters.class);
|
private static Logger logger = LoggerFactory.getLogger(FilePresenters.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class FilePresentersProxy
|
public class FilePresentersProxy
|
||||||
{
|
{
|
||||||
static private Logger logger = LoggerFactory.getLogger(FilePresentersProxy.class);
|
private static Logger logger = LoggerFactory.getLogger(FilePresentersProxy.class);
|
||||||
|
|
||||||
private static FilePresentersProxy instance = null;
|
private static FilePresentersProxy instance = null;
|
||||||
private FilePresenters presenters = null;
|
private FilePresenters presenters = null;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -29,6 +29,7 @@ import fr.devinsy.xidyn.data.TagDataManager;
|
||||||
public class GenericPresenter implements Presenter
|
public class GenericPresenter implements Presenter
|
||||||
{
|
{
|
||||||
private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(GenericPresenter.class);
|
private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(GenericPresenter.class);
|
||||||
|
|
||||||
private Presenter presenter;
|
private Presenter presenter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -30,7 +30,6 @@ import fr.devinsy.xidyn.data.TagDataManager;
|
||||||
*/
|
*/
|
||||||
public interface Presenter
|
public interface Presenter
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param datas
|
* @param datas
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class PresenterFactory
|
public class PresenterFactory
|
||||||
{
|
{
|
||||||
static private Logger logger = LoggerFactory.getLogger(PresenterFactory.class);
|
private static Logger logger = LoggerFactory.getLogger(PresenterFactory.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -32,7 +32,7 @@ import fr.devinsy.xidyn.utils.XidynUtils;
|
||||||
*/
|
*/
|
||||||
public class StringPresenter implements Presenter
|
public class StringPresenter implements Presenter
|
||||||
{
|
{
|
||||||
static private Logger logger = LoggerFactory.getLogger(StringPresenter.class);
|
private static Logger logger = LoggerFactory.getLogger(StringPresenter.class);
|
||||||
|
|
||||||
private String source;
|
private String source;
|
||||||
private String doctype;
|
private String doctype;
|
||||||
|
@ -236,7 +236,7 @@ public class StringPresenter implements Presenter
|
||||||
/**
|
/**
|
||||||
* Dynamize a string with HTML in.
|
* Dynamize a string with HTML in.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer dynamize(final String html, final TagDataManager datas) throws Exception
|
public static StringBuffer dynamize(final String html, final TagDataManager datas) throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2016 Christian Pierre MOMON
|
||||||
*
|
*
|
||||||
* This file is part of Xidyn.
|
* This file is part of Xidyn.
|
||||||
*
|
*
|
||||||
|
@ -33,7 +33,7 @@ import fr.devinsy.xidyn.utils.XidynUtils;
|
||||||
*/
|
*/
|
||||||
public class URLPresenter extends StringPresenter
|
public class URLPresenter extends StringPresenter
|
||||||
{
|
{
|
||||||
static private Logger logger = LoggerFactory.getLogger(URLPresenter.class);
|
private static Logger logger = LoggerFactory.getLogger(URLPresenter.class);
|
||||||
|
|
||||||
private String sourcePathname;
|
private String sourcePathname;
|
||||||
private URL source;
|
private URL source;
|
||||||
|
@ -354,7 +354,7 @@ public class URLPresenter extends StringPresenter
|
||||||
/**
|
/**
|
||||||
* Dynamize a file without data.
|
* Dynamize a file without data.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer dynamize(final String filePathname) throws Exception
|
public static StringBuffer dynamize(final String filePathname) throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ public class URLPresenter extends StringPresenter
|
||||||
/**
|
/**
|
||||||
* Dynamize a file.
|
* Dynamize a file.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer dynamize(final String filePathname, final TagDataManager datas) throws Exception
|
public static StringBuffer dynamize(final String filePathname, final TagDataManager datas) throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue