You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Timo Rantalaiho <Ti...@ri.fi> on 2009/02/03 21:58:27 UTC

Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException

On Wed, 04 Feb 2009, smallufo wrote:
> When traversalling the nodes , it cannot find any Component that implements
> ExpandCollapseListener.
> But the Panel that wrapped by the Border indeed implements
> ExpandCollapseListener

>         PulldownBorder.this.visitChildren(new IVisitor()
...

> Here is the Panel that wrapped by PulldownBorder :
> 
> public class MyPanel extends Panel implements ExpandCollapseListener
...

You're visiting the children of the border, which traverses
only all its children recursively. As you add the border to
the panel, the border is a child of the panel, but not the
other way around.

As the name "visitChildren" implies, the visitor never goes
up to its parents. 

Maybe you want 

   ExpandCollapseListener listener = ((ExpandCollapseListener) findParent(ExpandCollapseListener.class));

or 

  getPage().visitChildren(ExpandCollapseListener.class, new IVisitor() { ... });

(For visitChildern(), you can supply a type of the
Components you want to visit directly)

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org