Why should you have the same rendering code in two different components?
When I have common code for several components I create an abstract base 
component and put it into the base package. The template is not mandatory for 
components or abstract base components/pages btw. You can use subclassing 
whenever you want but that doesn't always makes your code better. 

If you have common logic in different components you should move it into a 
service...

Well, and I think tapestry can't free you from your dirtyness, you should try 
soap :)


Am 13.05.2010 um 14:28 schrieb Benny Law:

> I also wish component subclassing was at least an option. What I don't like
> about copying and pasting from a Tapestry component is that I end up relying
> on some internal packages and classes. That makes me feel dirty.
> 
> Benny
> 
> 
> On Thu, May 13, 2010 at 7:47 AM, Andreas Bohnert <a...@weberhofer.at> wrote:
> 
>> I agree.
>> I'm upgrading a big project from tapestry 3 to 5.
>> As I looked into the documentation and sources of tapestry 5 I thought:
>> wow, this is really great. it could not be any better!
>> 
>> But if components are no meant to be subclassed this seems like a drawback
>> for me. You have to copy and adjust the code which does not fit into the
>> tapestry world (DRY principle)
>> If you use embedded components to extend a component you need an additional
>> (more or less useless) template file and you come in trouble if you use this
>> component multiple times in a page (because of the embedded components id
>> binding)
>> 
>> Anyway, even if there is way to get around these problems with embedded
>> components I described, it would feel more natural for me if I just could
>> subclass a component.
>> 
>> Andreas
>> 
>> 
>> 
>> I ended up copying
>> 
>> 
>> Nicolas Bouillon wrote:
>> 
>>> Le 11/05/2010 21:34, Thiago H. de Paula Figueiredo a écrit :
>>> 
>>>> 1.) Extend MySelect from Select
>>>>> I found no way to assign my model to the selects privat model. There is
>>>>> a setModel in Select but it seems to be there only for unit tests.
>>>>> 
>>>> 
>>>> Tapestry components weren't meant to be subclassed.
>>>> 
>>> By the way, why that ?
>>> 
>>> It's one thing I felt difficult, for example to change the way the
>>> GridPager is displayed (to display the number of pages, number of items), we
>>> had to do a big copy paste of the Grid component and the related components,
>>> instead of subclassing it.
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 


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

Reply via email to