Repository: wicket Updated Branches: refs/heads/master bcd55813b -> 43b8e60b6
WICKET-6298 now AssociatedMarkupSourcingStrategy#getMarkup cleans any previous markup loaded for container's children Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/330357a5 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/330357a5 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/330357a5 Branch: refs/heads/master Commit: 330357a5dc1d0d67a5957076e536e4971f6210ee Parents: bcd5581 Author: Andrea Del Bene <[email protected]> Authored: Wed Dec 21 15:19:26 2016 +0100 Committer: Andrea Del Bene <[email protected]> Committed: Wed Dec 21 15:19:26 2016 +0100 ---------------------------------------------------------------------- .../main/java/org/apache/wicket/Component.java | 15 +-------------- .../panel/AssociatedMarkupSourcingStrategy.java | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/330357a5/wicket-core/src/main/java/org/apache/wicket/Component.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java index ed2c22f..97262ed 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Component.java +++ b/wicket-core/src/main/java/org/apache/wicket/Component.java @@ -83,7 +83,6 @@ import org.apache.wicket.util.convert.IConverter; import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Classes; -import org.apache.wicket.util.lang.Objects; import org.apache.wicket.util.string.PrependingStringBuffer; import org.apache.wicket.util.string.Strings; import org.apache.wicket.util.value.ValueMap; @@ -727,7 +726,7 @@ public abstract class Component public IMarkupFragment getMarkup() { // Markup already determined or preset? - if (markup != null && markupHasCurrentVariation()) + if (markup != null) { return markup; } @@ -759,18 +758,6 @@ public abstract class Component } /** - * Check if the loaded markup has the current - * variation. - * - * @return true if the markup has the current variation - */ - private boolean markupHasCurrentVariation() - { - return Objects.equal(getVariation(), - markup.getMarkupResourceStream().getVariation()); - } - - /** * @return The 'id' attribute from the associated markup tag */ public final String getMarkupIdFromMarkup() http://git-wip-us.apache.org/repos/asf/wicket/blob/330357a5/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java index 5f547ac..572bfcc 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java @@ -106,11 +106,14 @@ public abstract class AssociatedMarkupSourcingStrategy extends AbstractMarkupSou throw new MarkupNotFoundException("Expected to find <wicket:" + tagName + "> in associated markup file. Markup: " + associatedMarkup.toString()); } - + // If child == null, than return the markup fragment starting with <wicket:panel> if (child == null) { - return markup; + //clean any markup previously loaded for children + clearChildrenMarkup(parent); + + return markup; } // Find the markup for the child component @@ -130,6 +133,19 @@ public abstract class AssociatedMarkupSourcingStrategy extends AbstractMarkupSou } /** + * Iterate on parent's children and set their markup to null. + * + * @param parent + */ + private void clearChildrenMarkup(MarkupContainer parent) + { + for (Component child : parent) + { + child.setMarkup(null); + } + } + + /** * Search the child's markup in the header section of the markup * * @param container
