You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2012/01/08 20:29:52 UTC
git commit: hierarchy completion has to happen before onconfigure,
otherwise enclosures wont work...
Updated Branches:
refs/heads/sandbox/hierarchy-completion 9a7bc7c27 -> 9a84f3865
hierarchy completion has to happen before onconfigure, otherwise enclosures wont work...
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/9a84f386
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/9a84f386
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/9a84f386
Branch: refs/heads/sandbox/hierarchy-completion
Commit: 9a84f3865ceb2ea612770512c0eee75120666f75
Parents: 9a7bc7c
Author: Igor Vaynberg <iv...@apache.org>
Authored: Sun Jan 8 11:29:19 2012 -0800
Committer: Igor Vaynberg <iv...@apache.org>
Committed: Sun Jan 8 11:29:19 2012 -0800
----------------------------------------------------------------------
.../src/main/java/org/apache/wicket/Component.java | 16 +++---
.../java/org/apache/wicket/MarkupContainer.java | 36 +--------------
2 files changed, 9 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/9a84f386/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 c335ddc..61dbf48 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -104,8 +104,7 @@ import org.slf4j.LoggerFactory;
* concatenation with colon separators of each id along the way. For example, the path "a:b:c" would
* refer to the component named "c" inside the MarkupContainer named "b" inside the container named
* "a". The path to a component can be retrieved by calling {@link #getPath()}. To get a Component
- * path relative to the page that contains it, you can call {@link #getPageRelativePath()}.
- * </li>
+ * path relative to the page that contains it, you can call {@link #getPageRelativePath()}.</li>
* <li><b>LifeCycle </b>- Components participate in the following lifecycle phases:
* <ul>
* <li><b>Construction </b>- A Component is constructed with the Java language new operator.
@@ -113,8 +112,7 @@ import org.slf4j.LoggerFactory;
* {@link IComponentInstantiationListener}s are notified of component instantiation.
* <p>
* {@link #onInitialize()} is called on the component as soon as the component is part of a page's
- * component tree. At this state the component is able to access its markup.
- * </li>
+ * component tree. At this state the component is able to access its markup.</li>
* <li><b>Request Handling </b>- An incoming request is processed by a protocol request handler such
* as {@link WicketFilter}. An associated Application object creates {@link Session},
* {@link Request} and {@link Response} objects for use by a given Component in updating its model
@@ -970,8 +968,6 @@ public abstract class Component
onBeforeRender();
- completeHierarchy();
-
getApplication().getComponentPostOnBeforeRenderListeners().onBeforeRender(this);
if (!getRequestFlag(RFLAG_BEFORE_RENDER_SUPER_CALL_VERIFIED))
@@ -1074,6 +1070,9 @@ public abstract class Component
{
clearEnabledInHierarchyCache();
clearVisibleInHierarchyCache();
+
+ completeHierarchy();
+
onConfigure();
for (Behavior behavior : getBehaviors())
{
@@ -2678,10 +2677,11 @@ public abstract class Component
// to be backward compatible. WICKET-3761
getMarkupSourcingStrategy().renderHead(this, container);
CharSequence headerContribution = markupHeaderResponse.getBuffer();
- if (Strings.isEmpty(headerContribution) == false) {
+ if (Strings.isEmpty(headerContribution) == false)
+ {
response.render(StringHeaderItem.forString(headerContribution));
}
- }
+ }
finally
{
RequestCycle.get().setResponse(oldResponse);
http://git-wip-us.apache.org/repos/asf/wicket/blob/9a84f386/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 d25a466..14aecd7 100644
--- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
@@ -21,10 +21,8 @@ import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Stack;
import org.apache.wicket.markup.ComponentTag;
@@ -256,8 +254,6 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
ComponentTag tag = null;
- Map<Component, MarkupContainer> lateAdd = new HashMap<Component, MarkupContainer>();
-
while (markup.hasMore())
{
if (tag != null)
@@ -357,17 +353,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
if (child != null && child.getParent() == null)
{
- if (parent.findParent(Page.class) != null)
- {
- // if the parent is linked to the page we will delay the lateadd call so
- // onconfigure is now triggered on the child right away, but instead after its
- // children have been resolved
- lateAdd.put(child, parent);
- }
- else
- {
- lateAdd(parent, child);
- }
+ parent.add(child);
// TODO do we need to continue unqueuing or can we skip this component
// and all its children if it has been deemed invisible? - dont think we can because
// that will leave components in the queue and ondetach() will bomb
@@ -426,26 +412,6 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
markup.skipToMatchingCloseTag(tag);
}
}
- for (Map.Entry<Component, MarkupContainer> delayed : lateAdd.entrySet())
- {
- lateAdd(delayed.getValue(), delayed.getKey());
- }
- }
-
- private void lateAdd(MarkupContainer parent, Component queued)
- {
- parent.add(queued);
-
- // at this point queued.onInitialize() wouldve been called by add()
-
- if (parent.isVisibleInHierarchy())
- {
- // TODO hierarchy completion: this call may not be necessary because if we are alrady in
- // render this will be called from markupcontainer.add()
-
- // call configure() and onbeforerender() which are done from inside internalBeforeRender
- queued.internalBeforeRender();
- }
}
/**