WICKET-3335 Convert 'dequeuing' boolean to a request flag
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/612f6fb4 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/612f6fb4 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/612f6fb4 Branch: refs/heads/master Commit: 612f6fb41322fa97547d02cfb4fdd4f20ba6892c Parents: ffd7e27 Author: Martin Tzvetanov Grigorov <mgrigo...@apache.org> Authored: Fri Feb 14 15:14:13 2014 +0200 Committer: Igor Vaynberg <igor.vaynb...@gmail.com> Committed: Thu Feb 20 23:37:15 2014 -0800 ---------------------------------------------------------------------- .../src/main/java/org/apache/wicket/Component.java | 1 + .../main/java/org/apache/wicket/MarkupContainer.java | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/612f6fb4/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 e1b256f..9014f0e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Component.java +++ b/wicket-core/src/main/java/org/apache/wicket/Component.java @@ -446,6 +446,7 @@ public abstract class Component private static final short RFLAG_CONFIGURED = 0x10; private static final short RFLAG_BEFORE_RENDER_SUPER_CALL_VERIFIED = 0x20; private static final short RFLAG_INITIALIZE_SUPER_CALL_VERIFIED = 0x40; + protected static final short RFLAG_CONTAINER_DEQUEING = 0x80; /** * Flags that only keep their value during the request. Useful for cache markers, etc. At the http://git-wip-us.apache.org/repos/asf/wicket/blob/612f6fb4/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java index e50418f..05e087d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java +++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java @@ -943,7 +943,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp if (page != null) { - if (!queueRegion.dequeuing) + if (!queueRegion.getRequestFlag(RFLAG_CONTAINER_DEQUEING)) { queueRegion.dequeue(); } @@ -2045,7 +2045,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp if (page != null) { - if (!region.dequeuing) + if (!region.getRequestFlag(RFLAG_CONTAINER_DEQUEING)) { region.dequeue(); } @@ -2059,9 +2059,6 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp return queue; } - // TODO queuing: convert into a flag - private boolean dequeuing = false; - void dequeue() { if (!(this instanceof IQueueRegion)) @@ -2070,19 +2067,19 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp "Only implementations of IQueueRegion can use component queueing"); } - if (dequeuing) + if (getRequestFlag(RFLAG_CONTAINER_DEQUEING)) { throw new IllegalStateException("This container is already dequeing: " + this); } - dequeuing = true; + setRequestFlag(RFLAG_CONTAINER_DEQUEING, true); try { internalDequeue(); } finally { - dequeuing = false; + setRequestFlag(RFLAG_CONTAINER_DEQUEING, false); } }