Hi! >> I'm not scared that easily. Private members have a place and purpose. > Yes, please don't make us have to expose our private parts.
;) Here's a first attempt with few TODOs, however: ### Eclipse Workspace Patch 1.0 Index: src/main/java/org/apache/wicket/MarkupContainer.java =================================================================== RCS file: /src/main/java/org/apache/wicket/MarkupContainer.java,v retrieving revision 1.1 diff -u -r1.1 MarkupContainer.java --- src/main/java/org/apache/wicket/MarkupContainer.java 6 Nov 2010 12:17:36 -0000 1.1 +++ src/main/java/org/apache/wicket/MarkupContainer.java 6 Nov 2010 12:18:00 -0000 @@ -20,8 +20,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; +import java.util.Map; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupElement; @@ -112,7 +115,7 @@ { super(id, model); } - + /** * Adds a child component to this container. * @@ -1723,6 +1726,25 @@ } return result; } + + private Map<String, Component> componentIdMapAidedComponent = new HashMap<String, Component>(); + + public final MarkupContainer addWithAid(final Component... childs) + { + for (Component child : childs) + { + Component duplicateChild = componentIdMapAidedComponent.put(child.getId(), child); + + if (duplicateChild != null) + { + // Fail-fast + throw new IllegalArgumentException(exceptionMessage("A child with id '" + + child.getId() + "' already exists")); + } + } + + return this; + } /** * @@ -1732,6 +1754,25 @@ void onBeforeRenderChildren() { super.onBeforeRenderChildren(); + + { + // Add also aided children to their right place; all should now exist in the map + for (Component child : new LinkedList<Component>(componentIdMapAidedComponent.values() /** remove items from componentIdMapAidedComponent as soon as they are matched */)) + { + /* + * TODO Parse markup, find each component's real parent and add it onto + * its real parent + * + * TODO MarkupVisitor must not visit child markup when they have their + * own (maybe it's not even possible by default). + * + * TODO Throw exception if child id is matched multiple times. + */ + + // Finally remove aided component from map + componentIdMapAidedComponent.remove(child.getId()); + } + } // We need to copy the children list because the children components can // modify the hierarchy in their onBeforeRender. ** Martin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org