You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Moore <pa...@amplafi.com> on 2008/07/02 22:59:51 UTC
Re: [T5] About core components subclassing and methods with package visibility
you could always put a MyLabel subclass in the
"org.apache.tapestry5.corelib.components"
package and then derive from that. Java does let classes be in different
source directories and still be in the same package...
Its a little ugly ... but a whole lot better than the cut-and-paste that you
are doing now...
On Tue, Jun 24, 2008 at 8:05 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:
> I've faced the same situation more than once trying to build my own
> components that extend or slightly changes some existing T5-core component.
> For example, subclassing the Label component so it always ignores its body
> and generates the label name from the corresponding field id. That could be
> (almost) accomplished if I could override its afterRender() method (
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java?view=markup).
> The only solution I've found yet was copying the original component class
> and then changing it.
>
> Other examples are an ActionLink and a PageLink subclasses that have it's
> own activation context logic, having an object as parameter, not the context
> value itself. Again, I had to copy code instead of subclassing.
>
> Question to Howard: instead of having package visibility, could the core
> components have methods with protected visibility? And could their fields
> hava protected getters, so component subclasses can access superclass'
> parameter values? Or the current situation is the best one?
>
> Thank you very much in advance.
>
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Patrick Moore
Amplafi
650-207-9792
"copy/paste"
blog : http://www.sworddance.com/blog
Re: [T5] About core components subclassing and methods with package
visibility
Posted by Francois Armand <fa...@linagora.com>.
Patrick Moore wrote:
> you could always put a MyLabel subclass in the
> "org.apache.tapestry5.corelib.components"
> package and then derive from that. Java does let classes be in different
> source directories and still be in the same package...
>
> Its a little ugly ... but a whole lot better than the cut-and-paste that you
> are doing now...
>
Actually, it's not always sufficient since some properties were not
accessible at all (and of course were privates), or some part of logic
were not accessible, so what's for the cut&paste. But yes, it would have
been a solution fir simpler cases :)
--
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org
FederID - http://www.federid.org/
Open Source identities management and federation
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org