You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Oliver Bauer <ol...@web.de> on 2010/07/27 09:06:15 UTC
[T5.1] No recursive component -> Howto render Beaneditor in code?
Hi,
we have noted that T5 doesn't allow recursive components[1],
so we are currently doing something like this:
We reference our component in an arbritrary tml like this:
<t:MyComponent
source="root"
currentNode="currentNode">
</t:MyComponent>
The code stub of the component:
boolean setupRender(MarkupWriter writer) {
// write some opening div
}
void beforeRenderBody(MarkupWriter writer) {
processRoot(source, writer);
}
void cleanupRender(MarkupWriter writer) {
// close some opened div's
}
This works fine (#processRoot calls itself recursively for its children), but now we
want to display a bean editor in a Node (in processRoot()). Is it possible to reference
a component (like a bean editor) in a component being written in Java? Are there any
examples how to achieve this?
TIA, Oliver
[1] [https://issues.apache.org/jira/browse/TAP5-739]
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5.1] No recursive component -> Howto render Beaneditor in
code?
Posted by Oliver Bauer <ol...@web.de>.
Hi Ville,
thanks for your answer, but i didn't see how to do it. I will try to
explain my problem more in detail (sorry for my bad english):
We are using a component that is similar to [1] with the main difference
that we don't use a "getTreeNodes", we use a "getTreeRoot" (e.g. single
element, not all elements of the tree) and doing our rendering inside the
java-component (we don't have a tml for our component) via the MarkupWriter.
The TreeDemo.tml from [1] allows to use a component 'Tree' like follows:
<t:Tree treeid='literal:demo' source="treeNodes" currentNode="node">
<t:actionlink t:id="tree" context="node.identifier">
${node.name}
</t:actionlink>
</t:Tree>
We can't use an actionlink because we only have a root node and iterate it
inside our java class (recursively via the processRoot method). Normally we
would like to do something like the following (TreeNode.tml):
<div id="someid">
<t:if test="identifierEqualsX">
<t:beaneditor object="current"/>
<p:else>
current.name
</p:else>
</t:if>
<t:loop source="current.children" value="child">
<t:TreeNode element="child"/>
</t:loop>
</div>
but thats not allowed, e.g "The template for component.. is recursive...
This is not supported" so we are trying to do this inside a java class
(without a tml).
Now we want to render a beaneditor for a specific identifier inside the
java class, something like the following would be nice.
void processRoot(Node current, MarkupWriter writer) {
// open div
if (current.getIdentifier().equals("X")) {
---> writer.renderBeaneditor(editor); <---
} else {
// display some informations of the node
}
for (Node child : current.getChildren()) {
processRoot(child, writer);
}
// close div
}
but i don't know how to add/declare/instanciate the beaneditor?
Thanks for any hints!
Oliver
[1] http://wiki.apache.org/tapestry/Tapestry5TreeComponent
-----Ursprüngliche Nachricht-----
Von: Ville Virtanen <vi...@cerion.fi>
Gesendet: 27.07.2010 09:15:31
An: users@tapestry.apache.org
Betreff: Re: [T5.1] No recursive component -> Howto render Beaneditor in code?
>
>Hi,
>
>@InjectComponent injects the component defined in tml, @Component injects
>instance that is configured by the annotation itself (and the associated tml
>if it is defined there also).
>
>http://tapestry.apache.org/tapestry5.1/apidocs/org/apache/tapestry5/annotations/Component.html
>
> - Ville
>
>
>Oliver Bauer wrote:
>>
>> Hi,
>>
>> we have noted that T5 doesn't allow recursive components[1],
>> so we are currently doing something like this:
>> We reference our component in an arbritrary tml like this:
>>
>> <t:MyComponent
>> source="root"
>> currentNode="currentNode">
>> </t:MyComponent>
>>
>> The code stub of the component:
>>
>> boolean setupRender(MarkupWriter writer) {
>> // write some opening div
>> }
>>
>> void beforeRenderBody(MarkupWriter writer) {
>> processRoot(source, writer);
>> }
>>
>> void cleanupRender(MarkupWriter writer) {
>> // close some opened div's
>> }
>>
>> This works fine (#processRoot calls itself recursively for its children),
>> but now we
>> want to display a bean editor in a Node (in processRoot()). Is it possible
>> to reference
>> a component (like a bean editor) in a component being written in Java? Are
>> there any
>> examples how to achieve this?
>>
>> TIA, Oliver
>>
>> [1] [https://issues.apache.org/jira/browse/TAP5-739]
>> ___________________________________________________________
>> Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
>> Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>--
>View this message in context: http://old.nabble.com/-T5.1--No-recursive-component--%3E-Howto-render-Beaneditor-in-code--tp29273576p29273645.html
>Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: users-help@tapestry.apache.org
>
___________________________________________________________
WEB.DE DSL ab 19,99 Euro/Monat. Bis zu 150,- Euro Startguthaben und
50,- Euro Geldprämie inklusive! https://freundschaftswerbung.web.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5.1] No recursive component -> Howto render Beaneditor in
code?
Posted by Ville Virtanen <vi...@cerion.fi>.
Hi,
@InjectComponent injects the component defined in tml, @Component injects
instance that is configured by the annotation itself (and the associated tml
if it is defined there also).
http://tapestry.apache.org/tapestry5.1/apidocs/org/apache/tapestry5/annotations/Component.html
- Ville
Oliver Bauer wrote:
>
> Hi,
>
> we have noted that T5 doesn't allow recursive components[1],
> so we are currently doing something like this:
> We reference our component in an arbritrary tml like this:
>
> <t:MyComponent
> source="root"
> currentNode="currentNode">
> </t:MyComponent>
>
> The code stub of the component:
>
> boolean setupRender(MarkupWriter writer) {
> // write some opening div
> }
>
> void beforeRenderBody(MarkupWriter writer) {
> processRoot(source, writer);
> }
>
> void cleanupRender(MarkupWriter writer) {
> // close some opened div's
> }
>
> This works fine (#processRoot calls itself recursively for its children),
> but now we
> want to display a bean editor in a Node (in processRoot()). Is it possible
> to reference
> a component (like a bean editor) in a component being written in Java? Are
> there any
> examples how to achieve this?
>
> TIA, Oliver
>
> [1] [https://issues.apache.org/jira/browse/TAP5-739]
> ___________________________________________________________
> Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
> Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
View this message in context: http://old.nabble.com/-T5.1--No-recursive-component--%3E-Howto-render-Beaneditor-in-code--tp29273576p29273645.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org