You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stefan Schütz <sc...@arcor.de> on 2009/09/03 19:30:15 UTC
Substitution for Switch/Case/Block to embed components really dynamic ?
Hi again,
i'm currently working on a solution to embed custom components really
dynamic.
In short:
I have a page with a custom component with a specific parameter.
The component does nothing else than embedding (one) another custom
component,
based upon the passed parameter value. (and doing some validation
etc...)
Sounds simple and could be done with the already known switch/block
construct.
But...
There will be up to 40+ (!) of these custom embedded components.
And now there are some problems:
- terrible maintenance / extension / changes
- too much hardcoded (at least for me)
- what's about performance issues/memory consumption?
-The "wrapper component" need to have bindings to 40 all possible
embeddable components. I think that could be problematic?
So i've tried it with some different approaches, dived into the API-
Docs but found nothing really helpful.
Every time i will stuck on the problem that every component has to be
known in the wrapper components template ...
Long speech, short sense:
Are there any ideas/solutions out there to embed components really
dynamic?
Greets from Berlin,
Stefan
btw: i found a solution on T4 on the lists, but every used class/
service is'nt available in T5.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Substitution for Switch/Case/Block to embed components really dynamic ?
Posted by Kristian Marinkovic <kr...@porsche.co.at>.
you have to wrap your components in a block... as done by the beaneditor
and inject them as examplified by thiago. this way your target page does
not have to know anything about the wrapped components.
i did something similar by introducing an own block service. which i
contribute
blocks from different pages (page / block id pairs). a page that should
display
different combinations of blocks just injects this block service and
displays the
blocks... if a block does not exist an empty block is displayed.
g,
kris
Ulrich Stärk <ul...@spielviel.de>
04.09.2009 14:33
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>
An
Tapestry users <us...@tapestry.apache.org>
Kopie
Thema
Re: Substitution for Switch/Case/Block to embed components really dynamic
?
No. That's the drawback of the caching of pages and their component
structure done by Tapestry.
Uli
On 04.09.2009 13:56 schrieb Stefan:
> I think Its the right direction, but there is always the main problem:
> How to get and add a component which is not defined/bound in any page
> template?
> Is that possible at all?
>
>
> Am 04.09.2009 um 01:43 schrieb Thiago H. de Paula Figueiredo:
>
>> BeanEditor and BeanEditForm use blocks from different pages to edit
>> properties. Its something similar to what you want to do. Ultimately,
>> they get a block from a given page using this code (adapted from
>> BeanBlockOverrideSourceImpl.toBlock()):
>>
>> Page page = pageCache.get(pageName);
>> return page.getRootElement().getBlock(blockId);
>>
>> where pageCache is an instance of RequestPageCache.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java consultant, developer, and instructor
>> http://www.arsmachina.com.br/thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Substitution for Switch/Case/Block to embed components really
dynamic ?
Posted by Ulrich Stärk <ul...@spielviel.de>.
No. That's the drawback of the caching of pages and their component structure done by Tapestry.
Uli
On 04.09.2009 13:56 schrieb Stefan:
> I think Its the right direction, but there is always the main problem:
> How to get and add a component which is not defined/bound in any page
> template?
> Is that possible at all?
>
>
> Am 04.09.2009 um 01:43 schrieb Thiago H. de Paula Figueiredo:
>
>> BeanEditor and BeanEditForm use blocks from different pages to edit
>> properties. Its something similar to what you want to do. Ultimately,
>> they get a block from a given page using this code (adapted from
>> BeanBlockOverrideSourceImpl.toBlock()):
>>
>> Page page = pageCache.get(pageName);
>> return page.getRootElement().getBlock(blockId);
>>
>> where pageCache is an instance of RequestPageCache.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java consultant, developer, and instructor
>> http://www.arsmachina.com.br/thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Substitution for Switch/Case/Block to embed components really dynamic ?
Posted by Stefan <st...@wammel.com>.
I think Its the right direction, but there is always the main problem:
How to get and add a component which is not defined/bound in any page
template?
Is that possible at all?
Am 04.09.2009 um 01:43 schrieb Thiago H. de Paula Figueiredo:
> BeanEditor and BeanEditForm use blocks from different pages to edit
> properties. Its something similar to what you want to do.
> Ultimately, they get a block from a given page using this code
> (adapted from BeanBlockOverrideSourceImpl.toBlock()):
>
> Page page = pageCache.get(pageName);
> return page.getRootElement().getBlock(blockId);
>
> where pageCache is an instance of RequestPageCache.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: Substitution for Switch/Case/Block to embed components really
dynamic ?
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
BeanEditor and BeanEditForm use blocks from different pages to edit
properties. Its something similar to what you want to do. Ultimately, they
get a block from a given page using this code (adapted from
BeanBlockOverrideSourceImpl.toBlock()):
Page page = pageCache.get(pageName);
return page.getRootElement().getBlock(blockId);
where pageCache is an instance of RequestPageCache.
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org