\n");
+ String 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("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("=>");
+ System.out.println("+");
+ System.out.println(htmlSource);
+ System.out.println("=>");
- // #05.1
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_FIRST_ROW);
- System.out.println("ONLY_FIRST_ROW:");
- StringBuffer html;
- try
- {
- html = StringPresenter.dynamize(htmlSource, data);
- }
- catch (Exception exception)
- {
- System.out.println(exception.getMessage());
- html = null;
- }
- System.out.println(html);
- System.out.println("");
+ // #05.1
+ data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_FIRST_ROW);
+ System.out.println("ONLY_FIRST_ROW:");
+ StringBuffer html;
+ try
+ {
+ html = PresenterUtils.dynamize(htmlSource, data);
+ }
+ catch (Exception exception)
+ {
+ System.out.println(exception.getMessage());
+ html = null;
+ }
+ System.out.println(html);
+ System.out.println("");
- // #05.2
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_FIRST_TWO_ROWS);
- System.out.println("ONLY_FIRST_TWO_ROWS:");
- try
- {
- html = StringPresenter.dynamize(htmlSource, data);
- }
- catch (Exception exception)
- {
- System.out.println(exception.getMessage());
- html = null;
- }
- System.out.println(html);
- System.out.println("");
+ // #05.2
+ data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_FIRST_TWO_ROWS);
+ System.out.println("ONLY_FIRST_TWO_ROWS:");
+ try
+ {
+ html = PresenterUtils.dynamize(htmlSource, data);
+ }
+ catch (Exception exception)
+ {
+ System.out.println(exception.getMessage());
+ html = null;
+ }
+ System.out.println(html);
+ System.out.println("");
- // #05.3
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_ROWS_WITH_ID);
- System.out.println("ONLY_ROWS_WITH_ID:");
- try
- {
- html = StringPresenter.dynamize(htmlSource, data);
- }
- catch (Exception exception)
- {
- System.out.println(exception.getMessage());
- html = null;
- }
- System.out.println(html);
- System.out.println("");
+ // #05.3
+ data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_ROWS_WITH_ID);
+ System.out.println("ONLY_ROWS_WITH_ID:");
+ try
+ {
+ html = PresenterUtils.dynamize(htmlSource, data);
+ }
+ catch (Exception exception)
+ {
+ System.out.println(exception.getMessage());
+ html = null;
+ }
+ System.out.println(html);
+ System.out.println("");
- // #05.4
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
- System.out.println("ONLY_ROWS_WITHOUT_ID:");
- try
- {
- html = StringPresenter.dynamize(htmlSource, data);
- }
- catch (Exception exception)
- {
- System.out.println(exception.getMessage());
- html = null;
- }
- System.out.println(html);
- System.out.println("");
+ // #05.4
+ data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
+ System.out.println("ONLY_ROWS_WITHOUT_ID:");
+ try
+ {
+ html = PresenterUtils.dynamize(htmlSource, data);
+ }
+ catch (Exception exception)
+ {
+ System.out.println(exception.getMessage());
+ html = null;
+ }
+ System.out.println(html);
+ System.out.println("");
- // #05.5
- data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ALL_ROWS);
- System.out.println("ALL_ROWS:");
- try
- {
- html = StringPresenter.dynamize(htmlSource, data);
- }
- catch (Exception exception)
- {
- System.out.println(exception.getMessage());
- html = null;
- }
- System.out.println(html);
- }
- }
+ // #05.5
+ data.setIterationStrategy("identities", SimpleTagData.IterationStrategy.ALL_ROWS);
+ System.out.println("ALL_ROWS:");
+ try
+ {
+ html = PresenterUtils.dynamize(htmlSource, data);
+ }
+ catch (Exception exception)
+ {
+ System.out.println(exception.getMessage());
+ html = null;
+ }
+ System.out.println(html);
+ }
+ }
}
diff --git a/src/fr/devinsy/xidyn/XidynException.java b/src/fr/devinsy/xidyn/XidynException.java
index e3a0be2..ed70d60 100644
--- a/src/fr/devinsy/xidyn/XidynException.java
+++ b/src/fr/devinsy/xidyn/XidynException.java
@@ -24,41 +24,41 @@ package fr.devinsy.xidyn;
*/
public class XidynException extends Exception
{
- private static final long serialVersionUID = 8498031594322380559L;
+ private static final long serialVersionUID = 8498031594322380559L;
- /**
+ /**
*
*/
- public XidynException()
- {
- super();
- }
+ public XidynException()
+ {
+ super();
+ }
- /**
- *
- * @param message
- */
- public XidynException(final String message)
- {
- super(message);
- }
+ /**
+ *
+ * @param message
+ */
+ public XidynException(final String message)
+ {
+ super(message);
+ }
- /**
- *
- * @param message
- * @param cause
- */
- public XidynException(final String message, final Throwable cause)
- {
- super(message, cause);
- }
+ /**
+ *
+ * @param message
+ * @param cause
+ */
+ public XidynException(final String message, final Throwable cause)
+ {
+ super(message, cause);
+ }
- /**
- *
- * @param cause
- */
- public XidynException(final Throwable cause)
- {
- super(cause);
- }
+ /**
+ *
+ * @param cause
+ */
+ public XidynException(final Throwable cause)
+ {
+ super(cause);
+ }
}
diff --git a/src/fr/devinsy/xidyn/data/SimpleTagData.java b/src/fr/devinsy/xidyn/data/SimpleTagData.java
index 8719232..aa8566c 100644
--- a/src/fr/devinsy/xidyn/data/SimpleTagData.java
+++ b/src/fr/devinsy/xidyn/data/SimpleTagData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2006-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2016 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -34,161 +34,167 @@ import java.io.Serializable;
*/
public class SimpleTagData implements Serializable, TagData
{
- public enum IterationStrategy
- {
- ONLY_FIRST_ROW, ONLY_FIRST_TWO_ROWS, ONLY_ROWS_WITH_ID, ONLY_ROWS_WITHOUT_ID, ALL_ROWS
- }
+ public enum IterationStrategy
+ {
+ ONLY_FIRST_ROW,
+ ONLY_FIRST_TWO_ROWS,
+ ONLY_ROWS_WITH_ID,
+ ONLY_ROWS_WITHOUT_ID,
+ ALL_ROWS
+ }
- public enum MODE
- {
- REPLACE, APPEND, IGNORE
- }
+ public enum MODE
+ {
+ REPLACE,
+ APPEND,
+ IGNORE
+ }
- private static final long serialVersionUID = 8976245034682639923L;;
+ private static final long serialVersionUID = 8976245034682639923L;;
- private IterationStrategy iterationStrategy;
- private TagAttributes attributes;
- private boolean excludeSection;
- private MODE displayMode = MODE.REPLACE;
- private String content;
+ private IterationStrategy iterationStrategy;
+ private TagAttributes attributes;
+ private boolean excludeSection;
+ private MODE displayMode = MODE.REPLACE;
+ private String content;
- /**
+ /**
*
*/
- public SimpleTagData()
- {
- this.attributes = null;
- this.excludeSection = false;
- this.displayMode = MODE.REPLACE;
- this.content = null;
- this.iterationStrategy = IterationStrategy.ALL_ROWS;
- }
+ public SimpleTagData()
+ {
+ this.attributes = null;
+ this.excludeSection = false;
+ this.displayMode = MODE.REPLACE;
+ this.content = null;
+ this.iterationStrategy = IterationStrategy.ALL_ROWS;
+ }
- /**
+ /**
*
*/
- public SimpleTagData(final String text)
- {
- this.attributes = null;
- this.excludeSection = false;
- this.displayMode = MODE.REPLACE;
- this.content = text;
- this.iterationStrategy = IterationStrategy.ALL_ROWS;
- }
+ public SimpleTagData(final String text)
+ {
+ this.attributes = null;
+ this.excludeSection = false;
+ this.displayMode = MODE.REPLACE;
+ this.content = text;
+ this.iterationStrategy = IterationStrategy.ALL_ROWS;
+ }
- /**
+ /**
*
*/
- public void appendContent(final String text)
- {
- if (this.content == null)
- {
- this.content = text;
- }
- else
- {
- this.content += text;
- }
- }
+ public void appendContent(final String text)
+ {
+ if (this.content == null)
+ {
+ this.content = text;
+ }
+ else
+ {
+ this.content += text;
+ }
+ }
- /**
+ /**
*
*/
- public TagAttributes attributes()
- {
- TagAttributes result;
+ public TagAttributes attributes()
+ {
+ TagAttributes result;
- if (this.attributes == null)
- {
- this.attributes = new TagAttributes();
- }
+ if (this.attributes == null)
+ {
+ this.attributes = new TagAttributes();
+ }
- result = this.attributes;
+ result = this.attributes;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public String display()
- {
- String result;
+ public String display()
+ {
+ String result;
- result = this.content;
+ result = this.content;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public MODE displayMode()
- {
- MODE result;
+ public MODE displayMode()
+ {
+ MODE result;
- result = this.displayMode;
+ result = this.displayMode;
- return (result);
- }
+ return (result);
+ }
- /**
+ /**
*
*/
- public boolean excludeSection()
- {
- boolean result;
+ public boolean excludeSection()
+ {
+ boolean result;
- result = this.excludeSection;
+ result = this.excludeSection;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public IterationStrategy iterationStrategy()
- {
- IterationStrategy result;
+ public IterationStrategy iterationStrategy()
+ {
+ IterationStrategy result;
- result = this.iterationStrategy;
+ result = this.iterationStrategy;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public void setContent(final String text)
- {
- this.content = text;
- }
+ public void setContent(final String text)
+ {
+ this.content = text;
+ }
- /**
+ /**
*
*/
- public void setDisplayMode(final MODE displayMode)
- {
- this.displayMode = displayMode;
- }
+ public void setDisplayMode(final MODE displayMode)
+ {
+ this.displayMode = displayMode;
+ }
- /**
+ /**
*
*/
- public void setExcludeSection(final boolean excludeSection)
- {
- this.excludeSection = excludeSection;
- }
+ public void setExcludeSection(final boolean excludeSection)
+ {
+ this.excludeSection = excludeSection;
+ }
- /**
+ /**
*
*/
- public void setIterationStrategy(final IterationStrategy strategy)
- {
- this.iterationStrategy = strategy;
- }
+ public void setIterationStrategy(final IterationStrategy strategy)
+ {
+ this.iterationStrategy = strategy;
+ }
}
diff --git a/src/fr/devinsy/xidyn/data/TagAttributes.java b/src/fr/devinsy/xidyn/data/TagAttributes.java
index 765f2e5..554c208 100644
--- a/src/fr/devinsy/xidyn/data/TagAttributes.java
+++ b/src/fr/devinsy/xidyn/data/TagAttributes.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2006-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2016 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -27,67 +27,67 @@ import java.util.HashMap;
*/
public class TagAttributes extends HashMap
{
- private static final long serialVersionUID = 2802739066295665336L;
+ private static final long serialVersionUID = 2802739066295665336L;
- /**
+ /**
*
*/
- public TagAttributes()
- {
- super();
- }
+ public TagAttributes()
+ {
+ super();
+ }
- /**
- * Useful for the merge attributes.
- */
- public TagAttributes(final TagAttributes attributes)
- {
- super(attributes);
- }
+ /**
+ * Useful for the merge attributes.
+ */
+ public TagAttributes(final TagAttributes attributes)
+ {
+ super(attributes);
+ }
- /**
- * Add a value to an existing value. This is useful to the 'style'
- * attribute.
- *
- */
- public void appendAttribute(final String label, final String value)
- {
- if (this.containsKey(label))
- {
- this.put(label, this.get(label) + value);
- }
- else
- {
- this.put(label, value);
- }
- }
+ /**
+ * Add a value to an existing value. This is useful to the 'style'
+ * attribute.
+ *
+ */
+ public void appendAttribute(final String label, final String value)
+ {
+ if (this.containsKey(label))
+ {
+ this.put(label, this.get(label) + value);
+ }
+ else
+ {
+ this.put(label, value);
+ }
+ }
- /**
+ /**
*
*/
- public String getAttribute(final String label)
- {
- String result;
+ public String getAttribute(final String label)
+ {
+ String result;
- if (this.containsKey(label))
- {
- result = this.get(label);
- }
- else
- {
- result = null;
- }
+ if (this.containsKey(label))
+ {
+ result = this.get(label);
+ }
+ else
+ {
+ result = null;
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public void setAttribute(final String label, final String value)
- {
- this.put(label, value);
- }
+ public void setAttribute(final String label, final String value)
+ {
+ this.put(label, value);
+ }
}
diff --git a/src/fr/devinsy/xidyn/data/TagData.java b/src/fr/devinsy/xidyn/data/TagData.java
index 4c2f02f..1d5a257 100644
--- a/src/fr/devinsy/xidyn/data/TagData.java
+++ b/src/fr/devinsy/xidyn/data/TagData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2006-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2016 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
diff --git a/src/fr/devinsy/xidyn/data/TagDataListById.java b/src/fr/devinsy/xidyn/data/TagDataListById.java
index 7f11c3e..4a642e2 100644
--- a/src/fr/devinsy/xidyn/data/TagDataListById.java
+++ b/src/fr/devinsy/xidyn/data/TagDataListById.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2006-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2016 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -26,35 +26,35 @@ import java.util.HashMap;
public class TagDataListById extends HashMap implements TagData
{
- private static final long serialVersionUID = -5787252043825503554L;
+ private static final long serialVersionUID = -5787252043825503554L;
- /**
+ /**
*
*/
- public TagDataListById()
- {
- super();
- }
+ public TagDataListById()
+ {
+ super();
+ }
- /**
+ /**
*
*/
- public TagData getId(final String id)
- {
- TagData result;
+ public TagData getId(final String id)
+ {
+ TagData result;
- result = this.get(id);
+ result = this.get(id);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public void setId(final String id, final TagData data)
- {
- this.put(id, data);
- }
+ public void setId(final String id, final TagData data)
+ {
+ this.put(id, data);
+ }
}
diff --git a/src/fr/devinsy/xidyn/data/TagDataListByIndex.java b/src/fr/devinsy/xidyn/data/TagDataListByIndex.java
index 7519d9e..5e5f6e7 100644
--- a/src/fr/devinsy/xidyn/data/TagDataListByIndex.java
+++ b/src/fr/devinsy/xidyn/data/TagDataListByIndex.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2006-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2016 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -26,13 +26,13 @@ import java.util.Vector;
public class TagDataListByIndex extends Vector implements TagData
{
- private static final long serialVersionUID = 215545720925753884L;
+ private static final long serialVersionUID = 215545720925753884L;
- /**
+ /**
*
*/
- public TagDataListByIndex()
- {
- super();
- }
+ public TagDataListByIndex()
+ {
+ super();
+ }
}
diff --git a/src/fr/devinsy/xidyn/data/TagDataManager.java b/src/fr/devinsy/xidyn/data/TagDataManager.java
index 3055366..3838c83 100644
--- a/src/fr/devinsy/xidyn/data/TagDataManager.java
+++ b/src/fr/devinsy/xidyn/data/TagDataManager.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2006-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2016 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -23,308 +23,308 @@ package fr.devinsy.xidyn.data;
*/
public class TagDataManager
{
- private TagDataListById idsDataById;
+ private TagDataListById idsDataById;
- /**
+ /**
*
*/
- public TagDataManager()
- {
- this.idsDataById = new TagDataListById();
- }
+ public TagDataManager()
+ {
+ this.idsDataById = new TagDataListById();
+ }
- /**
+ /**
*
*/
- public void appendAttribute(final String id, final int line, final String column, final String label, final String value)
- {
- SimpleTagData tag = this.getIdData(id, line, column);
+ public void appendAttribute(final String id, final int line, final String column, final String label, final String value)
+ {
+ SimpleTagData tag = this.getIdData(id, line, column);
- tag.attributes().appendAttribute(label, value);
- }
+ tag.attributes().appendAttribute(label, value);
+ }
- /**
+ /**
*
*/
- public void appendAttribute(final String id, final String label, final long value)
- {
- appendAttribute(id, label, String.valueOf(value));
- }
+ public void appendAttribute(final String id, final String label, final long value)
+ {
+ appendAttribute(id, label, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void appendAttribute(final String id, final String label, final String value)
- {
- SimpleTagData tag = this.getIdData(id);
+ public void appendAttribute(final String id, final String label, final String value)
+ {
+ SimpleTagData tag = this.getIdData(id);
- tag.attributes().appendAttribute(label, value);
- }
+ tag.attributes().appendAttribute(label, value);
+ }
- /**
+ /**
*
*/
- public void appendContent(final String id, final int line, final long value)
- {
- appendContent(id, line, String.valueOf(value));
- }
+ public void appendContent(final String id, final int line, final long value)
+ {
+ appendContent(id, line, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void appendContent(final String id, final int line, final String value)
- {
- SimpleTagData tag = this.getIdData(id, line);
+ public void appendContent(final String id, final int line, final String value)
+ {
+ SimpleTagData tag = this.getIdData(id, line);
- tag.appendContent(value);
- }
+ tag.appendContent(value);
+ }
- /**
+ /**
*
*/
- public void appendContent(final String id, final int line, final String column, final long value)
- {
- appendContent(id, line, column, String.valueOf(value));
- }
+ public void appendContent(final String id, final int line, final String column, final long value)
+ {
+ appendContent(id, line, column, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void appendContent(final String id, final int line, final String column, final String value)
- {
- SimpleTagData tag = this.getIdData(id, line, column);
+ public void appendContent(final String id, final int line, final String column, final String value)
+ {
+ SimpleTagData tag = this.getIdData(id, line, column);
- tag.appendContent(value);
- }
+ tag.appendContent(value);
+ }
- /**
+ /**
*
*/
- public SimpleTagData getIdData(final String id)
- {
- SimpleTagData result;
+ public SimpleTagData getIdData(final String id)
+ {
+ SimpleTagData result;
- // Be sure that IdData is existing and get item.
- result = (SimpleTagData) this.idsDataById.getId(id);
+ // Be sure that IdData is existing and get item.
+ result = (SimpleTagData) this.idsDataById.getId(id);
- if (result == null)
- {
- this.idsDataById.setId(id, new SimpleTagData());
+ if (result == null)
+ {
+ this.idsDataById.setId(id, new SimpleTagData());
- result = (SimpleTagData) this.idsDataById.getId(id);
- }
+ result = (SimpleTagData) this.idsDataById.getId(id);
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public SimpleTagData getIdData(final String id, final int line)
- {
- SimpleTagData result;
+ public SimpleTagData getIdData(final String id, final int line)
+ {
+ SimpleTagData result;
- // Be sure that IdsData are existing.
- TagDataListByIndex tags = (TagDataListByIndex) this.idsDataById.getId(id);
- if (tags == null)
- {
- this.idsDataById.setId(id, new TagDataListByIndex());
+ // Be sure that IdsData are existing.
+ TagDataListByIndex tags = (TagDataListByIndex) this.idsDataById.getId(id);
+ if (tags == null)
+ {
+ this.idsDataById.setId(id, new TagDataListByIndex());
- tags = (TagDataListByIndex) this.idsDataById.getId(id);
- }
+ tags = (TagDataListByIndex) this.idsDataById.getId(id);
+ }
- // Be sure that lines are existing.
- int nbLines = tags.size();
- for (int nLine = nbLines; nLine < line + 1; nLine++)
- {
- tags.add(nLine, new SimpleTagData());
- }
+ // Be sure that lines are existing.
+ int nbLines = tags.size();
+ for (int nLine = nbLines; nLine < line + 1; nLine++)
+ {
+ tags.add(nLine, new SimpleTagData());
+ }
- // Get item.
- result = (SimpleTagData) tags.elementAt(line);
+ // Get item.
+ result = (SimpleTagData) tags.elementAt(line);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public SimpleTagData getIdData(final String id, final int line, final String column)
- {
- SimpleTagData result;
+ public SimpleTagData getIdData(final String id, final int line, final String column)
+ {
+ SimpleTagData result;
- // Be sure that IdsData are existing.
- TagDataListByIndex tags = (TagDataListByIndex) this.idsDataById.getId(id);
- if (tags == null)
- {
- this.idsDataById.setId(id, new TagDataListByIndex());
+ // Be sure that IdsData are existing.
+ TagDataListByIndex tags = (TagDataListByIndex) this.idsDataById.getId(id);
+ if (tags == null)
+ {
+ this.idsDataById.setId(id, new TagDataListByIndex());
- tags = (TagDataListByIndex) this.idsDataById.getId(id);
- }
+ tags = (TagDataListByIndex) this.idsDataById.getId(id);
+ }
- // Be sure that lines are existing.
- int nbLines = tags.size();
- for (int nLine = nbLines; nLine < line + 1; nLine++)
- {
- tags.add(nLine, new TagDataListById());
- }
+ // Be sure that lines are existing.
+ int nbLines = tags.size();
+ for (int nLine = nbLines; nLine < line + 1; nLine++)
+ {
+ tags.add(nLine, new TagDataListById());
+ }
- // Get item.
- TagDataListById lineData = (TagDataListById) tags.elementAt(line);
+ // Get item.
+ TagDataListById lineData = (TagDataListById) tags.elementAt(line);
- result = (SimpleTagData) lineData.get(column);
+ result = (SimpleTagData) lineData.get(column);
- if (result == null)
- {
- lineData.put(column, new SimpleTagData());
+ if (result == null)
+ {
+ lineData.put(column, new SimpleTagData());
- result = (SimpleTagData) lineData.get(column);
- }
+ result = (SimpleTagData) lineData.get(column);
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public TagDataListById getIdsDataById()
- {
- TagDataListById result;
+ public TagDataListById getIdsDataById()
+ {
+ TagDataListById result;
- result = this.idsDataById;
+ result = this.idsDataById;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public void setAttribute(final String id, final int line, final String label, final long value)
- {
- setAttribute(id, line, label, String.valueOf(value));
- }
+ public void setAttribute(final String id, final int line, final String label, final long value)
+ {
+ setAttribute(id, line, label, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void setAttribute(final String id, final int line, final String label, final String value)
- {
- SimpleTagData tag = this.getIdData(id, line);
+ public void setAttribute(final String id, final int line, final String label, final String value)
+ {
+ SimpleTagData tag = this.getIdData(id, line);
- tag.attributes().setAttribute(label, value);
- }
+ tag.attributes().setAttribute(label, value);
+ }
- /**
+ /**
*
*/
- public void setAttribute(final String id, final int line, final String column, final String label, final long value)
- {
- setAttribute(id, line, column, label, String.valueOf(value));
- }
+ public void setAttribute(final String id, final int line, final String column, final String label, final long value)
+ {
+ setAttribute(id, line, column, label, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void setAttribute(final String id, final int line, final String column, final String label, final String value)
- {
- SimpleTagData tag = this.getIdData(id, line, column);
+ public void setAttribute(final String id, final int line, final String column, final String label, final String value)
+ {
+ SimpleTagData tag = this.getIdData(id, line, column);
- tag.attributes().setAttribute(label, value);
- }
+ tag.attributes().setAttribute(label, value);
+ }
- /**
+ /**
*
*/
- public void setAttribute(final String id, final String label, final long value)
- {
- setAttribute(id, label, String.valueOf(value));
- }
+ public void setAttribute(final String id, final String label, final long value)
+ {
+ setAttribute(id, label, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void setAttribute(final String id, final String label, final String value)
- {
- SimpleTagData tag = this.getIdData(id);
+ public void setAttribute(final String id, final String label, final String value)
+ {
+ SimpleTagData tag = this.getIdData(id);
- tag.attributes().setAttribute(label, value);
- }
+ tag.attributes().setAttribute(label, value);
+ }
- /**
+ /**
*
*/
- public void setContent(final String id, final int line, final long value)
- {
- setContent(id, line, String.valueOf(value));
- }
+ public void setContent(final String id, final int line, final long value)
+ {
+ setContent(id, line, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void setContent(final String id, final int line, final String content)
- {
- SimpleTagData tag = this.getIdData(id, line);
+ public void setContent(final String id, final int line, final String content)
+ {
+ SimpleTagData tag = this.getIdData(id, line);
- tag.setContent(content);
- }
+ tag.setContent(content);
+ }
- /**
- * @TODO
- */
- public void setContent(final String id, final int line, final String subId, final int subLine, final String column, final String content)
- {
- // IdData tag = this.getIdData (id, line, subId, subLine, column);
+ /**
+ * @TODO
+ */
+ public void setContent(final String id, final int line, final String subId, final int subLine, final String column, final String content)
+ {
+ // IdData tag = this.getIdData (id, line, subId, subLine, column);
- // tag.setContent (content);
- }
+ // tag.setContent (content);
+ }
- /**
+ /**
*
*/
- public void setContent(final String id, final int line, final String column, final long value)
- {
- setContent(id, line, column, String.valueOf(value));
- }
+ public void setContent(final String id, final int line, final String column, final long value)
+ {
+ setContent(id, line, column, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void setContent(final String id, final int line, final String column, final String content)
- {
- SimpleTagData tag = this.getIdData(id, line, column);
+ public void setContent(final String id, final int line, final String column, final String content)
+ {
+ SimpleTagData tag = this.getIdData(id, line, column);
- tag.setContent(content);
- }
+ tag.setContent(content);
+ }
- /**
+ /**
*
*/
- public void setContent(final String id, final long value)
- {
- setContent(id, String.valueOf(value));
- }
+ public void setContent(final String id, final long value)
+ {
+ setContent(id, String.valueOf(value));
+ }
- /**
+ /**
*
*/
- public void setContent(final String id, final String content)
- {
- SimpleTagData idData = this.getIdData(id);
+ public void setContent(final String id, final String content)
+ {
+ SimpleTagData idData = this.getIdData(id);
- idData.setContent(content);
- }
+ idData.setContent(content);
+ }
- /**
+ /**
*
*/
- public void setIterationStrategy(final String id, final SimpleTagData.IterationStrategy strategy)
- {
- SimpleTagData tag = this.getIdData(id);
+ public void setIterationStrategy(final String id, final SimpleTagData.IterationStrategy strategy)
+ {
+ SimpleTagData tag = this.getIdData(id);
- tag.setIterationStrategy(strategy);
- }
+ tag.setIterationStrategy(strategy);
+ }
}
diff --git a/src/fr/devinsy/xidyn/pages/Page.java b/src/fr/devinsy/xidyn/pages/Page.java
index 655a343..d450879 100644
--- a/src/fr/devinsy/xidyn/pages/Page.java
+++ b/src/fr/devinsy/xidyn/pages/Page.java
@@ -26,82 +26,82 @@ import fr.devinsy.xidyn.presenters.Presenter;
*/
public class Page extends TagDataManager
{
- private Presenter presenter;
- private StringBuffer lastDynamize;
+ private Presenter presenter;
+ private StringBuffer lastDynamize;
- /**
+ /**
*
*/
- public Page(final Presenter presenter)
- {
- super();
+ public Page(final Presenter presenter)
+ {
+ super();
- if (presenter == null)
- {
- throw new IllegalArgumentException("Null parameter.");
- }
- else
- {
- this.presenter = presenter;
- this.lastDynamize = null;
- }
- }
+ if (presenter == null)
+ {
+ throw new IllegalArgumentException("Null parameter.");
+ }
+ else
+ {
+ this.presenter = presenter;
+ this.lastDynamize = null;
+ }
+ }
- /**
- *
- * @return
- * @throws Exception
- */
- public StringBuffer dynamize() throws Exception
- {
- StringBuffer result;
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ public StringBuffer dynamize() throws Exception
+ {
+ StringBuffer result;
- this.lastDynamize = this.presenter.dynamize(this);
+ this.lastDynamize = this.presenter.dynamize(this);
- result = this.lastDynamize;
+ result = this.lastDynamize;
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @return
- */
- public boolean isComplete()
- {
- boolean result;
+ /**
+ *
+ * @return
+ */
+ public boolean isComplete()
+ {
+ boolean result;
- if (this.lastDynamize == null)
- {
- result = false;
- }
- else
- {
- result = true;
- }
+ if (this.lastDynamize == null)
+ {
+ result = false;
+ }
+ else
+ {
+ result = true;
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * @throws Exception
- */
- public StringBuffer lastVersion() throws Exception
- {
- StringBuffer result;
+ /**
+ * @throws Exception
+ */
+ public StringBuffer lastVersion() throws Exception
+ {
+ StringBuffer result;
- if ((this.lastDynamize == null) || (this.presenter.isOutdated()))
- {
- dynamize();
- }
+ if ((this.lastDynamize == null) || (this.presenter.isOutdated()))
+ {
+ dynamize();
+ }
- result = this.lastDynamize;
+ result = this.lastDynamize;
- //
- return result;
- }
+ //
+ return result;
+ }
}
// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/xidyn/pages/PageFactory.java b/src/fr/devinsy/xidyn/pages/PageFactory.java
index 8376893..19280d4 100644
--- a/src/fr/devinsy/xidyn/pages/PageFactory.java
+++ b/src/fr/devinsy/xidyn/pages/PageFactory.java
@@ -33,214 +33,214 @@ import fr.devinsy.xidyn.utils.cache.Cache;
*/
public class PageFactory
{
- /**
- * http://thecodersbreakfast.net/index.php?post/2008/02/25/26-de-la-bonne-
- * implementation-du-singleton-en-java
+ /**
+ * http://thecodersbreakfast.net/index.php?post/2008/02/25/26-de-la-bonne-
+ * implementation-du-singleton-en-java
+ *
+ */
+ private static class SingletonHolder
+ {
+ private final static PageFactory INSTANCE = new PageFactory();
+ }
+
+ private Cache cache;
+
+ /**
*
*/
- private static class SingletonHolder
- {
- private final static PageFactory INSTANCE = new PageFactory();
- }
+ private PageFactory()
+ {
+ this.cache = new Cache();
+ }
- private Cache cache;
-
- /**
+ /**
*
*/
- private PageFactory()
- {
- this.cache = new Cache();
- }
+ public void clear()
+ {
+ this.cache.clear();
+ PresenterFactory.instance().clear();
+ }
- /**
- *
- * @param source
- * @param parameters
- * @return
- */
- public Page get(final Document source)
- {
- Page result;
+ /**
+ *
+ * @param source
+ * @param parameters
+ * @return
+ */
+ public Page get(final Document source)
+ {
+ Page result;
- result = new Page(PresenterFactory.instance().get(source));
+ result = new Page(PresenterFactory.instance().get(source));
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @param parameters
- * @return
- * @throws Exception
- */
- public Page get(final Document source, final String... keys)
- {
- Page result;
+ /**
+ *
+ * @param source
+ * @param parameters
+ * @return
+ * @throws Exception
+ */
+ public Page get(final Document source, final String... keys)
+ {
+ Page result;
- String key = StringListUtils.toStringSeparatedBy(keys, "-").toString();
+ String key = StringListUtils.toStringSeparatedBy(keys, "-").toString();
- result = this.cache.get(key);
- if (result == null)
- {
- result = get(source);
- this.cache.put(key, result);
- }
+ result = this.cache.get(key);
+ if (result == null)
+ {
+ result = get(source);
+ this.cache.put(key, result);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @param parameters
- * @return
- */
- public Page get(final File source)
- {
- Page result;
+ /**
+ *
+ * @param source
+ * @param parameters
+ * @return
+ */
+ public Page get(final File source)
+ {
+ Page result;
- result = new Page(PresenterFactory.instance().get(source));
+ result = new Page(PresenterFactory.instance().get(source));
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @param parameters
- * @return
- */
- public Page get(final File source, final String... keys)
- {
- Page result;
+ /**
+ *
+ * @param source
+ * @param parameters
+ * @return
+ */
+ public Page get(final File source, final String... keys)
+ {
+ Page result;
- String key = StringListUtils.toStringSeparatedBy(keys, "-").toString();
+ String key = StringListUtils.toStringSeparatedBy(keys, "-").toString();
- result = this.cache.get(key);
- if (result == null)
- {
- result = get(source);
- this.cache.put(key, result);
- }
+ result = this.cache.get(key);
+ if (result == null)
+ {
+ result = get(source);
+ this.cache.put(key, result);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @param parameters
- * @return
- */
- public Page get(final String source)
- {
- Page result;
+ /**
+ *
+ * @param source
+ * @param parameters
+ * @return
+ */
+ public Page get(final String source)
+ {
+ Page result;
- result = new Page(PresenterFactory.instance().get(source));
+ result = new Page(PresenterFactory.instance().get(source));
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @param parameters
- * @return
- */
- public Page get(final String source, final String... keys)
- {
- Page result;
+ /**
+ *
+ * @param source
+ * @param parameters
+ * @return
+ */
+ public Page get(final String source, final String... keys)
+ {
+ Page result;
- String key = StringListUtils.toStringSeparatedBy(keys, "-").toString();
+ String key = StringListUtils.toStringSeparatedBy(keys, "-").toString();
- result = this.cache.get(key);
- if (result == null)
- {
- result = get(source);
- this.cache.put(key, result);
- }
+ result = this.cache.get(key);
+ if (result == null)
+ {
+ result = get(source);
+ this.cache.put(key, result);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @param parameters
- * @return
- */
- public Page get(final URL source)
- {
- Page result;
+ /**
+ *
+ * @param source
+ * @param parameters
+ * @return
+ */
+ public Page get(final URL source)
+ {
+ Page result;
- result = new Page(PresenterFactory.instance().get(source));
+ result = new Page(PresenterFactory.instance().get(source));
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @param parameters
- * @return
- */
- public Page get(final URL source, final String... keys)
- {
- Page result;
+ /**
+ *
+ * @param source
+ * @param parameters
+ * @return
+ */
+ public Page get(final URL source, final String... keys)
+ {
+ Page result;
- String key = StringListUtils.toStringSeparatedBy(keys, "-").toString();
+ String key = StringListUtils.toStringSeparatedBy(keys, "-").toString();
- result = this.cache.get(key);
- if (result == null)
- {
- result = get(source);
- this.cache.put(key, result);
- }
+ result = this.cache.get(key);
+ if (result == null)
+ {
+ result = get(source);
+ this.cache.put(key, result);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- */
- public void clear()
- {
- this.cache.clear();
- PresenterFactory.instance().clear();
- }
+ /**
+ *
+ * @return
+ */
+ public int size()
+ {
+ int result;
- /**
- *
- * @return
- */
- public int size()
- {
- int result;
+ result = this.cache.size();
- result = this.cache.size();
+ //
+ return result;
+ }
- //
- return result;
- }
-
- /**
- *
- * @return
- */
- public static PageFactory instance()
- {
- return SingletonHolder.INSTANCE;
- }
+ /**
+ *
+ * @return
+ */
+ public static PageFactory instance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
}
// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/xidyn/presenters/DomPresenter.java b/src/fr/devinsy/xidyn/presenters/DomPresenter.java
index 6ef2e72..d7de736 100644
--- a/src/fr/devinsy/xidyn/presenters/DomPresenter.java
+++ b/src/fr/devinsy/xidyn/presenters/DomPresenter.java
@@ -32,168 +32,168 @@ import fr.devinsy.xidyn.utils.XidynUtils;
*/
public class DomPresenter implements Presenter
{
- private static Logger logger = LoggerFactory.getLogger(DomPresenter.class);
- private Document dom;
- private boolean isOutdated;
- private StringBuffer defaultHtmlTarget;
+ private static Logger logger = LoggerFactory.getLogger(DomPresenter.class);
+ private Document dom;
+ private boolean isOutdated;
+ private StringBuffer defaultHtmlTarget;
- /**
+ /**
*
*/
- public DomPresenter()
- {
- this.dom = null;
- this.isOutdated = false;
- }
+ public DomPresenter()
+ {
+ this.dom = null;
+ this.isOutdated = false;
+ }
- /**
+ /**
*
*/
- public DomPresenter(final Document doc)
- {
- setSource(doc);
- }
+ public DomPresenter(final Document doc)
+ {
+ setSource(doc);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public StringBuffer dynamize() throws Exception
- {
- StringBuffer result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StringBuffer dynamize() throws Exception
+ {
+ StringBuffer result;
- if ((this.isOutdated) || (this.defaultHtmlTarget == null))
- {
- this.defaultHtmlTarget = dynamize(null);
- this.isOutdated = false;
- }
+ if ((this.isOutdated) || (this.defaultHtmlTarget == null))
+ {
+ this.defaultHtmlTarget = dynamize(null);
+ this.isOutdated = false;
+ }
- result = this.defaultHtmlTarget;
+ result = this.defaultHtmlTarget;
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public StringBuffer dynamize(final TagDataManager data) throws Exception
- {
- StringBuffer result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StringBuffer dynamize(final TagDataManager data) throws Exception
+ {
+ StringBuffer result;
- if (data == null)
- {
- result = dynamize(new TagDataManager());
- }
- else if (this.dom == null)
- {
- String errorMessage = "source not defined";
- logger.error(errorMessage);
- result = null;
- throw new Exception(errorMessage);
- }
- else
- {
- // Build the web page.
- StringWriter writer = new StringWriter(20000);
- DomPresenterCore.dynamize(writer, this.dom, data);
- result = writer.getBuffer();
- this.isOutdated = false;
- }
+ if (data == null)
+ {
+ result = dynamize(new TagDataManager());
+ }
+ else if (this.dom == null)
+ {
+ String errorMessage = "source not defined";
+ logger.error(errorMessage);
+ result = null;
+ throw new Exception(errorMessage);
+ }
+ else
+ {
+ // Build the web page.
+ StringWriter writer = new StringWriter(20000);
+ DomPresenterCore.dynamize(writer, this.dom, data);
+ result = writer.getBuffer();
+ this.isOutdated = false;
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public Document getDOM()
- {
- Document result;
+ public Document getDOM()
+ {
+ Document result;
- result = this.dom;
+ result = this.dom;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getSource()
- {
- Object result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getSource()
+ {
+ Object result;
- result = this.dom;
+ result = this.dom;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAvailable()
- {
- boolean result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAvailable()
+ {
+ boolean result;
- if (this.dom == null)
- {
- result = false;
- }
- else
- {
- result = true;
- }
+ if (this.dom == null)
+ {
+ result = false;
+ }
+ else
+ {
+ result = true;
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isOutdated() throws Exception
- {
- boolean result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOutdated() throws Exception
+ {
+ boolean result;
- result = this.isOutdated;
+ result = this.isOutdated;
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public void setDOM(final Document doc)
- {
- this.dom = doc;
- this.isOutdated = true;
- }
+ public void setDOM(final Document doc)
+ {
+ this.dom = doc;
+ this.isOutdated = true;
+ }
- /**
+ /**
*
*/
- public void setSource(final Document doc)
- {
- this.dom = doc;
- XidynUtils.addMetaTag(this.dom, "generator", "XIDYN");
- this.isOutdated = true;
- }
+ public void setSource(final Document doc)
+ {
+ this.dom = doc;
+ XidynUtils.addMetaTag(this.dom, "generator", "XIDYN");
+ this.isOutdated = true;
+ }
- /**
- *
- * @throws Exception
- */
- @Override
- public void update() throws Exception
- {
+ /**
+ *
+ * @throws Exception
+ */
+ @Override
+ public void update() throws Exception
+ {
- }
+ }
}
diff --git a/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java b/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java
index fbcdd89..27b5122 100644
--- a/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java
+++ b/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java
@@ -46,765 +46,765 @@ import fr.devinsy.xidyn.utils.XidynUtils;
*/
public class DomPresenterCore
{
- private static Logger logger = LoggerFactory.getLogger(DomPresenterCore.class);
+ private static Logger logger = LoggerFactory.getLogger(DomPresenterCore.class);
- public static final char INDEX_SEPARATOR = '_';
+ public static final char INDEX_SEPARATOR = '_';
- /**
- * Dynamize a doc with data.
- */
- public static StringBuffer dynamize(final Document doc, final TagDataListById data) throws Exception
- {
- StringBuffer result;
+ /**
+ * Dynamize a doc with data.
+ */
+ public static StringBuffer dynamize(final Document doc, final TagDataListById data) throws Exception
+ {
+ StringBuffer result;
- StringWriter htmlCode = new StringWriter();
- dynamize(htmlCode, doc, data);
- result = htmlCode.getBuffer();
+ StringWriter htmlCode = new StringWriter();
+ dynamize(htmlCode, doc, data);
+ result = htmlCode.getBuffer();
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * Dynamize a doc with data.
- */
- public static StringBuffer dynamize(final Document doc, final TagDataManager data) throws Exception
- {
- StringBuffer result;
+ /**
+ * Dynamize a doc with data.
+ */
+ public static StringBuffer dynamize(final Document doc, final TagDataManager data) throws Exception
+ {
+ StringBuffer result;
- result = dynamize(doc, data.getIdsDataById());
+ result = dynamize(doc, data.getIdsDataById());
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * Dynamize a doc with data.
- */
- public static void dynamize(final Writer result, final Document doc, final TagDataListById data) throws Exception
- {
- process(result, doc, data);
- }
+ /**
+ * Dynamize a doc with data.
+ */
+ public static void dynamize(final Writer result, final Document doc, final TagDataListById data) throws Exception
+ {
+ process(result, doc, data);
+ }
- /**
- * Dynamize a doc with data.
- */
- public static void dynamize(final Writer result, final Document doc, final TagDataManager data) throws Exception
- {
- dynamize(result, doc, data.getIdsDataById());
- }
+ /**
+ * Dynamize a doc with data.
+ */
+ public static void dynamize(final Writer result, final Document doc, final TagDataManager data) throws Exception
+ {
+ dynamize(result, doc, data.getIdsDataById());
+ }
- /**
+ /**
*
*/
- private static String getClassAttributeValue(final Node node)
- {
- String result;
+ private static String getClassAttributeValue(final Node node)
+ {
+ String result;
- NamedNodeMap attributes = node.getAttributes();
- if (attributes == null)
- {
- result = null;
- }
- else
- {
- Node nameAttribute = attributes.getNamedItem("class");
+ NamedNodeMap attributes = node.getAttributes();
+ if (attributes == null)
+ {
+ result = null;
+ }
+ else
+ {
+ Node nameAttribute = attributes.getNamedItem("class");
- if (nameAttribute == null)
- {
- result = null;
- }
- else
- {
- result = nameAttribute.getNodeValue();
- }
- }
+ if (nameAttribute == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = nameAttribute.getNodeValue();
+ }
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * Get the text for an element. Converts new lines to spaces.
- *
- * @param node
- */
- private static String getElementText(final Node node)
- {
- String result;
+ /**
+ * Get the text for an element. Converts new lines to spaces.
+ *
+ * @param node
+ */
+ private static String getElementText(final Node node)
+ {
+ String result;
- NodeList children = node.getChildNodes();
- if ((children == null) || (children.getLength() == 0))
- {
- result = "";
- }
- else
- {
- boolean ended = false;
- result = ""; // Grrrr, Java ...
- int childCounter = 0;
- int childCount = children.getLength();
- while (!ended)
- {
- if (childCounter >= childCount)
- {
- ended = true;
- result = "";
- }
- else
- {
- Node child = children.item(childCounter);
- if (child.getNodeType() == Node.TEXT_NODE)
- {
- // STU (+=, newLines...)
- result = newLinesToSpaces(child.getNodeValue());
- ended = true;
- }
- else
- {
- childCounter += 1;
- }
- }
- }
- }
+ NodeList children = node.getChildNodes();
+ if ((children == null) || (children.getLength() == 0))
+ {
+ result = "";
+ }
+ else
+ {
+ boolean ended = false;
+ result = ""; // Grrrr, Java ...
+ int childCounter = 0;
+ int childCount = children.getLength();
+ while (!ended)
+ {
+ if (childCounter >= childCount)
+ {
+ ended = true;
+ result = "";
+ }
+ else
+ {
+ Node child = children.item(childCounter);
+ if (child.getNodeType() == Node.TEXT_NODE)
+ {
+ // STU (+=, newLines...)
+ result = newLinesToSpaces(child.getNodeValue());
+ ended = true;
+ }
+ else
+ {
+ childCounter += 1;
+ }
+ }
+ }
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- private static TagAttributes mergeAttributes(final TagAttributes target, final TagAttributes source)
- {
- TagAttributes result;
+ private static TagAttributes mergeAttributes(final TagAttributes target, final TagAttributes source)
+ {
+ TagAttributes result;
- //
- if (target == null)
- {
- result = source;
- }
- else if (source == null)
- {
- result = target;
- }
- else
- {
- result = new TagAttributes(target);
+ //
+ if (target == null)
+ {
+ result = source;
+ }
+ else if (source == null)
+ {
+ result = target;
+ }
+ else
+ {
+ result = new TagAttributes(target);
- Iterator> iterator = source.entrySet().iterator();
+ Iterator> iterator = source.entrySet().iterator();
- while (iterator.hasNext())
- {
- Map.Entry attribute = iterator.next();
+ while (iterator.hasNext())
+ {
+ Map.Entry attribute = iterator.next();
- String currentValue = target.get(attribute.getKey());
+ String currentValue = target.get(attribute.getKey());
- if (currentValue == null)
- {
- result.put(attribute.getKey(), attribute.getValue());
- }
- else if (attribute.getKey().equals("style"))
- {
- result.put(attribute.getKey(), currentValue + attribute.getValue());
- }
- else
- {
- result.put(attribute.getKey(), attribute.getValue());
- }
- }
- }
+ if (currentValue == null)
+ {
+ result.put(attribute.getKey(), attribute.getValue());
+ }
+ else if (attribute.getKey().equals("style"))
+ {
+ result.put(attribute.getKey(), currentValue + attribute.getValue());
+ }
+ else
+ {
+ result.put(attribute.getKey(), attribute.getValue());
+ }
+ }
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * Converts New Line characters to spaces. This is used when for example the
- * text in a div tag goes over several lines.
- *
- * @param text
- * String
- * @return String
- */
- private static String newLinesToSpaces(final String text)
- {
- StringBuffer result = new StringBuffer(text);
+ /**
+ * Converts New Line characters to spaces. This is used when for example the
+ * text in a div tag goes over several lines.
+ *
+ * @param text
+ * String
+ * @return String
+ */
+ private static String newLinesToSpaces(final String text)
+ {
+ StringBuffer result = new StringBuffer(text);
- for (int i = 0; i < result.length(); i++)
- {
- if (result.charAt(i) == '\n')
- {
- result.setCharAt(i, ' ');
- }
- }
+ for (int i = 0; i < result.length(); i++)
+ {
+ if (result.charAt(i) == '\n')
+ {
+ result.setCharAt(i, ' ');
+ }
+ }
- //
- return (result.toString());
- }
+ //
+ return (result.toString());
+ }
- /**
+ /**
*
*/
- private static void process(final Writer result, final Node node, final TagDataListById data) throws Exception
- {
- process(result, node, data, "");
- }
+ private static void process(final Writer result, final Node node, final TagDataListById data) throws Exception
+ {
+ process(result, node, data, "");
+ }
- /**
- * Recursive method that processes a node and any child nodes.
- *
- */
- private static void process(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception
- {
- logger.debug("process - started");
- String TRANSITIONAL_DTD = "xhtml1-transitional.dtd";
- String TRANSITIONAL_DOCTYPE = "\n";
+ /**
+ * Recursive method that processes a node and any child nodes.
+ *
+ */
+ private static void process(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception
+ {
+ logger.debug("process - started");
+ String TRANSITIONAL_DTD = "xhtml1-transitional.dtd";
+ String TRANSITIONAL_DOCTYPE = "\n";
- // Is there anything to do?
- if (node != null)
- {
- logger.debug("nodeName=[{}]", node.getNodeName());
- // Find the name attribute value.
- String name;
- name = getClassAttributeValue(node);
+ // Is there anything to do?
+ if (node != null)
+ {
+ logger.debug("nodeName=[{}]", node.getNodeName());
+ // Find the name attribute value.
+ String name;
+ name = getClassAttributeValue(node);
- if ((name == null) || ((name != null) && (!name.equals("xid:nodisplay"))))
- {
- int type = node.getNodeType();
- switch (type)
- {
- case Node.DOCUMENT_NODE:
- {
- logger.debug("case Node.DOCUMENT_NODE");
- DocumentType dt = ((Document) node).getDoctype();
+ if ((name == null) || ((name != null) && (!name.equals("xid:nodisplay"))))
+ {
+ int type = node.getNodeType();
+ switch (type)
+ {
+ case Node.DOCUMENT_NODE:
+ {
+ logger.debug("case Node.DOCUMENT_NODE");
+ DocumentType dt = ((Document) node).getDoctype();
- if (dt != null)
- {
- // String publicId = dt.getPublicId();
- String systemId = dt.getSystemId();
+ if (dt != null)
+ {
+ // String publicId = dt.getPublicId();
+ String systemId = dt.getSystemId();
- if ((systemId != null) && (systemId.equals(TRANSITIONAL_DTD)))
- {
- result.append(TRANSITIONAL_DOCTYPE);
- }
+ if ((systemId != null) && (systemId.equals(TRANSITIONAL_DTD)))
+ {
+ result.append(TRANSITIONAL_DOCTYPE);
+ }
- // Log.write(Log.TRACE,"publicId = " + publicId);
- // Log.write(Log.TRACE,"systemId = " + systemId);
- }
+ // Log.write(Log.TRACE,"publicId = " + publicId);
+ // Log.write(Log.TRACE,"systemId = " + systemId);
+ }
- process(result, ((Document) node).getDocumentElement(), datas, suffix);
+ process(result, ((Document) node).getDocumentElement(), datas, suffix);
- break;
- }
+ break;
+ }
- case Node.ELEMENT_NODE:
- {
- logger.debug("case Node.ELEMENT_NODE [{}]", node.getNodeName());
+ case Node.ELEMENT_NODE:
+ {
+ logger.debug("case Node.ELEMENT_NODE [{}]", node.getNodeName());
- NamedNodeMap attrs = node.getAttributes();
- Node idAttr = attrs.getNamedItem("id");
+ NamedNodeMap attrs = node.getAttributes();
+ Node idAttr = attrs.getNamedItem("id");
- if (idAttr != null)
- {
- processElementWithId(result, node, attrs, idAttr, datas, suffix);
- }
- else
- {
- processElementBasically(result, node, datas, suffix);
- }
+ if (idAttr != null)
+ {
+ processElementWithId(result, node, attrs, idAttr, datas, suffix);
+ }
+ else
+ {
+ processElementBasically(result, node, datas, suffix);
+ }
- break;
- }
+ break;
+ }
- // handle entity reference nodes
- case Node.ENTITY_REFERENCE_NODE:
- {
- logger.debug("case Node.ENTITY_REFERENCE_NODE");
+ // handle entity reference nodes
+ case Node.ENTITY_REFERENCE_NODE:
+ {
+ logger.debug("case Node.ENTITY_REFERENCE_NODE");
- result.append('&');
- result.append(node.getNodeName());
- result.append(';');
- break;
- }
+ result.append('&');
+ result.append(node.getNodeName());
+ result.append(';');
+ break;
+ }
- // print cdata sections
- case Node.CDATA_SECTION_NODE:
- {
- logger.debug("case Node.CDATA_SECTION_NODE");
+ // print cdata sections
+ case Node.CDATA_SECTION_NODE:
+ {
+ logger.debug("case Node.CDATA_SECTION_NODE");
- result.append("");
+ result.append("");
- break;
- }
+ break;
+ }
- // print text
- case Node.TEXT_NODE:
- {
- logger.debug("case Node.TEXTE_NODE");
- result.append(XidynUtils.restoreEntities(new StringBuffer(node.getNodeValue())));
- break;
- }
+ // print text
+ case Node.TEXT_NODE:
+ {
+ logger.debug("case Node.TEXTE_NODE");
+ result.append(XidynUtils.restoreEntities(new StringBuffer(node.getNodeValue())));
+ break;
+ }
- // print processing instruction
- case Node.PROCESSING_INSTRUCTION_NODE:
- {
- logger.debug("Node.PROCESSING_INSTRUCTION_NODE");
+ // print processing instruction
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ {
+ logger.debug("Node.PROCESSING_INSTRUCTION_NODE");
- result.append("");
- result.append(node.getNodeName());
- String value = node.getNodeValue();
- if ((value != null) && (value.length() > 0))
- {
- result.append(' ');
- result.append(value);
- }
- result.append("?>");
- break;
- }
- }
- }
- }
+ result.append("");
+ result.append(node.getNodeName());
+ String value = node.getNodeValue();
+ if ((value != null) && (value.length() > 0))
+ {
+ result.append(' ');
+ result.append(value);
+ }
+ result.append("?>");
+ break;
+ }
+ }
+ }
+ }
- //
- // logger.info ("result=" + result);
- logger.debug("process - ended");
- }
+ //
+ // logger.info ("result=" + result);
+ logger.debug("process - ended");
+ }
- /**
+ /**
*
*/
- private static StringBuffer processAttributes(final NamedNodeMap attrs)
- {
- StringBuffer result;
+ private static StringBuffer processAttributes(final NamedNodeMap attrs)
+ {
+ StringBuffer result;
- result = processAttributes(attrs, null, null, "");
+ result = processAttributes(attrs, null, null, "");
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes)
- {
- StringBuffer result;
+ private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes)
+ {
+ StringBuffer result;
- result = processAttributes(attrs, dataAttributes, "");
+ result = processAttributes(attrs, dataAttributes, "");
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final String suffix)
- {
- StringBuffer result;
+ private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final String suffix)
+ {
+ StringBuffer result;
- result = new StringBuffer();
+ result = new StringBuffer();
- // Build the original attributes list.
- HashMap mergedAttributes;
- mergedAttributes = new HashMap();
- for (int attributeCounter = 0; attributeCounter < attrs.getLength(); attributeCounter++)
- {
- Attr attr = (Attr) attrs.item(attributeCounter);
- mergedAttributes.put(attr.getNodeName(), attr.getNodeValue());
- }
+ // Build the original attributes list.
+ HashMap mergedAttributes;
+ mergedAttributes = new HashMap();
+ for (int attributeCounter = 0; attributeCounter < attrs.getLength(); attributeCounter++)
+ {
+ Attr attr = (Attr) attrs.item(attributeCounter);
+ mergedAttributes.put(attr.getNodeName(), attr.getNodeValue());
+ }
- // Put model attributes in the merged attributes list.
- if (dataAttributes != null)
- {
- Iterator> iterator = dataAttributes.entrySet().iterator();
+ // Put model attributes in the merged attributes list.
+ if (dataAttributes != null)
+ {
+ Iterator> iterator = dataAttributes.entrySet().iterator();
- while (iterator.hasNext())
- {
- Map.Entry attribute = iterator.next();
+ while (iterator.hasNext())
+ {
+ Map.Entry attribute = iterator.next();
- if (mergedAttributes.containsKey(attribute.getKey()))
- {
- if (attribute.getKey().equalsIgnoreCase("style"))
- {
- mergedAttributes.put(attribute.getKey(), mergedAttributes.get(attribute.getKey()) + attribute.getValue());
- }
- else
- {
- mergedAttributes.put(attribute.getKey(), attribute.getValue());
- }
- }
- else
- {
- mergedAttributes.put(attribute.getKey(), attribute.getValue());
- }
- }
- }
+ if (mergedAttributes.containsKey(attribute.getKey()))
+ {
+ if (attribute.getKey().equalsIgnoreCase("style"))
+ {
+ mergedAttributes.put(attribute.getKey(), mergedAttributes.get(attribute.getKey()) + attribute.getValue());
+ }
+ else
+ {
+ mergedAttributes.put(attribute.getKey(), attribute.getValue());
+ }
+ }
+ else
+ {
+ mergedAttributes.put(attribute.getKey(), attribute.getValue());
+ }
+ }
+ }
- // Display the attributes
- Iterator> iterator = mergedAttributes.entrySet().iterator();
- while (iterator.hasNext())
- {
- Map.Entry attribute = iterator.next();
+ // Display the attributes
+ Iterator> iterator = mergedAttributes.entrySet().iterator();
+ while (iterator.hasNext())
+ {
+ Map.Entry attribute = iterator.next();
- if ((attribute.getKey().equals("id")) && (suffix.length() != 0))
- {
- result.append(" " + attribute.getKey() + "=\"" + attribute.getValue() + INDEX_SEPARATOR + suffix + "\"");
- }
- else
- {
- result.append(" " + attribute.getKey() + "=\"" + attribute.getValue() + "\"");
- }
- }
+ if ((attribute.getKey().equals("id")) && (suffix.length() != 0))
+ {
+ result.append(" " + attribute.getKey() + "=\"" + attribute.getValue() + INDEX_SEPARATOR + suffix + "\"");
+ }
+ else
+ {
+ result.append(" " + attribute.getKey() + "=\"" + attribute.getValue() + "\"");
+ }
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final TagAttributes namedDataAttributes, final String suffix)
- {
- StringBuffer result;
+ private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final TagAttributes namedDataAttributes, final String suffix)
+ {
+ StringBuffer result;
- result = processAttributes(attrs, mergeAttributes(dataAttributes, namedDataAttributes), suffix);
+ result = processAttributes(attrs, mergeAttributes(dataAttributes, namedDataAttributes), suffix);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- private static void processChildren(final Writer result, final Node node, final TagDataListById datas) throws Exception
- {
- processChildren(result, node, datas, "");
- }
+ private static void processChildren(final Writer result, final Node node, final TagDataListById datas) throws Exception
+ {
+ processChildren(result, node, datas, "");
+ }
- /**
+ /**
*
*/
- private static void processChildren(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception
- {
- // Get the iteration strategy.
- SimpleTagData.IterationStrategy strategy;
+ private static void processChildren(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception
+ {
+ // Get the iteration strategy.
+ SimpleTagData.IterationStrategy strategy;
- NamedNodeMap attributes = node.getAttributes();
- if (attributes == null)
- {
- strategy = SimpleTagData.IterationStrategy.ALL_ROWS;
- }
- else
- {
- Node id = attributes.getNamedItem("id");
+ NamedNodeMap attributes = node.getAttributes();
+ if (attributes == null)
+ {
+ strategy = SimpleTagData.IterationStrategy.ALL_ROWS;
+ }
+ else
+ {
+ Node id = attributes.getNamedItem("id");
- if (id == null)
- {
- strategy = SimpleTagData.IterationStrategy.ALL_ROWS;
- }
- else
- {
- TagData dataCore = datas.getId(id.getNodeValue());
- if (dataCore == null)
- {
- strategy = SimpleTagData.IterationStrategy.ALL_ROWS;
- }
- else if (dataCore instanceof SimpleTagData)
- {
- SimpleTagData data = (SimpleTagData) dataCore;
- strategy = data.iterationStrategy();
- }
- else
- {
- strategy = SimpleTagData.IterationStrategy.ALL_ROWS;
- }
- }
- }
+ if (id == null)
+ {
+ strategy = SimpleTagData.IterationStrategy.ALL_ROWS;
+ }
+ else
+ {
+ TagData dataCore = datas.getId(id.getNodeValue());
+ if (dataCore == null)
+ {
+ strategy = SimpleTagData.IterationStrategy.ALL_ROWS;
+ }
+ else if (dataCore instanceof SimpleTagData)
+ {
+ SimpleTagData data = (SimpleTagData) dataCore;
+ strategy = data.iterationStrategy();
+ }
+ else
+ {
+ strategy = SimpleTagData.IterationStrategy.ALL_ROWS;
+ }
+ }
+ }
- // Iterate.
- NodeList children = node.getChildNodes();
- int childrenCount = children.getLength();
+ // Iterate.
+ NodeList children = node.getChildNodes();
+ int childrenCount = children.getLength();
- switch (strategy)
- {
- case ONLY_FIRST_ROW:
- int lineCounter = 0;
- for (int childIndex = 0; childIndex < childrenCount; childIndex++)
- {
- if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
- {
- lineCounter += 1;
- if (lineCounter == 1)
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- }
- else
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- }
- break;
+ switch (strategy)
+ {
+ case ONLY_FIRST_ROW:
+ int lineCounter = 0;
+ for (int childIndex = 0; childIndex < childrenCount; childIndex++)
+ {
+ if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
+ {
+ lineCounter += 1;
+ if (lineCounter == 1)
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ }
+ else
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ }
+ break;
- case ONLY_FIRST_TWO_ROWS:
- lineCounter = 0;
- for (int childIndex = 0; childIndex < childrenCount; childIndex++)
- {
- if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
- {
- lineCounter += 1;
+ case ONLY_FIRST_TWO_ROWS:
+ lineCounter = 0;
+ for (int childIndex = 0; childIndex < childrenCount; childIndex++)
+ {
+ if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
+ {
+ lineCounter += 1;
- if ((lineCounter == 1) || (lineCounter == 2))
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- }
- else
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- }
- break;
+ if ((lineCounter == 1) || (lineCounter == 2))
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ }
+ else
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ }
+ break;
- case ONLY_ROWS_WITH_ID:
- for (int childIndex = 0; childIndex < childrenCount; childIndex++)
- {
- if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
- {
- NamedNodeMap attrs2 = children.item(childIndex).getAttributes();
+ case ONLY_ROWS_WITH_ID:
+ for (int childIndex = 0; childIndex < childrenCount; childIndex++)
+ {
+ if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
+ {
+ NamedNodeMap attrs2 = children.item(childIndex).getAttributes();
- if ((attrs2 != null) && (attrs2.getNamedItem("id") != null))
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- }
- else
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- }
- break;
+ if ((attrs2 != null) && (attrs2.getNamedItem("id") != null))
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ }
+ else
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ }
+ break;
- case ONLY_ROWS_WITHOUT_ID:
- for (int childIndex = 0; childIndex < childrenCount; childIndex++)
- {
- if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
- {
- NamedNodeMap attrs2 = children.item(childIndex).getAttributes();
- if ((attrs2 == null) || (attrs2.getNamedItem("id") == null))
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- }
- else
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- }
- break;
+ case ONLY_ROWS_WITHOUT_ID:
+ for (int childIndex = 0; childIndex < childrenCount; childIndex++)
+ {
+ if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
+ {
+ NamedNodeMap attrs2 = children.item(childIndex).getAttributes();
+ if ((attrs2 == null) || (attrs2.getNamedItem("id") == null))
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ }
+ else
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ }
+ break;
- case ALL_ROWS:
- for (int childIndex = 0; childIndex < childrenCount; childIndex++)
- {
- process(result, children.item(childIndex), datas, suffix);
- }
- break;
- }
- }
+ case ALL_ROWS:
+ for (int childIndex = 0; childIndex < childrenCount; childIndex++)
+ {
+ process(result, children.item(childIndex), datas, suffix);
+ }
+ break;
+ }
+ }
- /**
- * TODO remove?
- */
- private static void processElementBasically(final Writer result, final Node node, final TagDataListById datas) throws Exception
- {
- processElementBasically(result, node, datas, "");
- }
+ /**
+ * TODO remove?
+ */
+ private static void processElementBasically(final Writer result, final Node node, final TagDataListById datas) throws Exception
+ {
+ processElementBasically(result, node, datas, "");
+ }
- /**
+ /**
*
*/
- private static void processElementBasically(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception
- {
- logger.debug("processElementBasically - started [{}]", node.getNodeName());
+ private static void processElementBasically(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception
+ {
+ logger.debug("processElementBasically - started [{}]", node.getNodeName());
- // Open the tag.
- result.append('<');
- result.append(node.getNodeName());
+ // Open the tag.
+ result.append('<');
+ result.append(node.getNodeName());
- // Build the tag attributes.
- // Attributes tagAttributes;
+ // Build the tag attributes.
+ // Attributes tagAttributes;
- result.append(processAttributes(node.getAttributes(), null, suffix));
+ result.append(processAttributes(node.getAttributes(), null, suffix));
- //
- if ((node.getChildNodes() == null) || (node.getChildNodes().getLength() == 0))
- {
- result.append(" />");
- }
- else
- {
- result.append('>');
+ //
+ if ((node.getChildNodes() == null) || (node.getChildNodes().getLength() == 0))
+ {
+ result.append(" />");
+ }
+ else
+ {
+ result.append('>');
- processChildren(result, node, datas, suffix);
+ processChildren(result, node, datas, suffix);
- result.append("");
- result.append(node.getNodeName());
- result.append('>');
- }
+ result.append("");
+ result.append(node.getNodeName());
+ result.append('>');
+ }
- logger.debug("processElementBasically - ended");
- }
+ logger.debug("processElementBasically - ended");
+ }
- /**
- * Processes a node that has dynamic content. Calls the appropriate code
- * generator method, depending on the tag.
- *
- * @param node
- * Current node.
- * @param attrs
- * The tag attributes.
- * @param idAttr
- * The ID.
- */
- private static void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagDataListById datas) throws Exception
+ /**
+ * Processes a node that has dynamic content. Calls the appropriate code
+ * generator method, depending on the tag.
+ *
+ * @param node
+ * Current node.
+ * @param attrs
+ * The tag attributes.
+ * @param idAttr
+ * The ID.
+ */
+ 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, "");
+ }
- /**
- * Processes a node that has dynamic content. Calls the appropriate code
- * generator method, depending on the tag.
- *
- * @param node
- * Current node.
- * @param attrs
- * The tag attributes.
- * @param idAttr
- * The ID.
- */
- 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();
+ /**
+ * Processes a node that has dynamic content. Calls the appropriate code
+ * generator method, depending on the tag.
+ *
+ * @param node
+ * Current node.
+ * @param attrs
+ * The tag attributes.
+ * @param idAttr
+ * The ID.
+ */
+ 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 idValue = idAttr.getNodeValue();
+ // String idValue = idAttr.getNodeValue();
- logger.debug("tag=" + tag);
+ logger.debug("tag=" + tag);
- // Get data of this id.
- TagData dataCore = datas.get(idAttr.getNodeValue());
+ // Get data of this id.
+ TagData dataCore = datas.get(idAttr.getNodeValue());
- if (dataCore == null)
- {
- processElementBasically(result, node, datas, suffix);
- }
- else if (dataCore instanceof SimpleTagData)
- {
- SimpleTagData data = (SimpleTagData) dataCore;
+ if (dataCore == null)
+ {
+ processElementBasically(result, node, datas, suffix);
+ }
+ else if (dataCore instanceof SimpleTagData)
+ {
+ SimpleTagData data = (SimpleTagData) dataCore;
- String theClass = data.attributes().getAttribute("class");
+ String theClass = data.attributes().getAttribute("class");
- if ((theClass == null) || (!theClass.equals("xid:nodisplay")))
- {
- // Open the tag.
- result.append("<");
- result.append(node.getNodeName());
+ if ((theClass == null) || (!theClass.equals("xid:nodisplay")))
+ {
+ // Open the tag.
+ result.append("<");
+ result.append(node.getNodeName());
- // Build attributes.
- result.append(processAttributes(attrs, data.attributes(), suffix));
+ // Build attributes.
+ result.append(processAttributes(attrs, data.attributes(), suffix));
- if (((node.getChildNodes() == null) || (node.getChildNodes().getLength() == 0)) && ((data == null) || (data.display() == null)))
- {
- // Close the tag.
- result.append(" />");
- }
- else
- {
- result.append('>');
+ if (((node.getChildNodes() == null) || (node.getChildNodes().getLength() == 0)) && ((data == null) || (data.display() == null)))
+ {
+ // Close the tag.
+ result.append(" />");
+ }
+ else
+ {
+ result.append('>');
- // CHANGED, cpm:
+ // CHANGED, cpm:
- // Insert data.
- if ((data == null) || (data.display() == null))
- {
- processChildren(result, node, datas, suffix);
- }
- else
- {
- result.append(data.display());
- }
+ // Insert data.
+ if ((data == null) || (data.display() == null))
+ {
+ processChildren(result, node, datas, suffix);
+ }
+ else
+ {
+ result.append(data.display());
+ }
- // Close the tag.
- result.append("");
- result.append(node.getNodeName());
- result.append('>');
- }
- }
- }
- else if (dataCore instanceof TagDataListByIndex)
- {
- TagDataListByIndex tags = (TagDataListByIndex) dataCore;
+ // Close the tag.
+ result.append("");
+ result.append(node.getNodeName());
+ result.append('>');
+ }
+ }
+ }
+ else if (dataCore instanceof TagDataListByIndex)
+ {
+ TagDataListByIndex tags = (TagDataListByIndex) dataCore;
- int nbLines = tags.size();
- for (int nLine = 0; nLine < nbLines; nLine++)
- {
- if (tags.elementAt(nLine) instanceof SimpleTagData)
- {
- SimpleTagData data = (SimpleTagData) tags.elementAt(nLine);
+ int nbLines = tags.size();
+ for (int nLine = 0; nLine < nbLines; nLine++)
+ {
+ if (tags.elementAt(nLine) instanceof SimpleTagData)
+ {
+ SimpleTagData data = (SimpleTagData) tags.elementAt(nLine);
- // Open the tag.
- result.append("<");
- result.append(node.getNodeName());
+ // Open the tag.
+ result.append("<");
+ result.append(node.getNodeName());
- result.append(processAttributes(attrs, data.attributes(), Integer.toString(nLine)));
+ result.append(processAttributes(attrs, data.attributes(), Integer.toString(nLine)));
- if (((node.getChildNodes() == null) || (node.getChildNodes().getLength() == 0)) && ((data == null) || (data.display() == null)))
- {
- // Close the tag.
- result.append(" />\n");
- }
- else
- {
- result.append('>');
+ if (((node.getChildNodes() == null) || (node.getChildNodes().getLength() == 0)) && ((data == null) || (data.display() == null)))
+ {
+ // Close the tag.
+ result.append(" />\n");
+ }
+ else
+ {
+ result.append('>');
- // CHANGED, cpm
+ // CHANGED, cpm
- // Insert data.
- if ((data == null) || (data.display() == null))
- {
- processChildren(result, node, datas, suffix);
- }
- else
- {
- result.append(data.display());
- }
+ // Insert data.
+ if ((data == null) || (data.display() == null))
+ {
+ processChildren(result, node, datas, suffix);
+ }
+ else
+ {
+ result.append(data.display());
+ }
- // Close the tag.
- result.append("");
- result.append(node.getNodeName());
- result.append(">\n");
- }
- }
- else
- {
- // Manage a Hashmap.
- TagDataListById data = (TagDataListById) tags.elementAt(nLine);
+ // Close the tag.
+ result.append("");
+ result.append(node.getNodeName());
+ result.append(">\n");
+ }
+ }
+ else
+ {
+ // Manage a Hashmap.
+ TagDataListById data = (TagDataListById) tags.elementAt(nLine);
- processElementWithId(result, node, attrs, idAttr, data, Integer.toString(nLine));
- result.append('\n');
- }
- }
- }
- else
- {
- logger.warn("Unknow type of IdDataId");
- }
+ processElementWithId(result, node, attrs, idAttr, data, Integer.toString(nLine));
+ result.append('\n');
+ }
+ }
+ }
+ else
+ {
+ logger.warn("Unknow type of IdDataId");
+ }
- //
- logger.debug("Exit");
- }
+ //
+ logger.debug("Exit");
+ }
}
diff --git a/src/fr/devinsy/xidyn/presenters/FilePresenter.java b/src/fr/devinsy/xidyn/presenters/FilePresenter.java
index 81a5fd8..7055428 100644
--- a/src/fr/devinsy/xidyn/presenters/FilePresenter.java
+++ b/src/fr/devinsy/xidyn/presenters/FilePresenter.java
@@ -33,233 +33,233 @@ import fr.devinsy.xidyn.utils.XidynUtils;
*/
public class FilePresenter extends StringPresenter
{
- private static Logger logger = LoggerFactory.getLogger(FilePresenter.class);
+ private static Logger logger = LoggerFactory.getLogger(FilePresenter.class);
- private File source;
- private String sourceFilePathname;
- private long sourceTime;
+ private File source;
+ private String sourceFilePathname;
+ private long sourceTime;
- /**
+ /**
*
*/
- public FilePresenter()
- {
- setSource((String) null);
- }
+ public FilePresenter()
+ {
+ setSource((String) null);
+ }
- /**
+ /**
*
*/
- public FilePresenter(final File source)
- {
- setSource(source);
- }
+ public FilePresenter(final File source)
+ {
+ setSource(source);
+ }
- /**
+ /**
*
*/
- public FilePresenter(final String filePathname)
- {
- setSource(filePathname);
- }
+ public FilePresenter(final String filePathname)
+ {
+ setSource(filePathname);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public StringBuffer dynamize() throws Exception
- {
- StringBuffer result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StringBuffer dynamize() throws Exception
+ {
+ StringBuffer result;
- //
- update();
+ //
+ update();
- //
- result = super.dynamize();
+ //
+ result = super.dynamize();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * No need to be synchronized.
- *
- * {@inheritDoc}
- */
- @Override
- public StringBuffer dynamize(final TagDataManager data) throws Exception
- {
- StringBuffer result;
+ /**
+ * No need to be synchronized.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public StringBuffer dynamize(final TagDataManager data) throws Exception
+ {
+ StringBuffer result;
- logger.info("dynamize file [" + this.sourceFilePathname + "]");
+ logger.info("dynamize file [" + this.sourceFilePathname + "]");
- //
- update();
+ //
+ update();
- // Build the web page.
- result = super.dynamize(data);
+ // Build the web page.
+ result = super.dynamize(data);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public File getFile()
- {
- File result;
+ public File getFile()
+ {
+ File result;
- result = this.source;
+ result = this.source;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public String getSource()
- {
- String result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getSource()
+ {
+ String result;
- result = this.sourceFilePathname;
+ result = this.sourceFilePathname;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAvailable()
- {
- boolean result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAvailable()
+ {
+ boolean result;
- if ((this.source == null) || (!this.source.exists()))
- {
- result = false;
- }
- else
- {
- result = true;
- }
+ if ((this.source == null) || (!this.source.exists()))
+ {
+ result = false;
+ }
+ else
+ {
+ result = true;
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isOutdated() throws Exception
- {
- boolean result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOutdated() throws Exception
+ {
+ boolean result;
- //
- if (super.isOutdated())
- {
- result = true;
- }
- else if (this.sourceTime == this.source.lastModified())
- {
- result = true;
- }
- else
- {
- result = false;
- }
+ //
+ if (super.isOutdated())
+ {
+ result = true;
+ }
+ else if (this.sourceTime == this.source.lastModified())
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public void setSource(final File source)
- {
- if (source == null)
- {
- super.setSource(null);
- this.source = null;
- this.sourceFilePathname = null;
- this.sourceTime = 0;
- setSource((String) null);
- }
- else
- {
- this.source = source;
- this.sourceFilePathname = source.getAbsolutePath();
- this.sourceTime = 0;
- super.setSource(null);
- }
- }
+ public void setSource(final File source)
+ {
+ if (source == null)
+ {
+ super.setSource(null);
+ this.source = null;
+ this.sourceFilePathname = null;
+ this.sourceTime = 0;
+ setSource((String) null);
+ }
+ else
+ {
+ this.source = source;
+ this.sourceFilePathname = source.getAbsolutePath();
+ this.sourceTime = 0;
+ super.setSource(null);
+ }
+ }
- /**
- * @throws Exception
- *
- */
- @Override
- public void setSource(final String source)
- {
- //
- File file;
- if (source == null)
- {
- file = null;
- }
- else if (source.matches("file://.+"))
- {
- try
- {
- file = new File(new URI(source));
- }
- catch (URISyntaxException exception)
- {
- exception.printStackTrace();
- throw new IllegalArgumentException("Bad URI argument.", exception);
- }
- }
- else
- {
- file = new File(source);
- }
+ /**
+ * @throws Exception
+ *
+ */
+ @Override
+ public void setSource(final String source)
+ {
+ //
+ File file;
+ if (source == null)
+ {
+ file = null;
+ }
+ else if (source.matches("file://.+"))
+ {
+ try
+ {
+ file = new File(new URI(source));
+ }
+ catch (URISyntaxException exception)
+ {
+ exception.printStackTrace();
+ throw new IllegalArgumentException("Bad URI argument.", exception);
+ }
+ }
+ else
+ {
+ file = new File(source);
+ }
- //
- setSource(file);
- }
+ //
+ setSource(file);
+ }
- /**
- * @throws Exception
- */
- @Override
- public void update() throws Exception
- {
- //
- if (this.source == null)
- {
- String errorMessage = "source not defined";
- logger.error(errorMessage);
- throw new NullPointerException(errorMessage);
- }
- else if (!this.source.exists())
- {
- String errorMessage = "source file defined but not found (" + this.sourceFilePathname + ")";
- logger.error(errorMessage);
- throw new Exception(errorMessage);
- }
- else
- {
- long currentTime = this.source.lastModified();
- if ((super.getSource() == null) || (this.sourceTime != currentTime))
- {
- super.setSource(XidynUtils.load(this.source));
- this.sourceTime = currentTime;
- }
- }
- }
+ /**
+ * @throws Exception
+ */
+ @Override
+ public void update() throws Exception
+ {
+ //
+ if (this.source == null)
+ {
+ String errorMessage = "source not defined";
+ logger.error(errorMessage);
+ throw new NullPointerException(errorMessage);
+ }
+ else if (!this.source.exists())
+ {
+ String errorMessage = "source file defined but not found (" + this.sourceFilePathname + ")";
+ logger.error(errorMessage);
+ throw new Exception(errorMessage);
+ }
+ else
+ {
+ long currentTime = this.source.lastModified();
+ if ((super.getSource() == null) || (this.sourceTime != currentTime))
+ {
+ super.setSource(XidynUtils.load(this.source));
+ this.sourceTime = currentTime;
+ }
+ }
+ }
}
diff --git a/src/fr/devinsy/xidyn/presenters/FilePresenters.java b/src/fr/devinsy/xidyn/presenters/FilePresenters.java
index b9ae775..37dc700 100644
--- a/src/fr/devinsy/xidyn/presenters/FilePresenters.java
+++ b/src/fr/devinsy/xidyn/presenters/FilePresenters.java
@@ -28,163 +28,163 @@ import org.slf4j.LoggerFactory;
*/
public class FilePresenters extends Vector
{
- private static final long serialVersionUID = 7058868685681354293L;
- private static Logger logger = LoggerFactory.getLogger(FilePresenters.class);
+ private static final long serialVersionUID = 7058868685681354293L;
+ private static Logger logger = LoggerFactory.getLogger(FilePresenters.class);
- /**
+ /**
*
*/
- public FilePresenters()
- {
- super();
- }
+ public FilePresenters()
+ {
+ super();
+ }
- /**
+ /**
*
*/
- public FilePresenters(final FilePresenters source)
- {
- super();
- for (FilePresenter presenter : source)
- {
- this.add(presenter);
- }
- }
+ public FilePresenters(final FilePresenters source)
+ {
+ super();
+ for (FilePresenter presenter : source)
+ {
+ this.add(presenter);
+ }
+ }
- /**
+ /**
*
*/
- public boolean exists(final String source)
- {
- boolean result;
+ public boolean exists(final String source)
+ {
+ boolean result;
- if (this.getBySource(source) == null)
- {
- result = false;
- }
- else
- {
- result = true;
- }
+ if (this.getBySource(source) == null)
+ {
+ result = false;
+ }
+ else
+ {
+ result = true;
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public FilePresenter getByIndex(final int id)
- {
- FilePresenter result;
+ public FilePresenter getByIndex(final int id)
+ {
+ FilePresenter result;
- result = this.get(id);
+ result = this.get(id);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public FilePresenter getBySource(final String source)
- {
- FilePresenter result;
+ public FilePresenter getBySource(final String source)
+ {
+ FilePresenter result;
- if (source == null)
- {
- result = null;
- }
- else
- {
- result = null;
- boolean ended = false;
- int presenterIndex = 0;
- while (!ended)
- {
- if (presenterIndex < this.size())
- {
- FilePresenter presenter = this.get(presenterIndex);
+ if (source == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = null;
+ boolean ended = false;
+ int presenterIndex = 0;
+ while (!ended)
+ {
+ if (presenterIndex < this.size())
+ {
+ FilePresenter presenter = this.get(presenterIndex);
- if (presenter.getSource().equals(source))
- {
- result = presenter;
- ended = true;
- }
- else
- {
- presenterIndex += 1;
- }
- }
- else
- {
- ended = true;
- result = null;
- }
- }
- }
+ if (presenter.getSource().equals(source))
+ {
+ result = presenter;
+ ended = true;
+ }
+ else
+ {
+ presenterIndex += 1;
+ }
+ }
+ else
+ {
+ ended = true;
+ result = null;
+ }
+ }
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public int getIndexOf(final String source)
- {
- int result;
+ public int getIndexOf(final String source)
+ {
+ int result;
- if (source == null)
- {
- result = -1;
- }
- else
- {
- result = -1;
- boolean ended = false;
- int presenterIndex = 0;
- while (!ended)
- {
- if (presenterIndex < this.size())
- {
- FilePresenter presenter = this.get(presenterIndex);
+ if (source == null)
+ {
+ result = -1;
+ }
+ else
+ {
+ result = -1;
+ boolean ended = false;
+ int presenterIndex = 0;
+ while (!ended)
+ {
+ if (presenterIndex < this.size())
+ {
+ FilePresenter presenter = this.get(presenterIndex);
- if (presenter.getSource().equals(source))
- {
- result = presenterIndex;
- ended = true;
- }
- else
- {
- presenterIndex += 1;
- }
- }
- else
- {
- ended = true;
- result = -1;
- }
- }
- }
+ if (presenter.getSource().equals(source))
+ {
+ result = presenterIndex;
+ ended = true;
+ }
+ else
+ {
+ presenterIndex += 1;
+ }
+ }
+ else
+ {
+ ended = true;
+ result = -1;
+ }
+ }
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- @Override
- public String toString()
- {
- String result;
+ @Override
+ public String toString()
+ {
+ String result;
- result = "";
+ result = "";
- //
- return (result);
- }
+ //
+ return (result);
+ }
}
// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/xidyn/presenters/FilePresentersProxy.java b/src/fr/devinsy/xidyn/presenters/FilePresentersProxy.java
index 4cd7de6..d1c4ec1 100644
--- a/src/fr/devinsy/xidyn/presenters/FilePresentersProxy.java
+++ b/src/fr/devinsy/xidyn/presenters/FilePresentersProxy.java
@@ -26,61 +26,61 @@ import org.slf4j.LoggerFactory;
*/
public class FilePresentersProxy
{
- private static Logger logger = LoggerFactory.getLogger(FilePresentersProxy.class);
+ private static Logger logger = LoggerFactory.getLogger(FilePresentersProxy.class);
- private static FilePresentersProxy instance = null;
- private FilePresenters presenters = null;
+ private static FilePresentersProxy instance = null;
+ private FilePresenters presenters = null;
- /**
+ /**
*
*/
- protected FilePresentersProxy() throws Exception
- {
- this.presenters = new FilePresenters();
- }
+ protected FilePresentersProxy() throws Exception
+ {
+ this.presenters = new FilePresenters();
+ }
- /**
+ /**
*
*/
- public FilePresenter getBySource(final String source) throws Exception
- {
- FilePresenter result;
+ public FilePresenter getBySource(final String source) throws Exception
+ {
+ FilePresenter result;
- if (source == null)
- {
- result = null;
- }
- else
- {
- result = this.presenters.getBySource(source);
- if (result == null)
- {
- result = new FilePresenter(source);
- this.presenters.add(result);
- }
- }
+ if (source == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = this.presenters.getBySource(source);
+ if (result == null)
+ {
+ result = new FilePresenter(source);
+ this.presenters.add(result);
+ }
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public static FilePresentersProxy instance() throws Exception
- {
- FilePresentersProxy result;
+ public static FilePresentersProxy instance() throws Exception
+ {
+ FilePresentersProxy result;
- if (FilePresentersProxy.instance == null)
- {
- instance = new FilePresentersProxy();
- }
+ if (FilePresentersProxy.instance == null)
+ {
+ instance = new FilePresentersProxy();
+ }
- result = instance;
+ result = instance;
- //
- return (result);
- }
+ //
+ return (result);
+ }
}
// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/xidyn/presenters/GenericPresenter.java b/src/fr/devinsy/xidyn/presenters/GenericPresenter.java
index 248fb56..2bdcf9f 100644
--- a/src/fr/devinsy/xidyn/presenters/GenericPresenter.java
+++ b/src/fr/devinsy/xidyn/presenters/GenericPresenter.java
@@ -30,226 +30,226 @@ import fr.devinsy.xidyn.data.TagDataManager;
*/
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;
- /**
+ /**
*
*/
- public GenericPresenter(final Document source)
- {
- if (source == null)
- {
- throw new NullPointerException("source is null");
- }
- else
- {
- this.presenter = PresenterFactory.create(source);
- }
- }
+ public GenericPresenter(final Document source)
+ {
+ if (source == null)
+ {
+ throw new NullPointerException("source is null");
+ }
+ else
+ {
+ this.presenter = PresenterFactory.create(source);
+ }
+ }
- /**
+ /**
*
*/
- public GenericPresenter(final File source)
- {
- if (source == null)
- {
- throw new NullPointerException("source is null");
- }
- else
- {
- this.presenter = PresenterFactory.create(source);
- }
- }
+ public GenericPresenter(final File source)
+ {
+ if (source == null)
+ {
+ throw new NullPointerException("source is null");
+ }
+ else
+ {
+ this.presenter = PresenterFactory.create(source);
+ }
+ }
- /**
+ /**
*
*/
- public GenericPresenter(final String source)
- {
- if (source == null)
- {
- throw new NullPointerException("source is null");
- }
- else
- {
- this.presenter = PresenterFactory.create(source);
- }
- }
+ public GenericPresenter(final String source)
+ {
+ if (source == null)
+ {
+ throw new NullPointerException("source is null");
+ }
+ else
+ {
+ this.presenter = PresenterFactory.create(source);
+ }
+ }
- /**
+ /**
*
*/
- public GenericPresenter(final URL source)
- {
- if (source == null)
- {
- throw new NullPointerException("source is null");
- }
- else
- {
- this.presenter = PresenterFactory.create(source);
- }
- }
+ public GenericPresenter(final URL source)
+ {
+ if (source == null)
+ {
+ throw new NullPointerException("source is null");
+ }
+ else
+ {
+ this.presenter = PresenterFactory.create(source);
+ }
+ }
- /**
+ /**
*
*/
- @Override
- public StringBuffer dynamize() throws Exception
- {
- StringBuffer result;
+ @Override
+ public StringBuffer dynamize() throws Exception
+ {
+ StringBuffer result;
- result = this.presenter.dynamize();
+ result = this.presenter.dynamize();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- @Override
- public StringBuffer dynamize(final TagDataManager datas) throws Exception
- {
- StringBuffer result;
+ @Override
+ public StringBuffer dynamize(final TagDataManager datas) throws Exception
+ {
+ StringBuffer result;
- result = this.presenter.dynamize(datas);
+ result = this.presenter.dynamize(datas);
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- @Override
- public Object getSource()
- {
- Object result;
+ @Override
+ public Object getSource()
+ {
+ Object result;
- result = this.presenter.getSource();
+ result = this.presenter.getSource();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAvailable()
- {
- boolean result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAvailable()
+ {
+ boolean result;
- result = this.presenter.isAvailable();
+ result = this.presenter.isAvailable();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- @Override
- public boolean isOutdated() throws Exception
- {
- boolean result;
+ @Override
+ public boolean isOutdated() throws Exception
+ {
+ boolean result;
- result = this.presenter.isOutdated();
+ result = this.presenter.isOutdated();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- */
- public void setSource(final Document source)
- {
- if (source == null)
- {
- throw new NullPointerException("source is null");
- }
- else
- {
- this.presenter = PresenterFactory.create(source);
- }
- }
+ /**
+ *
+ * @param source
+ */
+ public void setSource(final Document source)
+ {
+ if (source == null)
+ {
+ throw new NullPointerException("source is null");
+ }
+ else
+ {
+ this.presenter = PresenterFactory.create(source);
+ }
+ }
- /**
- *
- * @param source
- */
- public void setSource(final File source)
- {
- if (source == null)
- {
- throw new NullPointerException("source is null");
- }
- else
- {
- this.presenter = PresenterFactory.create(source);
- }
- }
+ /**
+ *
+ * @param source
+ */
+ public void setSource(final File source)
+ {
+ if (source == null)
+ {
+ throw new NullPointerException("source is null");
+ }
+ else
+ {
+ this.presenter = PresenterFactory.create(source);
+ }
+ }
- /**
- *
- * @param source
- */
- public void setSource(final String source)
- {
- if (source == null)
- {
- throw new NullPointerException("source is null");
- }
- else
- {
- this.presenter = PresenterFactory.create(source);
- }
- }
+ /**
+ *
+ * @param source
+ */
+ public void setSource(final String source)
+ {
+ if (source == null)
+ {
+ throw new NullPointerException("source is null");
+ }
+ else
+ {
+ this.presenter = PresenterFactory.create(source);
+ }
+ }
- /**
- *
- * @param source
- */
- public void setSource(final URL source)
- {
- if (source == null)
- {
- throw new NullPointerException("source is null");
- }
- else
- {
- this.presenter = PresenterFactory.create(source);
- }
- }
+ /**
+ *
+ * @param source
+ */
+ public void setSource(final URL source)
+ {
+ if (source == null)
+ {
+ throw new NullPointerException("source is null");
+ }
+ else
+ {
+ this.presenter = PresenterFactory.create(source);
+ }
+ }
- /**
+ /**
*
*/
- public String toString(final String language) throws Exception
- {
- String result;
+ public String toString(final String language) throws Exception
+ {
+ String result;
- result = this.presenter.toString();
+ result = this.presenter.toString();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- @Override
- public void update() throws Exception
- {
- this.presenter.update();
+ @Override
+ public void update() throws Exception
+ {
+ this.presenter.update();
- }
+ }
}
// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/xidyn/presenters/Presenter.java b/src/fr/devinsy/xidyn/presenters/Presenter.java
index 1e94dbc..529cf26 100644
--- a/src/fr/devinsy/xidyn/presenters/Presenter.java
+++ b/src/fr/devinsy/xidyn/presenters/Presenter.java
@@ -30,43 +30,43 @@ import fr.devinsy.xidyn.data.TagDataManager;
*/
public interface Presenter
{
- /**
- *
- * @param datas
- * @return
- * @throws Exception
- */
- public StringBuffer dynamize() throws Exception;
+ /**
+ *
+ * @param datas
+ * @return
+ * @throws Exception
+ */
+ public StringBuffer dynamize() throws Exception;
- /**
- *
- * @param datas
- * @return
- * @throws Exception
- */
- public StringBuffer dynamize(final TagDataManager datas) throws Exception;
+ /**
+ *
+ * @param datas
+ * @return
+ * @throws Exception
+ */
+ public StringBuffer dynamize(final TagDataManager datas) throws Exception;
- /**
- *
- * @return
- */
- public Object getSource();
+ /**
+ *
+ * @return
+ */
+ public Object getSource();
- /**
- * This method check if the source exists and it is readable.
- *
- * @return
- */
- public boolean isAvailable();
+ /**
+ * This method check if the source exists and it is readable.
+ *
+ * @return
+ */
+ public boolean isAvailable();
- /**
- *
- * @return
- */
- public boolean isOutdated() throws Exception;
+ /**
+ *
+ * @return
+ */
+ public boolean isOutdated() throws Exception;
- /**
+ /**
*
*/
- public void update() throws Exception;
+ public void update() throws Exception;
}
diff --git a/src/fr/devinsy/xidyn/presenters/PresenterFactory.java b/src/fr/devinsy/xidyn/presenters/PresenterFactory.java
index 7e532c1..64db319 100644
--- a/src/fr/devinsy/xidyn/presenters/PresenterFactory.java
+++ b/src/fr/devinsy/xidyn/presenters/PresenterFactory.java
@@ -32,246 +32,246 @@ import fr.devinsy.xidyn.utils.cache.Cache;
*/
public class PresenterFactory
{
- /**
- * http://thecodersbreakfast.net/index.php?post/2008/02/25/26-de-la-bonne-
- * implementation-du-singleton-en-java
- */
- private static class SingletonHolder
- {
- private final static PresenterFactory INSTANCE = new PresenterFactory();
- }
+ /**
+ * http://thecodersbreakfast.net/index.php?post/2008/02/25/26-de-la-bonne-
+ * implementation-du-singleton-en-java
+ */
+ private static class SingletonHolder
+ {
+ private final static PresenterFactory INSTANCE = new PresenterFactory();
+ }
- private static Logger logger = LoggerFactory.getLogger(PresenterFactory.class);
+ private static Logger logger = LoggerFactory.getLogger(PresenterFactory.class);
- private Cache cache;
+ private Cache cache;
- /**
+ /**
*
*/
- private PresenterFactory()
- {
- this.cache = new Cache();
- }
+ private PresenterFactory()
+ {
+ this.cache = new Cache();
+ }
- /**
+ /**
*
*/
- public void clear()
- {
- this.cache.clear();
- }
+ public void clear()
+ {
+ this.cache.clear();
+ }
- /**
- *
- * @param source
- * @return
- */
- public Presenter get(final Document source)
- {
- Presenter result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public Presenter get(final Document source)
+ {
+ Presenter result;
- result = this.cache.get(source);
+ result = this.cache.get(source);
- if (result == null)
- {
- result = create(source);
- this.cache.put(source, result);
- }
+ if (result == null)
+ {
+ result = create(source);
+ this.cache.put(source, result);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @return
- */
- public Presenter get(final File source)
- {
- Presenter result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public Presenter get(final File source)
+ {
+ Presenter result;
- result = this.cache.get(source);
+ result = this.cache.get(source);
- if (result == null)
- {
- result = create(source);
- this.cache.put(source, result);
- }
+ if (result == null)
+ {
+ result = create(source);
+ this.cache.put(source, result);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @return
- */
- public Presenter get(final String source)
- {
- Presenter result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public Presenter get(final String source)
+ {
+ Presenter result;
- result = this.cache.get(source);
+ result = this.cache.get(source);
- if (result == null)
- {
- result = create(source);
- this.cache.put(source, result);
- }
+ if (result == null)
+ {
+ result = create(source);
+ this.cache.put(source, result);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @return
- */
- public Presenter get(final URL source)
- {
- Presenter result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public Presenter get(final URL source)
+ {
+ Presenter result;
- result = this.cache.get(source);
+ result = this.cache.get(source);
- if (result == null)
- {
- result = create(source);
- this.cache.put(source, result);
- }
+ if (result == null)
+ {
+ result = create(source);
+ this.cache.put(source, result);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @return
- */
- public int size()
- {
- int result;
+ /**
+ *
+ * @return
+ */
+ public int size()
+ {
+ int result;
- result = this.cache.size();
+ result = this.cache.size();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @return
- */
- public static Presenter create(final Document source)
- {
- Presenter result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public static Presenter create(final Document source)
+ {
+ Presenter result;
- if (source == null)
- {
- result = null;
- }
- else
- {
- result = new DomPresenter(source);
- }
+ if (source == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = new DomPresenter(source);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @return
- */
- public static Presenter create(final File source)
- {
- Presenter result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public static Presenter create(final File source)
+ {
+ Presenter result;
- if (source == null)
- {
- result = null;
- }
- else
- {
- result = new FilePresenter(source);
- }
+ if (source == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = new FilePresenter(source);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @return
- */
- public static Presenter create(final String source)
- {
- Presenter result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public static Presenter create(final String source)
+ {
+ Presenter result;
- if (source == null)
- {
- result = null;
- }
- else if (source.startsWith("file://"))
- {
- result = new FilePresenter(source);
- }
- else if (source.matches(".+://.+"))
- {
- result = new URLPresenter(source);
- }
- else if (source.startsWith("/"))
- {
- if (new File(source).exists())
- {
- result = new FilePresenter(source);
- }
- else
- {
- result = new URLPresenter(source);
- }
- }
- else
- {
- result = new StringPresenter(source);
- }
+ if (source == null)
+ {
+ result = null;
+ }
+ else if (source.startsWith("file://"))
+ {
+ result = new FilePresenter(source);
+ }
+ else if (source.matches(".+://.+"))
+ {
+ result = new URLPresenter(source);
+ }
+ else if (source.startsWith("/"))
+ {
+ if (new File(source).exists())
+ {
+ result = new FilePresenter(source);
+ }
+ else
+ {
+ result = new URLPresenter(source);
+ }
+ }
+ else
+ {
+ result = new StringPresenter(source);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param source
- * @return
- */
- public static Presenter create(final URL source)
- {
- Presenter result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public static Presenter create(final URL source)
+ {
+ Presenter result;
- if (source == null)
- {
- result = null;
- }
- else
- {
- result = new URLPresenter(source);
- }
+ if (source == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = new URLPresenter(source);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @return
- */
- public static PresenterFactory instance()
- {
- return SingletonHolder.INSTANCE;
- }
+ /**
+ *
+ * @return
+ */
+ public static PresenterFactory instance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
}
diff --git a/src/fr/devinsy/xidyn/presenters/PresenterUtils.java b/src/fr/devinsy/xidyn/presenters/PresenterUtils.java
index 2be9362..445b08f 100644
--- a/src/fr/devinsy/xidyn/presenters/PresenterUtils.java
+++ b/src/fr/devinsy/xidyn/presenters/PresenterUtils.java
@@ -32,121 +32,121 @@ import fr.devinsy.xidyn.data.TagDataManager;
*/
public class PresenterUtils
{
- private static Logger logger = LoggerFactory.getLogger(PresenterUtils.class);
+ private static Logger logger = LoggerFactory.getLogger(PresenterUtils.class);
- /**
+ /**
*
*/
- private PresenterUtils()
- {
- }
+ private PresenterUtils()
+ {
+ }
- /**
- *
- * @param doc
- * @param data
- * @return
- * @throws Exception
- */
- public static StringBuffer dynamize(final Document doc, final TagDataListById data) throws Exception
- {
- StringBuffer result;
+ /**
+ *
+ * @param doc
+ * @param data
+ * @return
+ * @throws Exception
+ */
+ public static StringBuffer dynamize(final Document doc, final TagDataListById data) throws Exception
+ {
+ StringBuffer result;
- result = DomPresenterCore.dynamize(doc, data);
+ result = DomPresenterCore.dynamize(doc, data);
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- *
- * @param doc
- * @param data
- * @return
- * @throws Exception
- */
- public static StringBuffer dynamize(final Document doc, final TagDataManager data) throws Exception
- {
- StringBuffer result;
+ /**
+ *
+ * @param doc
+ * @param data
+ * @return
+ * @throws Exception
+ */
+ public static StringBuffer dynamize(final Document doc, final TagDataManager data) throws Exception
+ {
+ StringBuffer result;
- result = DomPresenterCore.dynamize(doc, data);
+ result = DomPresenterCore.dynamize(doc, data);
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * Dynamize a file without data.
- */
- public static StringBuffer dynamize(final File source) throws Exception
- {
- StringBuffer result;
+ /**
+ * Dynamize a file without data.
+ */
+ public static StringBuffer dynamize(final File source) throws Exception
+ {
+ StringBuffer result;
- FilePresenter presenter = new FilePresenter(source);
+ FilePresenter presenter = new FilePresenter(source);
- result = presenter.dynamize((TagDataManager) null);
+ result = presenter.dynamize((TagDataManager) null);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * Dynamize a file.
- */
- public static StringBuffer dynamize(final File source, final TagDataManager datas) throws Exception
- {
- StringBuffer result;
+ /**
+ * Dynamize a file.
+ */
+ public static StringBuffer dynamize(final File source, final TagDataManager datas) throws Exception
+ {
+ StringBuffer result;
- FilePresenter presenter = new FilePresenter(source);
+ FilePresenter presenter = new FilePresenter(source);
- result = presenter.dynamize(datas);
+ result = presenter.dynamize(datas);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * Dynamize a string with HTML in, or with file path name in, or with URL
- * in.
- */
- public static StringBuffer dynamize(final String source, final TagDataManager datas) throws Exception
- {
- StringBuffer result;
+ /**
+ * Dynamize a string with HTML in, or with file path name in, or with URL
+ * in.
+ */
+ public static StringBuffer dynamize(final String source, final TagDataManager datas) throws Exception
+ {
+ StringBuffer result;
- Presenter presenter = PresenterFactory.create(source);
+ Presenter presenter = PresenterFactory.create(source);
- result = presenter.dynamize(datas);
+ result = presenter.dynamize(datas);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- *
- * @param source
- * @return
- */
- public static boolean hasHtmlTag(final String source)
- {
- boolean result;
+ /**
+ *
+ * @param source
+ * @return
+ */
+ public static boolean hasHtmlTag(final String source)
+ {
+ boolean result;
- if (source == null)
- {
- result = false;
- }
- else
- {
- if (source.matches("<[hH][tT][mM][lL]>"))
- {
- result = true;
- }
- else
- {
- result = false;
- }
- }
+ if (source == null)
+ {
+ result = false;
+ }
+ else
+ {
+ if (source.matches("<[hH][tT][mM][lL]>"))
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
}
diff --git a/src/fr/devinsy/xidyn/presenters/StringPresenter.java b/src/fr/devinsy/xidyn/presenters/StringPresenter.java
index 1da1fe3..f7c435d 100644
--- a/src/fr/devinsy/xidyn/presenters/StringPresenter.java
+++ b/src/fr/devinsy/xidyn/presenters/StringPresenter.java
@@ -32,204 +32,204 @@ import fr.devinsy.xidyn.utils.XidynUtils;
*/
public class StringPresenter implements Presenter
{
- private static Logger logger = LoggerFactory.getLogger(StringPresenter.class);
+ private static Logger logger = LoggerFactory.getLogger(StringPresenter.class);
- private String source;
- private String doctype;
- private Document dom;
+ private String source;
+ private String doctype;
+ private Document dom;
- /**
+ /**
*
*/
- public StringPresenter()
- {
- setSource("");
- }
+ public StringPresenter()
+ {
+ setSource("");
+ }
- /**
+ /**
*
*/
- public StringPresenter(final String html)
- {
- setSource(html);
- }
+ public StringPresenter(final String html)
+ {
+ setSource(html);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public StringBuffer dynamize() throws Exception
- {
- StringBuffer result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StringBuffer dynamize() throws Exception
+ {
+ StringBuffer result;
- result = new StringBuffer(this.source);
+ result = new StringBuffer(this.source);
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public StringBuffer dynamize(final TagDataManager data) throws Exception
- {
- StringBuffer result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StringBuffer dynamize(final TagDataManager data) throws Exception
+ {
+ StringBuffer result;
- // Build the DOM.
- if (this.dom == null)
- {
- // Build the source HTML.
- String sourceHtml;
- if (this.source == null)
- {
- String errorMessage = "source not defined";
- logger.error(errorMessage);
- result = null;
- throw new Exception(errorMessage);
- }
- else
- {
- this.doctype = XidynUtils.extractDoctype(this.source);
+ // Build the DOM.
+ if (this.dom == null)
+ {
+ // Build the source HTML.
+ String sourceHtml;
+ if (this.source == null)
+ {
+ String errorMessage = "source not defined";
+ logger.error(errorMessage);
+ result = null;
+ throw new Exception(errorMessage);
+ }
+ else
+ {
+ this.doctype = XidynUtils.extractDoctype(this.source);
- if (this.doctype == null)
- {
- StringBuffer buffer = new StringBuffer(this.source.length() + 100);
- buffer.append("\n");
- buffer.append(this.source);
- buffer.append("");
- sourceHtml = buffer.toString();
- }
- else
- {
- sourceHtml = this.source;
- }
- }
+ if (this.doctype == null)
+ {
+ StringBuffer buffer = new StringBuffer(this.source.length() + 100);
+ buffer.append("\n");
+ buffer.append(this.source);
+ buffer.append("");
+ sourceHtml = buffer.toString();
+ }
+ else
+ {
+ sourceHtml = this.source;
+ }
+ }
- // StringBufferInputStream is deprecated so we use another solution.
- // (see
- // http://www.developpez.net/forums/archive/index.php/t-14101.html).
- this.dom = XidynUtils.buildDom(sourceHtml);
- XidynUtils.addMetaTag(this.dom, "generator", "XIDYN");
- }
+ // StringBufferInputStream is deprecated so we use another solution.
+ // (see
+ // http://www.developpez.net/forums/archive/index.php/t-14101.html).
+ this.dom = XidynUtils.buildDom(sourceHtml);
+ XidynUtils.addMetaTag(this.dom, "generator", "XIDYN");
+ }
- //
- if (data == null)
- {
- result = dynamize();
- }
- else
- {
- //
- StringWriter htmlCode = new StringWriter(XidynUtils.estimatedTargetLength(this.source.length()));
- if ((this.doctype != null))
- {
- htmlCode.write(this.doctype);
- }
+ //
+ if (data == null)
+ {
+ result = dynamize();
+ }
+ else
+ {
+ //
+ StringWriter htmlCode = new StringWriter(XidynUtils.estimatedTargetLength(this.source.length()));
+ if ((this.doctype != null))
+ {
+ htmlCode.write(this.doctype);
+ }
- DomPresenterCore.dynamize(htmlCode, this.dom, data);
- StringBuffer htmlTarget = htmlCode.getBuffer();
+ DomPresenterCore.dynamize(htmlCode, this.dom, data);
+ StringBuffer htmlTarget = htmlCode.getBuffer();
- //
- if (htmlTarget == null)
- {
- result = null;
- }
- else if (this.doctype != null)
- {
- result = htmlTarget;
- }
- else
- {
- String bodyContent = XidynUtils.extractBodyContent(htmlTarget);
+ //
+ if (htmlTarget == null)
+ {
+ result = null;
+ }
+ else if (this.doctype != null)
+ {
+ result = htmlTarget;
+ }
+ else
+ {
+ String bodyContent = XidynUtils.extractBodyContent(htmlTarget);
- if (bodyContent == null)
- {
- result = null;
- }
- else
- {
- result = new StringBuffer(bodyContent);
- }
- }
- }
+ if (bodyContent == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = new StringBuffer(bodyContent);
+ }
+ }
+ }
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public String getSource()
- {
- String result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getSource()
+ {
+ String result;
- result = this.source;
+ result = this.source;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAvailable()
- {
- boolean result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAvailable()
+ {
+ boolean result;
- if (this.source == null)
- {
- result = false;
- }
- else
- {
- result = true;
- }
+ if (this.source == null)
+ {
+ result = false;
+ }
+ else
+ {
+ result = true;
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isOutdated() throws Exception
- {
- boolean result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOutdated() throws Exception
+ {
+ boolean result;
- if (this.dom == null)
- {
- result = true;
- }
- else
- {
- result = false;
- }
+ if (this.dom == null)
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public void setSource(final String html)
- {
- this.source = html;
- this.doctype = null;
- this.dom = null;
- }
+ public void setSource(final String html)
+ {
+ this.source = html;
+ this.doctype = null;
+ this.dom = null;
+ }
- /**
+ /**
*
*/
- @Override
- public void update() throws Exception
- {
- // Nothing to do.
- }
+ @Override
+ public void update() throws Exception
+ {
+ // Nothing to do.
+ }
}
diff --git a/src/fr/devinsy/xidyn/presenters/TranslatorPresenter.java b/src/fr/devinsy/xidyn/presenters/TranslatorPresenter.java
index e2d891e..9a0fc6f 100644
--- a/src/fr/devinsy/xidyn/presenters/TranslatorPresenter.java
+++ b/src/fr/devinsy/xidyn/presenters/TranslatorPresenter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2006-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2016 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -29,323 +29,323 @@ import fr.devinsy.xidyn.data.TagDataManager;
*/
public class TranslatorPresenter implements Presenter
{
- private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TranslatorPresenter.class);
- private String defaultSource;
- private HashMap presenters;
+ private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TranslatorPresenter.class);
+ private String defaultSource;
+ private HashMap presenters;
- /**
+ /**
*
*/
- public TranslatorPresenter(final String defaultSource)
- {
+ public TranslatorPresenter(final String defaultSource)
+ {
- if (defaultSource == null)
- {
- throw new NullPointerException("defaultSource is null");
- }
- else
- {
- this.defaultSource = defaultSource;
- this.presenters = new HashMap();
- }
- }
+ if (defaultSource == null)
+ {
+ throw new NullPointerException("defaultSource is null");
+ }
+ else
+ {
+ this.defaultSource = defaultSource;
+ this.presenters = new HashMap();
+ }
+ }
- /**
+ /**
*
*/
- @Override
- public StringBuffer dynamize() throws Exception
- {
- StringBuffer result;
+ @Override
+ public StringBuffer dynamize() throws Exception
+ {
+ StringBuffer result;
- Presenter presenter = getPresenter((String) null);
- if (presenter == null)
- {
- result = null;
- }
- else
- {
- result = presenter.dynamize();
- }
+ Presenter presenter = getPresenter((String) null);
+ if (presenter == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = presenter.dynamize();
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public StringBuffer dynamize(final Locale locale) throws Exception
- {
- StringBuffer result;
+ public StringBuffer dynamize(final Locale locale) throws Exception
+ {
+ StringBuffer result;
- //
- String language;
- if (locale == null)
- {
- language = null;
- }
- else
- {
- language = locale.getLanguage();
- }
+ //
+ String language;
+ if (locale == null)
+ {
+ language = null;
+ }
+ else
+ {
+ language = locale.getLanguage();
+ }
- //
- result = getPresenter(language).dynamize();
+ //
+ result = getPresenter(language).dynamize();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public StringBuffer dynamize(final String language) throws Exception
- {
- StringBuffer result;
+ public StringBuffer dynamize(final String language) throws Exception
+ {
+ StringBuffer result;
- result = getPresenter(language).dynamize();
+ result = getPresenter(language).dynamize();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- @Override
- public StringBuffer dynamize(final TagDataManager datas) throws Exception
- {
- StringBuffer result;
+ @Override
+ public StringBuffer dynamize(final TagDataManager datas) throws Exception
+ {
+ StringBuffer result;
- Presenter presenter = getPresenter((String) null);
- if (presenter == null)
- {
- result = null;
- }
- else
- {
- result = presenter.dynamize(datas);
- }
+ Presenter presenter = getPresenter((String) null);
+ if (presenter == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = presenter.dynamize(datas);
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public StringBuffer dynamize(final TagDataManager datas, final Locale locale) throws Exception
- {
- StringBuffer result;
+ public StringBuffer dynamize(final TagDataManager datas, final Locale locale) throws Exception
+ {
+ StringBuffer result;
- //
- String language;
- if (locale == null)
- {
- language = null;
- }
- else
- {
- language = locale.getLanguage();
- }
+ //
+ String language;
+ if (locale == null)
+ {
+ language = null;
+ }
+ else
+ {
+ language = locale.getLanguage();
+ }
- //
- result = getPresenter(language).dynamize(datas);
+ //
+ result = getPresenter(language).dynamize(datas);
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public StringBuffer dynamize(final TagDataManager datas, final String language) throws Exception
- {
- StringBuffer result;
+ public StringBuffer dynamize(final TagDataManager datas, final String language) throws Exception
+ {
+ StringBuffer result;
- result = getPresenter(language).dynamize(datas);
+ result = getPresenter(language).dynamize(datas);
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public Presenter getPresenter(final Locale locale) throws Exception
- {
- Presenter result;
+ public Presenter getPresenter(final Locale locale) throws Exception
+ {
+ Presenter result;
- //
- String language;
- if ((locale == null) || (locale.getLanguage().length() == 0))
- {
- language = null;
- }
- else
- {
- language = locale.getLanguage();
- }
+ //
+ String language;
+ if ((locale == null) || (locale.getLanguage().length() == 0))
+ {
+ language = null;
+ }
+ else
+ {
+ language = locale.getLanguage();
+ }
- //
- result = getPresenter(language);
+ //
+ result = getPresenter(language);
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public Presenter getPresenter(final String language) throws Exception
- {
- Presenter result;
+ public Presenter getPresenter(final String language) throws Exception
+ {
+ Presenter result;
- //
- result = this.presenters.get(language);
+ //
+ result = this.presenters.get(language);
- //
- if (result == null)
- {
- //
- if (language == null)
- {
- //
- result = PresenterFactory.create(this.defaultSource);
+ //
+ if (result == null)
+ {
+ //
+ if (language == null)
+ {
+ //
+ result = PresenterFactory.create(this.defaultSource);
- if (result.isAvailable())
- {
- this.presenters.put(language, result);
- }
- else
- {
- throw new Exception("Undefined default language file.");
- }
- }
- else
- {
- String adaptedSource = FileTools.addBeforeExtension(this.defaultSource, "-" + language);
- result = PresenterFactory.create(adaptedSource);
+ if (result.isAvailable())
+ {
+ this.presenters.put(language, result);
+ }
+ else
+ {
+ throw new Exception("Undefined default language file.");
+ }
+ }
+ else
+ {
+ String adaptedSource = FileTools.addBeforeExtension(this.defaultSource, "-" + language);
+ result = PresenterFactory.create(adaptedSource);
- if (result.isAvailable())
- {
- this.presenters.put(language, result);
- }
- else
- {
- adaptedSource = FileTools.addBeforeExtension(this.defaultSource, "_" + language);
+ if (result.isAvailable())
+ {
+ this.presenters.put(language, result);
+ }
+ else
+ {
+ adaptedSource = FileTools.addBeforeExtension(this.defaultSource, "_" + language);
- if (result.isAvailable())
- {
- this.presenters.put(language, result);
- }
- else
- {
- result = getPresenter((String) null);
- }
- }
- }
- }
+ if (result.isAvailable())
+ {
+ this.presenters.put(language, result);
+ }
+ else
+ {
+ result = getPresenter((String) null);
+ }
+ }
+ }
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- @Override
- public Object getSource()
- {
- String result;
+ @Override
+ public Object getSource()
+ {
+ String result;
- result = this.defaultSource;
+ result = this.defaultSource;
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- @Override
- public boolean isAvailable()
- {
- boolean result;
+ @Override
+ public boolean isAvailable()
+ {
+ boolean result;
- try
- {
- result = getPresenter((String) null).isAvailable();
- }
- catch (Exception exception)
- {
- result = false;
- }
+ try
+ {
+ result = getPresenter((String) null).isAvailable();
+ }
+ catch (Exception exception)
+ {
+ result = false;
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- @Override
- public boolean isOutdated() throws Exception
- {
- return false;
- }
+ @Override
+ public boolean isOutdated() throws Exception
+ {
+ return false;
+ }
- /**
+ /**
*
*/
- public String toString(final Locale locale) throws Exception
- {
- String result;
+ public String toString(final Locale locale) throws Exception
+ {
+ String result;
- //
- String language;
- if (locale == null)
- {
- language = null;
- }
- else
- {
- language = locale.getLanguage();
- }
+ //
+ String language;
+ if (locale == null)
+ {
+ language = null;
+ }
+ else
+ {
+ language = locale.getLanguage();
+ }
- //
- result = toString(language);
+ //
+ result = toString(language);
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
+ /**
*
*/
- public String toString(final String language) throws Exception
- {
- String result;
+ public String toString(final String language) throws Exception
+ {
+ String result;
- Presenter presenter = getPresenter(language);
- if (presenter == null)
- {
- result = null;
- }
- else
- {
- result = presenter.toString();
- }
+ Presenter presenter = getPresenter(language);
+ if (presenter == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = presenter.toString();
+ }
- //
- return result;
- }
+ //
+ return result;
+ }
- @Override
- public void update() throws Exception
- {
- }
+ @Override
+ public void update() throws Exception
+ {
+ }
}
// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/xidyn/presenters/URLPresenter.java b/src/fr/devinsy/xidyn/presenters/URLPresenter.java
index 091379f..b9f2405 100644
--- a/src/fr/devinsy/xidyn/presenters/URLPresenter.java
+++ b/src/fr/devinsy/xidyn/presenters/URLPresenter.java
@@ -33,321 +33,321 @@ import fr.devinsy.xidyn.utils.XidynUtils;
*/
public class URLPresenter extends StringPresenter
{
- private static Logger logger = LoggerFactory.getLogger(URLPresenter.class);
+ private static Logger logger = LoggerFactory.getLogger(URLPresenter.class);
- private String sourcePathname;
- private URL source;
- private long sourceTime;
+ private String sourcePathname;
+ private URL source;
+ private long sourceTime;
- /**
+ /**
*
*/
- public URLPresenter()
- {
- super();
- setSource((URL) null);
- }
+ public URLPresenter()
+ {
+ super();
+ setSource((URL) null);
+ }
- /**
+ /**
*
*/
- public URLPresenter(final String source)
- {
- super();
- setSource(source);
- }
+ public URLPresenter(final String source)
+ {
+ super();
+ setSource(source);
+ }
- /**
+ /**
*
*/
- public URLPresenter(final URL source)
- {
- super();
- setSource(source);
- }
+ public URLPresenter(final URL source)
+ {
+ super();
+ setSource(source);
+ }
- /**
- * No need to be synchronized.
- */
- @Override
- public StringBuffer dynamize() throws Exception
- {
- StringBuffer result;
+ /**
+ * No need to be synchronized.
+ */
+ @Override
+ public StringBuffer dynamize() throws Exception
+ {
+ StringBuffer result;
- //
- update();
+ //
+ update();
- //
- result = super.dynamize();
+ //
+ result = super.dynamize();
- //
- return result;
- }
+ //
+ return result;
+ }
- /**
- * No need to be synchronized.
- */
- @Override
- public StringBuffer dynamize(final TagDataManager data) throws Exception
- {
- StringBuffer result;
+ /**
+ * No need to be synchronized.
+ */
+ @Override
+ public StringBuffer dynamize(final TagDataManager data) throws Exception
+ {
+ StringBuffer result;
- logger.info("dynamize URL [" + this.sourcePathname + "]");
+ logger.info("dynamize URL [" + this.sourcePathname + "]");
- //
- update();
+ //
+ update();
- // Build the web page.
- result = super.dynamize(data);
+ // Build the web page.
+ result = super.dynamize(data);
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public String getSource()
- {
- String result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getSource()
+ {
+ String result;
- result = this.sourcePathname;
+ result = this.sourcePathname;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
+ /**
*
*/
- public URL getURL()
- {
- URL result;
+ public URL getURL()
+ {
+ URL result;
- result = this.source;
+ result = this.source;
- //
- return (result);
- }
+ //
+ return (result);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAvailable()
- {
- boolean result;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAvailable()
+ {
+ boolean result;
- if (this.source == null)
- {
- result = false;
- }
- else if (this.sourcePathname.startsWith("/"))
- {
- /*
- * In case of Jar resources, if resource does not exist then
- * this.source is null. So, if we are here in the code then
- * this.source is not null and so resource is available.
- */
- result = true;
- }
- else
- {
- /*
- * The source is an URL with protocol. Open a stream is the only way to test if the resource is available.
- */
- try
- {
- this.source.openStream();
- result = true;
- }
- catch (final IOException exception)
- {
- /*
- * On URL.openStream:
- *
- *
If host does not exist then a java.net.UnknownHostException is throwed.
- *
If host exists but not the file does not exist then a java.io.FileNotFoundException is throwed.
- *
- * These exceptions are IOException.
- */
- result = false;
- }
- }
+ if (this.source == null)
+ {
+ result = false;
+ }
+ else if (this.sourcePathname.startsWith("/"))
+ {
+ /*
+ * In case of Jar resources, if resource does not exist then
+ * this.source is null. So, if we are here in the code then
+ * this.source is not null and so resource is available.
+ */
+ result = true;
+ }
+ else
+ {
+ /*
+ * The source is an URL with protocol. Open a stream is the only way to test if the resource is available.
+ */
+ try
+ {
+ this.source.openStream();
+ result = true;
+ }
+ catch (final IOException exception)
+ {
+ /*
+ * On URL.openStream:
+ *
+ *
If host does not exist then a java.net.UnknownHostException is throwed.
+ *
If host exists but not the file does not exist then a java.io.FileNotFoundException is throwed.