diff --git a/src/fr/devinsy/xidyn/data/SimpleTagData.java b/src/fr/devinsy/xidyn/data/SimpleTagData.java
index 61c8aba..a0d553c 100644
--- a/src/fr/devinsy/xidyn/data/SimpleTagData.java
+++ b/src/fr/devinsy/xidyn/data/SimpleTagData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2017 Christian Pierre MOMON
+ * Copyright (C) 2006-2017,2020 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -36,6 +36,8 @@ import java.io.Serializable;
*/
public class SimpleTagData implements Serializable, TagData
{
+ private static final long serialVersionUID = 8976245034682639923L;
+
public enum IterationStrategy
{
ONLY_FIRST_ROW,
@@ -50,9 +52,7 @@ public class SimpleTagData implements Serializable, TagData
REPLACE,
APPEND,
IGNORE
- }
-
- private static final long serialVersionUID = 8976245034682639923L;;
+ };
private IterationStrategy iterationStrategy;
private TagAttributes attributes;
@@ -87,6 +87,19 @@ public class SimpleTagData implements Serializable, TagData
this.iterationStrategy = IterationStrategy.ALL_ROWS;
}
+ /**
+ * Append attribute.
+ *
+ * @param label
+ * the label
+ * @param value
+ * the value
+ */
+ public void appendAttribute(final String label, final String value)
+ {
+ this.attributes.appendAttribute(label, value);
+ }
+
/**
* Append content.
*
@@ -169,6 +182,23 @@ public class SimpleTagData implements Serializable, TagData
return result;
}
+ /**
+ * Gets the attribute.
+ *
+ * @param label
+ * the label
+ * @return the attribute
+ */
+ public String getAttribute(final String label)
+ {
+ String result;
+
+ result = this.attributes.getAttribute(label);
+
+ //
+ return result;
+ }
+
/**
* Iteration strategy.
*
@@ -184,6 +214,19 @@ public class SimpleTagData implements Serializable, TagData
return result;
}
+ /**
+ * Sets the attribute.
+ *
+ * @param label
+ * the label
+ * @param value
+ * the value
+ */
+ public void setAttribute(final String label, final String value)
+ {
+ this.attributes.put(label, value);
+ }
+
/**
* Sets the content.
*
diff --git a/src/fr/devinsy/xidyn/data/TagDataManager.java b/src/fr/devinsy/xidyn/data/TagDataManager.java
index d1f6cde..81c5c64 100644
--- a/src/fr/devinsy/xidyn/data/TagDataManager.java
+++ b/src/fr/devinsy/xidyn/data/TagDataManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2017 Christian Pierre MOMON
+ * Copyright (C) 2006-2017,2020 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -74,6 +74,82 @@ public class TagDataManager
tags.add(tag);
}
+ /**
+ * Append attribute.
+ *
+ * @param id
+ * the id
+ * @param line
+ * the line
+ * @param label
+ * the label
+ * @param value
+ * the value
+ */
+ public void appendAttribute(final String id, final int line, final String label, final long value)
+ {
+ appendAttribute(id, line, label, String.valueOf(value));
+ }
+
+ /**
+ * Append attribute.
+ *
+ * @param id
+ * the id
+ * @param line
+ * the line
+ * @param label
+ * the label
+ * @param value
+ * the value
+ */
+ public void appendAttribute(final String id, final int line, final String label, final String value)
+ {
+ SimpleTagData tag = this.getIdData(id, line);
+
+ tag.attributes().appendAttribute(label, value);
+ }
+
+ /**
+ * Append attribute.
+ *
+ * @param id
+ * the id
+ * @param line
+ * the line
+ * @param column
+ * the column
+ * @param label
+ * the label
+ * @param value
+ * the value
+ */
+ public void appendAttribute(final String id, final int line, final String column, final String label, final long value)
+ {
+ appendAttribute(id, line, column, label, String.valueOf(value));
+ }
+
+ /**
+ * Append attribute.
+ *
+ * @param id
+ * the id
+ * @param line
+ * the line
+ * @param column
+ * the column
+ * @param label
+ * the label
+ * @param value
+ * the value
+ */
+ 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);
+ }
+
/**
* Append attribute.
*
@@ -174,6 +250,19 @@ public class TagDataManager
tag.appendContent(value);
}
+ /**
+ * Append content.
+ *
+ * @param id
+ * the id
+ * @param value
+ * the value
+ */
+ public void appendContent(final String id, final long value)
+ {
+ appendContent(id, String.valueOf(value));
+ }
+
/**
* Append content.
*
@@ -297,11 +386,11 @@ public class TagDataManager
}
/**
- * Gets the ids data by id.
- *
- * @return the ids data by id
+ * Gets the root ids data.
+ *
+ * @return the root
*/
- public TagDataListById getIdsDataById()
+ public TagDataListById getRoot()
{
TagDataListById result;
diff --git a/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java b/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java
index 20affa2..5ed6c7c 100644
--- a/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java
+++ b/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2018 Christian Pierre MOMON
+ * Copyright (C) 2006-2018,2020 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -90,7 +90,7 @@ public class DomPresenterCore
*/
public static void dynamize(final Appendable result, final Document doc, final TagDataManager data) throws XidynException
{
- dynamize(result, doc, data.getIdsDataById());
+ dynamize(result, doc, data.getRoot());
}
/**
@@ -131,7 +131,7 @@ public class DomPresenterCore
{
StringBuffer result;
- result = dynamize(doc, data.getIdsDataById());
+ result = dynamize(doc, data.getRoot());
//
return result;
diff --git a/test/fr/devinsy/xidyn/data/TagDataManagerTest.java b/test/fr/devinsy/xidyn/data/TagDataManagerTest.java
new file mode 100644
index 0000000..3ea9c3f
--- /dev/null
+++ b/test/fr/devinsy/xidyn/data/TagDataManagerTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2020 Christian Pierre MOMON
+ *
+ * This file is part of Xidyn.
+ *
+ * Xidyn is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Xidyn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Xidyn. If not, see
id | name |