You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by karthik G <be...@gmail.com> on 2007/01/09 15:14:30 UTC

Extending existing component and .page file

class X extends Y{}

If component X extends an existing component Y by providing a new template
X.html and adding additional property in X.jwc, are we required to copy the
contents of Y.jwc into X.jwc?

If I dont include it, i run into errors.

May be am missing some parameter here. How can i get a .page to extend from
another base .page?

Also , if Class X is empty do I need to create one in the first place ( am
fine with Y)?

I just need .page inheritance in addition to Java component inheritance.

thanks,
Karthik

Re: Extending existing component and .page file

Posted by James Carman <ja...@carmanconsulting.com>.
What are you looking to do?  What version of Tapestry are you using?
If you're looking to automatically inject a HiveMind service into all
of your pages/components, you can either use tapestry-autowire (tap
4.0) or upgrade to tap 4.1 which has tapestry-autowire built in.
Using tapestry-autowire, it's as simple as declaring an abstract
getter of the same type as one of your services in your HM registry
(provided there is exactly one service point which supports that
service interface):

public abstract MyService getMyService();

You can declare that in your MyAbstractPage class (or whatever you
want to call it) and all subclasses will inherit the property and
it'll be injected automatically.  Hope that helps.


On 1/9/07, karthik G <be...@gmail.com> wrote:
> class X extends Y{}
>
> If component X extends an existing component Y by providing a new template
> X.html and adding additional property in X.jwc, are we required to copy the
> contents of Y.jwc into X.jwc?
>
> If I dont include it, i run into errors.
>
> May be am missing some parameter here. How can i get a .page to extend from
> another base .page?
>
> Also , if Class X is empty do I need to create one in the first place ( am
> fine with Y)?
>
> I just need .page inheritance in addition to Java component inheritance.
>
> thanks,
> Karthik
>
>

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


Re: Extending existing component and .page file

Posted by karthik G <be...@gmail.com>.
Thanks. Yes, I'm trying to customize Contrib's TablePages component. I just
need a different look and feel at the template level and I could get it to
work by copying the TablePages.jwc contents.
It will be nice to have this patch. It will be really nice if we could have
an extra parameter along the lines of inherit="" or something of that sort
in the .page that automatically takes care of this issue.

thanks,
Karthik

On 1/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
>
> You'll
> - either have to use annotations if you're on Java 5. They're inherited
> correctly.
> - on Tapestry 3 you could include the common .jwc XML fragments as
> external entities starting with Tap4 this functionality is broken. A
> patch exists, if you want it you can vote on
> http://issues.apache.org/jira/browse/TAPESTRY-967
>
> If your class X would be empty you are fine with Y.
>
> > -----Original Message-----
> > From: karthik G [mailto:beginner.tapestry@gmail.com]
> > Sent: Tuesday, January 09, 2007 3:15 PM
> > To: Tapestry users
> > Subject: Extending existing component and .page file
> >
> > class X extends Y{}
> >
> > If component X extends an existing component Y by providing a
> > new template X.html and adding additional property in X.jwc,
> > are we required to copy the contents of Y.jwc into X.jwc?
> >
> > If I dont include it, i run into errors.
> >
> > May be am missing some parameter here. How can i get a .page
> > to extend from another base .page?
> >
> > Also , if Class X is empty do I need to create one in the
> > first place ( am fine with Y)?
> >
> > I just need .page inheritance in addition to Java component
> > inheritance.
> >
> > thanks,
> > Karthik
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

RE: Extending existing component and .page file

Posted by Ma...@bmw.ch.
You'll 
 - either have to use annotations if you're on Java 5. They're inherited
correctly.
 - on Tapestry 3 you could include the common .jwc XML fragments as
external entities starting with Tap4 this functionality is broken. A
patch exists, if you want it you can vote on 
http://issues.apache.org/jira/browse/TAPESTRY-967

If your class X would be empty you are fine with Y. 

> -----Original Message-----
> From: karthik G [mailto:beginner.tapestry@gmail.com] 
> Sent: Tuesday, January 09, 2007 3:15 PM
> To: Tapestry users
> Subject: Extending existing component and .page file
> 
> class X extends Y{}
> 
> If component X extends an existing component Y by providing a 
> new template X.html and adding additional property in X.jwc, 
> are we required to copy the contents of Y.jwc into X.jwc?
> 
> If I dont include it, i run into errors.
> 
> May be am missing some parameter here. How can i get a .page 
> to extend from another base .page?
> 
> Also , if Class X is empty do I need to create one in the 
> first place ( am fine with Y)?
> 
> I just need .page inheritance in addition to Java component 
> inheritance.
> 
> thanks,
> Karthik
> 

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