Re: T5.3.6 AfterRenderTemplate getElement returns element of parent component

2012-12-07 Thread Azudio
Hi Lance, thanks for the explanation, will try the workaround in the JIRA. 

Adam. 



--
View this message in context: 
http://tapestry-users.832.n2.nabble.com/T5-3-6-AfterRenderTemplate-getElement-returns-element-of-parent-component-tp7583912p7583931.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: T5.3.6 AfterRenderTemplate getElement returns element of parent component

2012-12-06 Thread Lance Java
This is expected behavior. MarkupWriter.getElement() returns the current XML
element on the stack that has not been closed (ie markupWriter.end() has not
been called for the element). Since all TML templates are well formed XML
and hence end() every element thus popping it off of the stack.

What you are witnessing is also the cause of this issue
https://issues.apache.org/jira/browse/TAP5-1918

The jira provides a solution to find the lastChild of
MarkupWriter.getElement(). This will be the element rendered by your
template.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-3-6-AfterRenderTemplate-getElement-returns-element-of-parent-component-tp5718513p5718515.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



T5.3.6 AfterRenderTemplate getElement returns element of parent component

2012-12-05 Thread Azudio Developer
Hi,

I'm seeing something that doesn't look right - possibly user error.

I have a component structure like this:

MyPage
-TopBar (c)
- NavItem (c)

In the NavItem.java I have an render phase method:
@AfterRenderTemplate
void afterRender(MarkupWriter writer) {
log.debug(writer.getElement().toString());
}

Which produces in the log:
ulliItem 1/li/ul

The TopBar component TML has the ul element and the NavItem TML has the li 
so I would expect the getElement call to return the NavItem li

Can anyone confirm if this is the expected behaviour and if so how do I get the 
element in my NavItem.


NavItem.tml
?xml version=1.0 encoding=UTF-8 ?
li xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd; 
xmlns:p=tapestry:parameter
a t:type=pagelink page=${page}${label}/a
/li 

Thanks in advance,
Adam.