You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ron Piterman <mp...@vollbio.de> on 2005/07/01 01:34:17 UTC

Re: abstract base page spec

I have tried a few times using base classes and inheritance.
At the end I came to the conclusion that "the tapestry way" is using 
components *instead* - if a page is a "container" with some 
functionality, a component is also a container... so instead of 
implementing things on the page scope, implement them on a component, 
and drop the component on a page...
Cheers,
Ron


ציטוט Michael Engelhart:
> Thanks but I'm using Java 1.4.x and Tapestry 3.0.
> On 6/29/05, Nick Stuart <ba...@gmail.com> wrote:
> 
>>You can with annotations fairly easiely, and you can even do it with
>>interfaces if you really want (Howard shows an example of this
>>somewhere).
>>
>> Say you have an object you wanted injected into some
>>pages/components, write an interface like so:
>>
>>public interface ObjectUser {
>>
>>    @InjectObject("service:someService")
>>    public SomeService getSomeService();
>>
>>}
>>
>>then, if you wanted a page/comp to be able to access this just
>>implement the interface and call the method. Really is that easy. I
>>thought this was pretty slick at least.
>>
>>-Nick
>>
>>
>>On 6/29/05, Michael Engelhart <mo...@gmail.com> wrote:
>>
>>>Hi -
>>>Is there a way to create a templateless abstract base page for a Tapestry app?
>>>
>>>I currently have a base page class that extends BasePage but I want to
>>>make that class be able to take advantage of a page specification to
>>>limit the writing of code make clean up of persistent properties
>>>easier.
>>>
>>>Is there a way to do this?
>>>
>>>THanks
>>>Mike
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: abstract base page spec

Posted by Nick Stuart <ba...@gmail.com>.
Michael, there is absolutly nothing wrong with the way you are doing
it. I almost always have my own BasePage that gets inheritated for
using common methods and such. The only tricky part is when you want
your base page to also have Tapestry specifics bits and pieces in it
that inheritance is an issue (much less so with the new annotations).

If your base page has components/abstract methods/etc, they will also
need to be declared in each .page file that extends it, and could get
messy. Which is what I think Ron was referring to (yell if its not!).

-Nick

On 7/1/05, Michael Engelhart <mo...@gmail.com> wrote:
> Is that really the case?  That the Tapestry way is to create
> components instead of inheritance?  For example I have code that I use
> in almost every page and it's much less brittle to just call a method
> name rather than calling getComponent() with a string parameter.
> 
> I mean I use components all the time and they're very powerful but in
> cases where every page has the same method it just seems more OO to
> put it in a base class.
> 
> But I'm relatively new to Tapestry so I may be off base. :-)
> 
> Mike
>

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


Re: abstract base page spec

Posted by Michael Engelhart <mo...@gmail.com>.
Is that really the case?  That the Tapestry way is to create
components instead of inheritance?  For example I have code that I use
in almost every page and it's much less brittle to just call a method
name rather than calling getComponent() with a string parameter.

I mean I use components all the time and they're very powerful but in
cases where every page has the same method it just seems more OO to
put it in a base class.

But I'm relatively new to Tapestry so I may be off base. :-)

Mike

On 6/30/05, Ron Piterman <mp...@vollbio.de> wrote:
> I have tried a few times using base classes and inheritance.
> At the end I came to the conclusion that "the tapestry way" is using
> components *instead* - if a page is a "container" with some
> functionality, a component is also a container... so instead of
> implementing things on the page scope, implement them on a component,
> and drop the component on a page...
> Cheers,
> Ron
> 
> 
> ציטוט Michael Engelhart:
> > Thanks but I'm using Java 1.4.x and Tapestry 3.0.
> > On 6/29/05, Nick Stuart <ba...@gmail.com> wrote:
> >
> >>You can with annotations fairly easiely, and you can even do it with
> >>interfaces if you really want (Howard shows an example of this
> >>somewhere).
> >>
> >> Say you have an object you wanted injected into some
> >>pages/components, write an interface like so:
> >>
> >>public interface ObjectUser {
> >>
> >>    @InjectObject("service:someService")
> >>    public SomeService getSomeService();
> >>
> >>}
> >>
> >>then, if you wanted a page/comp to be able to access this just
> >>implement the interface and call the method. Really is that easy. I
> >>thought this was pretty slick at least.
> >>
> >>-Nick
> >>
> >>
> >>On 6/29/05, Michael Engelhart <mo...@gmail.com> wrote:
> >>
> >>>Hi -
> >>>Is there a way to create a templateless abstract base page for a Tapestry app?
> >>>
> >>>I currently have a base page class that extends BasePage but I want to
> >>>make that class be able to take advantage of a page specification to
> >>>limit the writing of code make clean up of persistent properties
> >>>easier.
> >>>
> >>>Is there a way to do this?
> >>>
> >>>THanks
> >>>Mike
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>