You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Stroeber, Andreas" <an...@siemens.com> on 2008/03/11 12:34:20 UTC

T4: binding stylesheets to components

Hi there,

My T4-Application uses several components. So I added a component
MessageDialog. This component is inserted in the pages via Annotation

    @Component
    public abstract MessageDialog getMessageDialog();

My problem now is:
I can add a messagedialog.css via Annotation @Asset or via <asset> in
the .jwc-file to the component. But how to insert this css now to the
main page? Do I really have to add this cssAsset to each page via
@Shell? What I am looking for is something like "this component uses
this css as default, use this for every page that references this
component without being forced to add the css to each page seperately".
I tried a @Shell in to component's HTML-Template but without success.

I think T5 provides something like that with the @IncludeStylesheet. Is
there something for T4?

Thx
Andi


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


Re: T4: binding stylesheets to components

Posted by Andreas Andreou <an...@gmail.com>.
Yes, assets are the way to go - they solve the path issues

On Tue, Mar 11, 2008 at 6:47 PM, Stroeber, Andreas
<an...@siemens.com> wrote:
> OK... I found a way to do this. I would call it a "workaround" as it is not very pretty to configure things at multiple different code locations. :-( If anyone knows a "better" way... I am interested in that.
>
>  Dialog.html
>   <link jwcid="@Style" href="asset:cssMessageDialog" rel="stylesheet" type="text/css" media="screen" />
>
>   <style jwcid="@Style" media="screen"/>
>
>  Dialog.java
>   @Asset("context:/css/messagedialog.css")
>   public abstract IAsset getCssMessageDialog();
>
>  Grz
>  andi
>
>
>  -----Ursprüngliche Nachricht-----
>  Von: Stroeber, Andreas
>  Gesendet: Dienstag, 11. März 2008 16:58
>  An: Tapestry users
>  Betreff: AW: T4: binding stylesheets to components
>
>
>
>  Yes... So far so good.
>
>  <link jwcid="@Style" href="css/style.css" rel="stylesheet" type="text/css" media="screen" /> <style jwcid="@Style" media="screen"/>
>
>  Now I get some css-Link in my body. But it links to http://localhost/css/style.css.
>  How to point it to http://localhost/mytapapp/app/css/style.css?
>
>  href="context:css/style.css" doesn't work. :-(
>
>
>
>  -----Ursprüngliche Nachricht-----
>  Von: Andreas Andreou [mailto:andreoua@gmail.com]
>  Gesendet: Dienstag, 11. März 2008 13:22
>  An: Tapestry users
>  Betreff: Re: T4: binding stylesheets to components
>
>  you mean like the @Style and @Relation components?
>  http://tapestry.apache.org/tapestry4.1/components/general/style.html
>  http://tapestry.apache.org/tapestry4.1/components/general/relation.html
>
>  On Tue, Mar 11, 2008 at 1:34 PM, Stroeber, Andreas <an...@siemens.com> wrote:
>  > Hi there,
>  >
>  >  My T4-Application uses several components. So I added a component
>  > MessageDialog. This component is inserted in the pages via Annotation
>  >
>  >     @Component
>  >     public abstract MessageDialog getMessageDialog();
>  >
>  >  My problem now is:
>  >  I can add a messagedialog.css via Annotation @Asset or via <asset> in
>  > the .jwc-file to the component. But how to insert this css now to the
>  > main page? Do I really have to add this cssAsset to each page via
>  > @Shell? What I am looking for is something like "this component uses
>  > this css as default, use this for every page that references this
>  > component without being forced to add the css to each page seperately".
>  >  I tried a @Shell in to component's HTML-Template but without success.
>  >
>  >  I think T5 provides something like that with the @IncludeStylesheet.
>  > Is  there something for T4?
>  >
>  >  Thx
>  >  Andi
>  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  >  For additional commands, e-mail: users-help@tapestry.apache.org
>  >
>  >
>
>
>
>  --
>  Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting
>
>  ---------------------------------------------------------------------
>  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
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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


AW: T4: binding stylesheets to components

Posted by "Stroeber, Andreas" <an...@siemens.com>.
OK... I found a way to do this. I would call it a "workaround" as it is not very pretty to configure things at multiple different code locations. :-( If anyone knows a "better" way... I am interested in that.

Dialog.html
  <link jwcid="@Style" href="asset:cssMessageDialog" rel="stylesheet" type="text/css" media="screen" />  
  <style jwcid="@Style" media="screen"/> 

Dialog.java
  @Asset("context:/css/messagedialog.css")
  public abstract IAsset getCssMessageDialog();

Grz
andi


-----Ursprüngliche Nachricht-----
Von: Stroeber, Andreas 
Gesendet: Dienstag, 11. März 2008 16:58
An: Tapestry users
Betreff: AW: T4: binding stylesheets to components

Yes... So far so good.

<link jwcid="@Style" href="css/style.css" rel="stylesheet" type="text/css" media="screen" /> <style jwcid="@Style" media="screen"/> 

Now I get some css-Link in my body. But it links to http://localhost/css/style.css.
How to point it to http://localhost/mytapapp/app/css/style.css?

href="context:css/style.css" doesn't work. :-(



-----Ursprüngliche Nachricht-----
Von: Andreas Andreou [mailto:andreoua@gmail.com]
Gesendet: Dienstag, 11. März 2008 13:22
An: Tapestry users
Betreff: Re: T4: binding stylesheets to components

you mean like the @Style and @Relation components?
http://tapestry.apache.org/tapestry4.1/components/general/style.html
http://tapestry.apache.org/tapestry4.1/components/general/relation.html

On Tue, Mar 11, 2008 at 1:34 PM, Stroeber, Andreas <an...@siemens.com> wrote:
> Hi there,
>
>  My T4-Application uses several components. So I added a component 
> MessageDialog. This component is inserted in the pages via Annotation
>
>     @Component
>     public abstract MessageDialog getMessageDialog();
>
>  My problem now is:
>  I can add a messagedialog.css via Annotation @Asset or via <asset> in 
> the .jwc-file to the component. But how to insert this css now to the 
> main page? Do I really have to add this cssAsset to each page via 
> @Shell? What I am looking for is something like "this component uses 
> this css as default, use this for every page that references this 
> component without being forced to add the css to each page seperately".
>  I tried a @Shell in to component's HTML-Template but without success.
>
>  I think T5 provides something like that with the @IncludeStylesheet. 
> Is  there something for T4?
>
>  Thx
>  Andi
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>



--
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting

---------------------------------------------------------------------
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


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


Re: AW: T4: binding stylesheets to components

Posted by Ulrich Stärk <ul...@spielviel.de>.
My web apps have a layout of

context
|-- Home.html
|-- WEB-INF
|   |-- app.application
|   `-- Echo.html
`-- css
     `-- style.css

Echo.html is the template for a component which gets included in Home.html. If I include <link 
jwcid="@Style" href="css/style.css" rel="stylesheet" type="text/css" media="screen" /> anywhere 
inside $content$ of Echo's template and call Home.html, <link rel="stylesheet" type="text/css" 
media="screen" href="css/style.css" /> gets rendered inside the <head> block. This gets interpreted 
as relative to Home.html's location so if my app resides at http://localhost:8080/testapp/ and I 
call Home.html with http://localhost:8080/testapp/Home.html (when using pretty URLs, otherwise 
something like app?service=page&page=Home) my style sheet will be searched in 
http://localhost:8080/testapp/css/style.css which is absolutely correct. This is not working when 
including the same component on pages in subdirectories though for obvious reasons...

Uli

P.S.: I'll probably be in FTH W monday and tuesday next week, so if you want to exchange some 
thoughts write me an email (officially I'm on holiday right now :-))

Stroeber, Andreas schrieb:
> Yes... So far so good.
> 
> <link jwcid="@Style" href="css/style.css" rel="stylesheet" type="text/css" media="screen" />  
> <style jwcid="@Style" media="screen"/> 
> 
> Now I get some css-Link in my body. But it links to http://localhost/css/style.css.
> How to point it to http://localhost/mytapapp/app/css/style.css?
> 
> href="context:css/style.css" doesn't work. :-(
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Andreas Andreou [mailto:andreoua@gmail.com] 
> Gesendet: Dienstag, 11. März 2008 13:22
> An: Tapestry users
> Betreff: Re: T4: binding stylesheets to components
> 
> you mean like the @Style and @Relation components?
> http://tapestry.apache.org/tapestry4.1/components/general/style.html
> http://tapestry.apache.org/tapestry4.1/components/general/relation.html
> 
> On Tue, Mar 11, 2008 at 1:34 PM, Stroeber, Andreas <an...@siemens.com> wrote:
>> Hi there,
>>
>>  My T4-Application uses several components. So I added a component  
>> MessageDialog. This component is inserted in the pages via Annotation
>>
>>     @Component
>>     public abstract MessageDialog getMessageDialog();
>>
>>  My problem now is:
>>  I can add a messagedialog.css via Annotation @Asset or via <asset> in  
>> the .jwc-file to the component. But how to insert this css now to the  
>> main page? Do I really have to add this cssAsset to each page via  
>> @Shell? What I am looking for is something like "this component uses  
>> this css as default, use this for every page that references this  
>> component without being forced to add the css to each page seperately".
>>  I tried a @Shell in to component's HTML-Template but without success.
>>
>>  I think T5 provides something like that with the @IncludeStylesheet. 
>> Is  there something for T4?
>>
>>  Thx
>>  Andi
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>  For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> --
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting
> 
> ---------------------------------------------------------------------
> 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
> 


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


AW: T4: binding stylesheets to components

Posted by "Stroeber, Andreas" <an...@siemens.com>.
Yes... So far so good.

<link jwcid="@Style" href="css/style.css" rel="stylesheet" type="text/css" media="screen" />  
<style jwcid="@Style" media="screen"/> 

Now I get some css-Link in my body. But it links to http://localhost/css/style.css.
How to point it to http://localhost/mytapapp/app/css/style.css?

href="context:css/style.css" doesn't work. :-(



-----Ursprüngliche Nachricht-----
Von: Andreas Andreou [mailto:andreoua@gmail.com] 
Gesendet: Dienstag, 11. März 2008 13:22
An: Tapestry users
Betreff: Re: T4: binding stylesheets to components

you mean like the @Style and @Relation components?
http://tapestry.apache.org/tapestry4.1/components/general/style.html
http://tapestry.apache.org/tapestry4.1/components/general/relation.html

On Tue, Mar 11, 2008 at 1:34 PM, Stroeber, Andreas <an...@siemens.com> wrote:
> Hi there,
>
>  My T4-Application uses several components. So I added a component  
> MessageDialog. This component is inserted in the pages via Annotation
>
>     @Component
>     public abstract MessageDialog getMessageDialog();
>
>  My problem now is:
>  I can add a messagedialog.css via Annotation @Asset or via <asset> in  
> the .jwc-file to the component. But how to insert this css now to the  
> main page? Do I really have to add this cssAsset to each page via  
> @Shell? What I am looking for is something like "this component uses  
> this css as default, use this for every page that references this  
> component without being forced to add the css to each page seperately".
>  I tried a @Shell in to component's HTML-Template but without success.
>
>  I think T5 provides something like that with the @IncludeStylesheet. 
> Is  there something for T4?
>
>  Thx
>  Andi
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>



--
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting

---------------------------------------------------------------------
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: T4: binding stylesheets to components

Posted by Andreas Andreou <an...@gmail.com>.
you mean like the @Style and @Relation components?
http://tapestry.apache.org/tapestry4.1/components/general/style.html
http://tapestry.apache.org/tapestry4.1/components/general/relation.html

On Tue, Mar 11, 2008 at 1:34 PM, Stroeber, Andreas
<an...@siemens.com> wrote:
> Hi there,
>
>  My T4-Application uses several components. So I added a component
>  MessageDialog. This component is inserted in the pages via Annotation
>
>     @Component
>     public abstract MessageDialog getMessageDialog();
>
>  My problem now is:
>  I can add a messagedialog.css via Annotation @Asset or via <asset> in
>  the .jwc-file to the component. But how to insert this css now to the
>  main page? Do I really have to add this cssAsset to each page via
>  @Shell? What I am looking for is something like "this component uses
>  this css as default, use this for every page that references this
>  component without being forced to add the css to each page seperately".
>  I tried a @Shell in to component's HTML-Template but without success.
>
>  I think T5 provides something like that with the @IncludeStylesheet. Is
>  there something for T4?
>
>  Thx
>  Andi
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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