Create a IMarkupFinder which does exactly the opposite to IComponentResolver and register it with the Application. The resolver tries to find the component to be associated with the Markup (tag). And the MarkupFragmentFinder tries to find the markup associated with the component. Because we are now calling MarkupFragmentFinder in the Component constructor to find the markup associated with Label("somelable", ..") in your case, it will of course fail. Your IMarkupFinder must check if component parent == AnyIdAdapter and if yes position the markup stream at the open tag.
Thats not especially elegant I know and may be we should a method to IComponentResolver which is called from MarkupFragmentFinder. In principle I don't like the idea of having to implement two complementary algorithms to achieve what we want but I have no idea yet on how to solve it. We always need to find the markup associated to a component and if a container we need to iterate of the Markup and find the component associated with a tag. Juergen On 8/28/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > so what do i need to do to make my original example work in 2.0? > > -Igor > > > > On 8/28/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote: > > You can't. Please see Border.resolve() or all the XXXResolver. I'm not > > sure you are viewing the IComponentResolvers the right way. See > > MarkupContainer.renderNext() as well. Whenever during a render get(id) > > does not find the component associated with the id, and that happens > > more often than you might think, than first the container and all its > > parents are checked if they implement IComponentResolver. If yes, it > > is called and only if not successful it will continue with the search. > > After the parent hierarchy all IComponentResolvers registered with the > > application are called as well, until a resolver returned with > > success. Basically the resolvers can do whatever they want and they > > are not at all limited to finding a component and render it. > > > > Juergen > > > > On 8/28/06, Johan Compagner < [EMAIL PROTECTED]> wrote: > > > thats fine by me. > > > > > > > > > > > > On 8/28/06, Igor Vaynberg <[EMAIL PROTECTED] > wrote: > > > > > > > > why not refactor the icomponentresolver to do what it says - resolve > the > > > index of the component in the markup - the rendering can be factored out > to > > > places that call resolve() > > > > > > > > > > > > -Igor > > > > > > > > > > > > > > > > > > > > On 8/28/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > > > > > > > > > > i think this is the discussion we had (juergen) in another thread. > > > > > If you write a IComponentResovler you should also write something > else > > > to be able to look up the childs components markup. > > > > > Can't we add another method on IComponentResolver? That the > markupfinder > > > can call on the parent for a child? > > > > > > > > > > johan > > > > > > > > > > > > > > > > > > > > > > > > > On 8/28/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > if i understand correctly in 1.2 i can do something like this > > > > > > > > > > class AnyIdAdapter extends WebMarkupContainer implements > > > IComponentResolver { > > > > > .... > > > > > public final boolean resolve(MarkupContainer container, > MarkupStream > > > markupStream, ComponentTag tag) > > > > > { > > > > > iterator().next().render(markupStream); > > > > > return true; > > > > > } > > > > > } > > > > > > > > > > so this webmarkup container would render any child with any id so i > can > > > do > > > > > > > > > > AnyIdAdapter adapter=new AnyIdAdapter("adapter"); > > > > > adapter.add(new Label("somelabel", "hi")); > > > > > > > > > > <span wicket:id="adapter"><span wicket:id=" > somerandomid"></span></span> > > > > > > > > > > and this should work nicely, but it doesnt work in 2.0 - i get > > > > > > > > > > wicket.WicketRuntimeException: Unable to find the markup for the > > > component: item > > > > > > > > > > > > > > > > > > > > > > > > > at > > > > wicket.MarkupFragmentFinder.find(MarkupFragmentFinder.java:89) > > > > > at > > > wicket.Component.loadMarkupStream (Component.java:663) > > > > > at wicket.Component.<init>(Component.java:629) > > > > > > > > > > > > > > > > > > > > because MarkupFragmentFinder doesnt take IComponentResolver into > account > > > - and how could it because IComponentResolver also renders the component > > > while MarkupFragmentFinder only locates it. > > > > > > > > > > so what should we do? have some IComponentFinder interface, tweak > > > something else? > > > > > > > > > > > > > > > -Igor > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > Using Tomcat but need to do more? Need to support web services, > > > security? > > > > > Get stuff done quickly with pre-integrated technology to make your > job > > > easier > > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > > Geronimo > > > > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > > > > > > > _______________________________________________ > > > > > Wicket-develop mailing list > > > > > Wicket-develop@lists.sourceforge.net > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > Using Tomcat but need to do more? Need to support web services, > > > security? > > > > > Get stuff done quickly with pre-integrated technology to make your > job > > > easier > > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > > Geronimo > > > > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > > > > > > > _______________________________________________ > > > > > Wicket-develop mailing list > > > > > Wicket-develop@lists.sourceforge.net > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > Using Tomcat but need to do more? Need to support web services, > security? > > > > Get stuff done quickly with pre-integrated technology to make your job > > > easier > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > > > > > _______________________________________________ > > > > Wicket-develop mailing list > > > > Wicket-develop@lists.sourceforge.net > > > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > Using Tomcat but need to do more? Need to support web services, > security? > > > Get stuff done quickly with pre-integrated technology to make your job > > > easier > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > > > _______________________________________________ > > > Wicket-develop mailing list > > > Wicket-develop@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > Wicket-develop mailing list > > Wicket-develop@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Wicket-develop mailing list > Wicket-develop@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-develop mailing list Wicket-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-develop