You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Steph <sd...@cariboo-networks.com> on 2008/01/08 22:45:52 UTC

T5 : declaration of pages and components packages from a library

Hi all,

I need to import in my tap5 project a library which includes tap5 pages
and components.
But when i try to extend a page from the library in my project, i get
the following exception :

java.lang.RuntimeException: Base class com.mylibrary.pages.FramePage
(super class of com.myproject.pages.Start) is not in a controlled
package and is therefore not valid. You should try moving the class to
package com.myproject.base.

Should i declare the 'pages' and 'components' directories of my library
in the tapestry.app-package context of my web.xml ? If yes, what is the
syntax to do such a declaration ?

Thanks in advance.

Stephane


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


Re: T5 : declaration of pages and components packages from a library

Posted by Chris Lewis <ch...@bellsouth.net>.
Hi Steph,

The problem is probably that you are trying to extend a class that 
exists in your pages package. As documented here 
(http://tapestry.apache.org/tapestry5/tapestry-core/guide/component-classes.html), 
you must put such base classes in a 'base' package. I'm not sure if the 
package must be named 'base', but I know that you cannot have base 
classes in 'pages', 'components', and probably not in 'mixins.' This is 
because T5 does some magic on these classes at runtime, and extending 
them would apparently cause failures.
On a personal note, I if you find yourself extending pages you may want 
to reexamine your design. This is just my opinion, but I'm a firm 
believer in shallow class hierarchies, and being that T5 provides such a 
rich environment for composite behavior without subclassing (via 
services and mixins especially), I avoid page extention.

sincerely,
chris

Steph wrote:
> Hi all,
>
> I need to import in my tap5 project a library which includes tap5 pages
> and components.
> But when i try to extend a page from the library in my project, i get
> the following exception :
>
> java.lang.RuntimeException: Base class com.mylibrary.pages.FramePage
> (super class of com.myproject.pages.Start) is not in a controlled
> package and is therefore not valid. You should try moving the class to
> package com.myproject.base.
>
> Should i declare the 'pages' and 'components' directories of my library
> in the tapestry.app-package context of my web.xml ? If yes, what is the
> syntax to do such a declaration ?
>
> Thanks in advance.
>
> Stephane
>
>
> ---------------------------------------------------------------------
> 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: T5 : declaration of pages and components packages from a library

Posted by Chris Lewis <ch...@bellsouth.net>.
While we're tossing out ideas, I accomplish the same thing without 
subclasses using layout components, which themselves (seamlessly) handle 
common CSS via @IncludeStyleSheet (or whatever its called). Any page (or 
component for that matter) that has specific styles (or scripts) can 
additionally add them in the same manner. It's these kinds of facilities 
I mean when I say that T5 provides ways of shared state/behavior, which 
are (imo) superior to subclassing.

chris

Daniel Jue wrote:
> I have a few components and pages that I extend, and I put them in a
> directory called "base", at the same level as the pages and components
> packages.
>
> For instance I have an AbstractReportPage that references Tapestry
> ASOs, Injects things and Persists things.  Then I have a few report
> page classes that implement different flavors of very similar things.
>
> It could be done differently for sure--This is just one way that works for me.
>
> I also use the base directory for concrete Tapestry related classes
> that don't belong in pages, components, services or mixins.  One
> example is a class than has the injected paths to all my css files and
> some images that are used across several border classes.
> Then I can do
>
> public class Border extends AssetContainer{
> }
>
>
>
> On Jan 8, 2008 5:03 PM, Shing Hing Man <ma...@yahoo.com> wrote:
>   
>> Have you tried the following ?
>>
>> Suppose org.man.tapestry5.components will hold the new
>> components.
>>
>> 1) add the following to AppModule
>>
>>
>>     public static void
>> contributeComponentClassResolver(Configuration<LibraryMapping>
>> configuration)
>>     {
>>         // Creates a virtual root pacakge for
>> pages,components.
>>         configuration.add(new LibraryMapping("man",
>> "org.man.tapestry5"));
>>     }
>>
>> 2) Suppose in  org.man.tapestry5.components, we have
>> component PageLinkPopup.java.
>>
>> Usage :
>>
>> <a href="#" t:type="man/pagelinkPopup" t:page="home"
>>    windowName="literal:my windown" features="literal:
>> 'resizable,scrollbars,top=100,left=200,height=300,width=500'"
>>     
>>> Home</a>
>>>       
>> or
>>
>>
>> <t:man.pagelinkPopup page="test/sum"
>>    windowName="literal:sum" features="literal:
>> 'resizable,scrollbars,top=100,left=200,height=300,width=500'"
>>     
>>> Sum</t:man.pagelinkPopup>
>>>       
>> Shing
>>
>>
>>
>> --- Steph <sd...@cariboo-networks.com> wrote:
>>
>>     
>>> Hi all,
>>>
>>> I need to import in my tap5 project a library which
>>> includes tap5 pages
>>> and components.
>>> But when i try to extend a page from the library in
>>> my project, i get
>>> the following exception :
>>>
>>> java.lang.RuntimeException: Base class
>>> com.mylibrary.pages.FramePage
>>> (super class of com.myproject.pages.Start) is not in
>>> a controlled
>>> package and is therefore not valid. You should try
>>> moving the class to
>>> package com.myproject.base.
>>>
>>> Should i declare the 'pages' and 'components'
>>> directories of my library
>>> in the tapestry.app-package context of my web.xml ?
>>> If yes, what is the
>>> syntax to do such a declaration ?
>>>
>>> Thanks in advance.
>>>
>>> Stephane
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>>     
>>> To unsubscribe, e-mail:
>>> users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail:
>>> users-help@tapestry.apache.org
>>>
>>>
>>>       
>> Home page : http://www.lombok.demon.co.uk/
>>
>>
>>
>>       ___________________________________________________________
>> Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
>> now.
>> http://uk.answers.yahoo.com/
>>
>>
>> ---------------------------------------------------------------------
>> 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: T5 : declaration of pages and components packages from a library

Posted by Daniel Jue <te...@gmail.com>.
I have a few components and pages that I extend, and I put them in a
directory called "base", at the same level as the pages and components
packages.

For instance I have an AbstractReportPage that references Tapestry
ASOs, Injects things and Persists things.  Then I have a few report
page classes that implement different flavors of very similar things.

It could be done differently for sure--This is just one way that works for me.

I also use the base directory for concrete Tapestry related classes
that don't belong in pages, components, services or mixins.  One
example is a class than has the injected paths to all my css files and
some images that are used across several border classes.
Then I can do

public class Border extends AssetContainer{
}



On Jan 8, 2008 5:03 PM, Shing Hing Man <ma...@yahoo.com> wrote:
> Have you tried the following ?
>
> Suppose org.man.tapestry5.components will hold the new
> components.
>
> 1) add the following to AppModule
>
>
>     public static void
> contributeComponentClassResolver(Configuration<LibraryMapping>
> configuration)
>     {
>         // Creates a virtual root pacakge for
> pages,components.
>         configuration.add(new LibraryMapping("man",
> "org.man.tapestry5"));
>     }
>
> 2) Suppose in  org.man.tapestry5.components, we have
> component PageLinkPopup.java.
>
> Usage :
>
> <a href="#" t:type="man/pagelinkPopup" t:page="home"
>    windowName="literal:my windown" features="literal:
> 'resizable,scrollbars,top=100,left=200,height=300,width=500'"
> >Home</a>
>
> or
>
>
> <t:man.pagelinkPopup page="test/sum"
>    windowName="literal:sum" features="literal:
> 'resizable,scrollbars,top=100,left=200,height=300,width=500'"
> >Sum</t:man.pagelinkPopup>
>
> Shing
>
>
>
> --- Steph <sd...@cariboo-networks.com> wrote:
>
> > Hi all,
> >
> > I need to import in my tap5 project a library which
> > includes tap5 pages
> > and components.
> > But when i try to extend a page from the library in
> > my project, i get
> > the following exception :
> >
> > java.lang.RuntimeException: Base class
> > com.mylibrary.pages.FramePage
> > (super class of com.myproject.pages.Start) is not in
> > a controlled
> > package and is therefore not valid. You should try
> > moving the class to
> > package com.myproject.base.
> >
> > Should i declare the 'pages' and 'components'
> > directories of my library
> > in the tapestry.app-package context of my web.xml ?
> > If yes, what is the
> > syntax to do such a declaration ?
> >
> > Thanks in advance.
> >
> > Stephane
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail:
> > users-help@tapestry.apache.org
> >
> >
>
>
> Home page : http://www.lombok.demon.co.uk/
>
>
>
>       ___________________________________________________________
> Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
> now.
> http://uk.answers.yahoo.com/
>
>
> ---------------------------------------------------------------------
> 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: T5 : declaration of pages and components packages from a library

Posted by Shing Hing Man <ma...@yahoo.com>.
Have you tried the following ?

Suppose org.man.tapestry5.components will hold the new
components.

1) add the following to AppModule


    public static void
contributeComponentClassResolver(Configuration<LibraryMapping>
configuration)
    {
        // Creates a virtual root pacakge for
pages,components.
        configuration.add(new LibraryMapping("man",
"org.man.tapestry5"));
    }

2) Suppose in  org.man.tapestry5.components, we have
component PageLinkPopup.java.

Usage :

<a href="#" t:type="man/pagelinkPopup" t:page="home"
   windowName="literal:my windown" features="literal:
'resizable,scrollbars,top=100,left=200,height=300,width=500'"
>Home</a>

or


<t:man.pagelinkPopup page="test/sum"
   windowName="literal:sum" features="literal:
'resizable,scrollbars,top=100,left=200,height=300,width=500'"
>Sum</t:man.pagelinkPopup>

Shing


--- Steph <sd...@cariboo-networks.com> wrote:

> Hi all,
> 
> I need to import in my tap5 project a library which
> includes tap5 pages
> and components.
> But when i try to extend a page from the library in
> my project, i get
> the following exception :
> 
> java.lang.RuntimeException: Base class
> com.mylibrary.pages.FramePage
> (super class of com.myproject.pages.Start) is not in
> a controlled
> package and is therefore not valid. You should try
> moving the class to
> package com.myproject.base.
> 
> Should i declare the 'pages' and 'components'
> directories of my library
> in the tapestry.app-package context of my web.xml ?
> If yes, what is the
> syntax to do such a declaration ?
> 
> Thanks in advance.
> 
> Stephane
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
> 
> 


Home page : http://www.lombok.demon.co.uk/



      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 

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