I think you misunderstand the meaning of what getContainer() does. Suppose page A includes component B in its template, and component B includes component C in its template in return. C.getContainer() will return the B component.

On the other hand, if page A includes both components B and C in its template, and B only wraps C in A's template, then C.getContainer() will return the A page.

In other words getContainer() does not point to an "enclosed by" relationship, but a "part of" relationship.

drgorb wrote:
Hi,

I try to use getContainer() inside a component to get at its parent, but the 
method allways returns the page object, no matter what.

Are ther special conditions for this to work? Is there special configuration?

In the following example, the IComponent parent is allways the Home page and 
never the enclosing tag. I've checked that with my eclipse debuger.

HTML:
        
                
                        
                                
                                
                        
                        
                        
                        
                        
                
        

The Label.java renderComponent method:
the class extends BaseComponent

  @Override
  protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
    IComponent parent=getContainer();
    super.renderComponent(writer, cycle);
  }


-------------------- m2f --------------------

Sent from www.TapestryForums.com

Read this topic online here: <<topic_link>>

http://www.tapestryforums.com/viewtopic.php?p=14264#14264

-------------------- m2f --------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to