From 2637f4e2c88597ed1deab489a23b22e81986fa2c Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Fri, 20 Nov 2020 05:17:41 +0100 Subject: [PATCH] Added setEscapedAttribute methods. Refactored setEscapedContent methods. --- src/fr/devinsy/xidyn/data/SimpleTagData.java | 25 ++++++++ src/fr/devinsy/xidyn/data/TagDataManager.java | 64 +++++++++++++++++-- 2 files changed, 85 insertions(+), 4 deletions(-) diff --git a/src/fr/devinsy/xidyn/data/SimpleTagData.java b/src/fr/devinsy/xidyn/data/SimpleTagData.java index 1afd821..cf86504 100644 --- a/src/fr/devinsy/xidyn/data/SimpleTagData.java +++ b/src/fr/devinsy/xidyn/data/SimpleTagData.java @@ -21,6 +21,7 @@ package fr.devinsy.xidyn.data; import java.io.Serializable; import fr.devinsy.strings.StringsUtils; +import fr.devinsy.xidyn.utils.XidynUtils; /** * The Class SimpleTagData. @@ -344,6 +345,30 @@ public class SimpleTagData implements Serializable, TagData this.displayMode = displayMode; } + /** + * Sets the escaped attribute. + * + * @param label + * the label + * @param value + * the value + */ + public void setEscapedAttribute(final String label, final String value) + { + setAttribute(label, XidynUtils.escapeXmlBlank(value)); + } + + /** + * Sets the escaped content. + * + * @param text + * the new escaped content + */ + public void setEscapedContent(final String text) + { + setContent(XidynUtils.escapeXmlBlank(text)); + } + /** * Sets the exclude section. * diff --git a/src/fr/devinsy/xidyn/data/TagDataManager.java b/src/fr/devinsy/xidyn/data/TagDataManager.java index 9773966..85f0f83 100644 --- a/src/fr/devinsy/xidyn/data/TagDataManager.java +++ b/src/fr/devinsy/xidyn/data/TagDataManager.java @@ -19,7 +19,6 @@ package fr.devinsy.xidyn.data; import fr.devinsy.xidyn.presenters.DomPresenterCore; -import fr.devinsy.xidyn.utils.XidynUtils; /** * The Class TagDataManager. @@ -660,6 +659,63 @@ public class TagDataManager idData.setContent(content); } + /** + * Sets the escaped attribute. + * + * @param id + * the id + * @param line + * the line + * @param label + * the label + * @param value + * the value + */ + public void setEscapedAttribute(final String id, final int line, final String label, final String value) + { + SimpleTagData tag = this.getIdData(id, line); + + tag.setEscapedAttribute(label, value); + } + + /** + * Sets the escaped attribute. + * + * @param id + * the id + * @param line + * the line + * @param column + * the column + * @param label + * the label + * @param value + * the value + */ + public void setEscapedAttribute(final String id, final int line, final String column, final String label, final String value) + { + SimpleTagData tag = this.getIdData(id, line, column); + + tag.setEscapedAttribute(label, value); + } + + /** + * Sets the escaped attribute. + * + * @param id + * the id + * @param label + * the label + * @param value + * the value + */ + public void setEscapedAttribute(final String id, final String label, final String value) + { + SimpleTagData tag = this.getIdData(id); + + tag.setEscapedAttribute(label, value); + } + /** * Sets the escaped content. * @@ -674,7 +730,7 @@ public class TagDataManager { SimpleTagData tag = this.getIdData(id, line); - tag.setContent(XidynUtils.escapeXmlBlank(content)); + tag.setEscapedContent(content); } /** @@ -693,7 +749,7 @@ public class TagDataManager { SimpleTagData tag = this.getIdData(id, line, column); - tag.setContent(XidynUtils.escapeXmlBlank(content)); + tag.setEscapedContent(content); } /** @@ -708,7 +764,7 @@ public class TagDataManager { SimpleTagData idData = this.getIdData(id); - idData.setContent(XidynUtils.escapeXmlBlank(content)); + idData.setEscapedContent(content); } /**