The IPostOrderVisitor idea seems to me better than having another method -Matej
On 8/30/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > perhaps you can add an rfe into jira so we dont forget. > > -igor > > > On 8/29/07, RedFury <[EMAIL PROTECTED]> wrote: > > > > > > Thanks for the quick reply Igor. For now I'm just going to take your > > FormComponent visitor example and adapt that to my case since it looks > > tidy > > and straightforward. It would be nice if this functionality could > somehow > > find its way into markupcontainer though. > > > > Cheers, > > Dean > > > > > > igor.vaynberg wrote: > > > > > > hrm. i have implemented a postorder traversal for formcomponents (see > > > FormComponent.visitFormComponentsPostOrder) so you can either take > that > > > code > > > and use it in your app, or we can bring it up to markupcontainer and > > > generalize it. > > > > > > the problem is that we already have visitComponents, and having a > > > visitComponentsPostOrder next to it seems a little inconsistent. what > do > > > other devs think? > > > > > > -igor > > > > > > > > > On 8/29/07, RedFury <[EMAIL PROTECTED]> wrote: > > >> > > >> > > >> Hi all, > > >> > > >> I've writing a very heavily javascripted app in wicket and finding > > wicket > > >> handles the complexity wonderfully. I've used > VisitChildren(IVisitor) > > >> successfully in numerous places but have a problem with a case where > > I'd > > >> like to use it 'backwards'. I'm writing some base components which > > will > > >> be > > >> used by our application programmers and our base Panel has an > onClose() > > >> method which will contribute javascript to a closing panel (rendered > > on > > >> AjaxRequestTarget.prependJavascript()) What I would like to do is > have > > a > > >> closing panel's children automatically call onClose(). > > >> > > >> So I started with: > > >> > > >> protected final void close() > > >> { > > >> visitChildren(JumbuckPanel.class, new IVisitor() > > >> { > > >> public Object component(Component c) > > >> { > > >> ((JumbuckPanel)c).onClose(); > > >> return IVisitor.CONTINUE_TRAVERSAL; > > >> } > > >> }); > > >> } > > >> > > >> Then I realized that this had a problem - being onClose() I needed > the > > >> children to be traversed from the bottom-up, whereas visitChildren > > always > > >> seem to go top-down. That is, from looking at VisitChildren() in > > >> MarkupContainer, it goes.. > > >> > > >> -visit this node > > >> -if this is a container, visitchildren recursively. > > >> > > >> wherease I need: > > >> > > >> -if this is a container, visitchildren recursively > > >> -visit this node. > > >> > > >> So originally I tried to write reverseVisitChildren() in my sublcass > of > > >> MarkupContainer but then realized all of the access functions > > >> (children_size > > >> and children_next) are private in markupContainer and my recursive > call > > >> to > > >> reverseVisitChildren would only work on my custom panel, not generic > > >> MarkupContainers, if that makes. > > >> > > >> Is anyone able to suggest a simple solution to this problem, as right > > now > > >> the best solution I can think of is to add that functionality to > > >> MarkupContainer as I think it might prove useful for other people at > > some > > >> stage also. > > >> > > >> Thanks, > > >> Dean > > >> > > >> -- > > >> View this message in context: > > >> > http://www.nabble.com/VisitChildren-bottom-up-tf4351747.html#a12399896 > > >> Sent from the Wicket - User mailing list archive at Nabble.com. > > >> > > >> > > >> --------------------------------------------------------------------- > > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > > >> For additional commands, e-mail: [EMAIL PROTECTED] > > >> > > >> > > > > > > > > > > -- > > View this message in context: > > http://www.nabble.com/VisitChildren-bottom-up-tf4351747.html#a12400529 > > Sent from the Wicket - User mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > >