You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nick Westgate <ni...@key-planning.co.jp> on 2006/09/01 04:49:15 UTC

Re: multiple stylesheets

Hi Brian.

Hopefully someone using T4 can offer you more help,
but in my current T3 project I do this via ...

Border.jwc - which has a stylesheets parameter:

...
<component-specification
     class="blah.blah.Border"
     allow-informal-parameters="no">

     <parameter name="stylesheets" type="java.lang.Object" direction="in"/>

     <component id="shell" type="Shell">
         <binding name="title" expression="title"/>
         <binding name="stylesheets" expression="stylesheets"/>
         <binding name="doctype">
             'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
         </binding>
     </component>
...

SomePage.html - which passes the array of stylesheet assets:

<html>
<head>
</head>
<body jwcid="$content$">
<div jwcid="border" stylesheets="ognl:{assets.common, assets.apply}">
...

SomePage.page - which defines the css assets:

     <context-asset name="common" path="css/common.css"/>
     <context-asset name="apply" path="css/apply.css"/>

Cheers,
Nick.


Brian Long wrote:
> Hi all,
> 
> I'm afraid I might have dug myself into a hole (again!), but I hope someone
> my have already encountered this problem and is willing to let me know of a
> possible solution.
> 
> I'm trying to add multiple stylesheets to my web project, I'm currently
> using a @Shell component to enclose my web pages, this has a single
> stylesheet as per the example on the tapestry website.
> 
> <span jwcid="@Shell" stylesheet="asset:stylesheet" title="MyCorp Customer
> Login">
> 
> I want to add some more, and according to the component description there's
> a parameter "stylesheets" that will take an array of IAssets, this is want
> I'd like to do, the only problem is that my shell in inside a custom 
> @Border
> component.
> 
> Soooooo, I have a Border.html and Border.jwc and I have to try and create
> an array of IAssets (my list of stylesheets). How do I do this, create a
> Border.java?
> 
> Any suggestions would be much appreciated . . .
> 
> /Brian.
> 

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


Re: multiple stylesheets

Posted by andyhot <an...@di.uoa.gr>.
Well, in Tapestry 4.1.1 there's a new component @Style that can append
stylesheets
inside <HEAD>. It can be used from anywhere - even components can have
their needed
stylesheets appended. Here's some example usages:

<link jwcid="@Style" href="main.css" media="all"/>  
<link jwcid="@Style" href="asset:style1" title="main"/>  
<link jwcid="@Style" href="asset:style2" title="other" rel="alternate stylesheet"/>  

In Tapestry 4.0 or older, you should make use of the delegate parameter of @Shell
You supply it with an IRender implementation, and it gets rendered just before
</HEAD>




Brian Long wrote:
> Nick,
>
> that worked perfectly, thanks! I just had to change a few things for
> it to
> comply with T4, but unfortunately now I'm faced with another problem,
> there's no titles on my stylesheets.
>
> Border.html
> <html jwcid="shell"
> stylesheets="ognl:{assets.stylesheet1,assets.stylesheet2
> }">
>
> Border.jwc
> <asset name="stylesheet1" path="context:css/style.css" />
> <asset name="stylesheet2" path="context:css/template.css" />
>
> gives me:
>
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/style.css"
> />
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/template.css" />
>
> but I'd like:
>
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/style.css"title="default"
> />
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/template.css" title="super"/>
>
> So as I can select them on the fly from my browser's view->use style
> setting. If you or anyone else has already figured out how to do this I'd
> like to hear how it's done.
>
> Thanks again, Brian.
>
>
> On 9/1/06, Nick Westgate <ni...@key-planning.co.jp> wrote:
>> Hi Brian.
>>
>> Hopefully someone using T4 can offer you more help,
>> but in my current T3 project I do this via ...
>>
>> Border.jwc - which has a stylesheets parameter:
>>
>> ...
>> <component-specification
>>      class="blah.blah.Border"
>>      allow-informal-parameters="no">
>>
>>      <parameter name="stylesheets" type="java.lang.Object"
> direction="in"/>
>>
>>      <component id="shell" type="Shell">
>>          <binding name="title" expression="title"/>
>>          <binding name="stylesheets" expression="stylesheets"/>
>>          <binding name="doctype">
>>              'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
>>          </binding>
>>      </component>
>> ...
>>
>> SomePage.html - which passes the array of stylesheet assets:
>>
>> <html>
>> <head>
>> </head>
>> <body jwcid="$content$">
>> <div jwcid="border" stylesheets="ognl:{assets.common, assets.apply}">
>> ...
>>
>> SomePage.page - which defines the css assets:
>>
>>      <context-asset name="common" path="css/common.css"/>
>>      <context-asset name="apply" path="css/apply.css"/>
>>
>> Cheers,
>> Nick.
>>
>>
>> Brian Long wrote:
>> > Hi all,
>> >
>> > I'm afraid I might have dug myself into a hole (again!), but I hope
> someone
>> > my have already encountered this problem and is willing to let me know
> of a
>> > possible solution.
>> >
>> > I'm trying to add multiple stylesheets to my web project, I'm
>> currently
>> > using a @Shell component to enclose my web pages, this has a single
>> > stylesheet as per the example on the tapestry website.
>> >
>> > <span jwcid="@Shell" stylesheet="asset:stylesheet" title="MyCorp
> Customer
>> > Login">
>> >
>> > I want to add some more, and according to the component description
> there's
>> > a parameter "stylesheets" that will take an array of IAssets, this is
> want
>> > I'd like to do, the only problem is that my shell in inside a custom
>> > @Border
>> > component.
>> >
>> > Soooooo, I have a Border.html and Border.jwc and I have to try and
> create
>> > an array of IAssets (my list of stylesheets). How do I do this,
>> create a
>> > Border.java?
>> >
>> > Any suggestions would be much appreciated . . .
>> >
>> > /Brian.
>> >
>>
>> ---------------------------------------------------------------------
>> 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://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


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


Re: multiple stylesheets

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Brian,

I've never had to do that, but it's pretty easy to hack the
built-in Tapestry components. Just look at the java source
for Shell and add the outputting of the title attributes.

In this case it looks like that would be easy if you want the
stylesheet title based on the css filename, but if you need to
provide a different name for each one you'll have to do more.

Perhaps add another Shell parameter that takes an array of
title strings for the stylesheets.

Cheers,
Nick.


Brian Long wrote:
> Nick,
> 
> that worked perfectly, thanks! I just had to change a few things for it to
> comply with T4, but unfortunately now I'm faced with another problem,
> there's no titles on my stylesheets.
> 
> Border.html
> <html jwcid="shell" 
> stylesheets="ognl:{assets.stylesheet1,assets.stylesheet2
> }">
> 
> Border.jwc
> <asset name="stylesheet1" path="context:css/style.css" />
> <asset name="stylesheet2" path="context:css/template.css" />
> 
> gives me:
> 
> <link rel="stylesheet" type="text/css" href="/fast-store-app/css/style.css"
> />
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/template.css" />
> 
> but I'd like:
> 
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/style.css"title="default"
> />
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/template.css" title="super"/>
> 
> So as I can select them on the fly from my browser's view->use style
> setting. If you or anyone else has already figured out how to do this I'd
> like to hear how it's done.
> 
> Thanks again, Brian.
> 
> 
> On 9/1/06, Nick Westgate <ni...@key-planning.co.jp> wrote:
> 
>> Hi Brian.
>>
>> Hopefully someone using T4 can offer you more help,
>> but in my current T3 project I do this via ...
>>
>> Border.jwc - which has a stylesheets parameter:
>>
>> ...
>> <component-specification
>>      class="blah.blah.Border"
>>      allow-informal-parameters="no">
>>
>>      <parameter name="stylesheets" type="java.lang.Object"
> 
> direction="in"/>
> 
>>
>>      <component id="shell" type="Shell">
>>          <binding name="title" expression="title"/>
>>          <binding name="stylesheets" expression="stylesheets"/>
>>          <binding name="doctype">
>>              'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
>>          </binding>
>>      </component>
>> ...
>>
>> SomePage.html - which passes the array of stylesheet assets:
>>
>> <html>
>> <head>
>> </head>
>> <body jwcid="$content$">
>> <div jwcid="border" stylesheets="ognl:{assets.common, assets.apply}">
>> ...
>>
>> SomePage.page - which defines the css assets:
>>
>>      <context-asset name="common" path="css/common.css"/>
>>      <context-asset name="apply" path="css/apply.css"/>
>>
>> Cheers,
>> Nick.
>>
>>
>> Brian Long wrote:
>> > Hi all,
>> >
>> > I'm afraid I might have dug myself into a hole (again!), but I hope
> 
> someone
> 
>> > my have already encountered this problem and is willing to let me know
> 
> of a
> 
>> > possible solution.
>> >
>> > I'm trying to add multiple stylesheets to my web project, I'm currently
>> > using a @Shell component to enclose my web pages, this has a single
>> > stylesheet as per the example on the tapestry website.
>> >
>> > <span jwcid="@Shell" stylesheet="asset:stylesheet" title="MyCorp
> 
> Customer
> 
>> > Login">
>> >
>> > I want to add some more, and according to the component description
> 
> there's
> 
>> > a parameter "stylesheets" that will take an array of IAssets, this is
> 
> want
> 
>> > I'd like to do, the only problem is that my shell in inside a custom
>> > @Border
>> > component.
>> >
>> > Soooooo, I have a Border.html and Border.jwc and I have to try and
> 
> create
> 
>> > an array of IAssets (my list of stylesheets). How do I do this, 
>> create a
>> > Border.java?
>> >
>> > Any suggestions would be much appreciated . . .
>> >
>> > /Brian.
>> >
>>
>> ---------------------------------------------------------------------
>> 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: multiple stylesheets

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
This is exactly why I dont use the Border pattern. you dont need it if you 
use modern html markup.

Page specific titles & meta tags
Occasional special stylesheets, javascript for a page
id/class parameters on body tags
variations of headers/footers/nav bars

All go against using Border

For an alternative to Border check out 
http://wiki.apache.org/tapestry/WysiwygWithoutBorder

Henrik

"Brian Long" <br...@gmail.com> skrev i en meddelelse 
news:d2e604240609010253o2ff73acdrfbcb180d629927a6@mail.gmail.com...
> Nick,
>
> that worked perfectly, thanks! I just had to change a few things for it to
> comply with T4, but unfortunately now I'm faced with another problem,
> there's no titles on my stylesheets.
>
> Border.html
> <html jwcid="shell" 
> stylesheets="ognl:{assets.stylesheet1,assets.stylesheet2
> }">
>
> Border.jwc
> <asset name="stylesheet1" path="context:css/style.css" />
> <asset name="stylesheet2" path="context:css/template.css" />
>
> gives me:
>
> <link rel="stylesheet" type="text/css" 
> href="/fast-store-app/css/style.css"
> />
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/template.css" />
>
> but I'd like:
>
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/style.css"title="default"
> />
> <link rel="stylesheet" type="text/css"
> href="/fast-store-app/css/template.css" title="super"/>
>
> So as I can select them on the fly from my browser's view->use style
> setting. If you or anyone else has already figured out how to do this I'd
> like to hear how it's done.
>
> Thanks again, Brian.
>
>
> On 9/1/06, Nick Westgate <ni...@key-planning.co.jp> wrote:
>> Hi Brian.
>>
>> Hopefully someone using T4 can offer you more help,
>> but in my current T3 project I do this via ...
>>
>> Border.jwc - which has a stylesheets parameter:
>>
>> ...
>> <component-specification
>>      class="blah.blah.Border"
>>      allow-informal-parameters="no">
>>
>>      <parameter name="stylesheets" type="java.lang.Object"
> direction="in"/>
>>
>>      <component id="shell" type="Shell">
>>          <binding name="title" expression="title"/>
>>          <binding name="stylesheets" expression="stylesheets"/>
>>          <binding name="doctype">
>>              'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
>>          </binding>
>>      </component>
>> ...
>>
>> SomePage.html - which passes the array of stylesheet assets:
>>
>> <html>
>> <head>
>> </head>
>> <body jwcid="$content$">
>> <div jwcid="border" stylesheets="ognl:{assets.common, assets.apply}">
>> ...
>>
>> SomePage.page - which defines the css assets:
>>
>>      <context-asset name="common" path="css/common.css"/>
>>      <context-asset name="apply" path="css/apply.css"/>
>>
>> Cheers,
>> Nick.
>>
>>
>> Brian Long wrote:
>> > Hi all,
>> >
>> > I'm afraid I might have dug myself into a hole (again!), but I hope
> someone
>> > my have already encountered this problem and is willing to let me know
> of a
>> > possible solution.
>> >
>> > I'm trying to add multiple stylesheets to my web project, I'm currently
>> > using a @Shell component to enclose my web pages, this has a single
>> > stylesheet as per the example on the tapestry website.
>> >
>> > <span jwcid="@Shell" stylesheet="asset:stylesheet" title="MyCorp
> Customer
>> > Login">
>> >
>> > I want to add some more, and according to the component description
> there's
>> > a parameter "stylesheets" that will take an array of IAssets, this is
> want
>> > I'd like to do, the only problem is that my shell in inside a custom
>> > @Border
>> > component.
>> >
>> > Soooooo, I have a Border.html and Border.jwc and I have to try and
> create
>> > an array of IAssets (my list of stylesheets). How do I do this, create 
>> > a
>> > Border.java?
>> >
>> > Any suggestions would be much appreciated . . .
>> >
>> > /Brian.
>> >
>>
>> ---------------------------------------------------------------------
>> 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: multiple stylesheets

Posted by Brian Long <br...@gmail.com>.
Nick,

that worked perfectly, thanks! I just had to change a few things for it to
comply with T4, but unfortunately now I'm faced with another problem,
there's no titles on my stylesheets.

Border.html
<html jwcid="shell" stylesheets="ognl:{assets.stylesheet1,assets.stylesheet2
}">

Border.jwc
<asset name="stylesheet1" path="context:css/style.css" />
<asset name="stylesheet2" path="context:css/template.css" />

gives me:

<link rel="stylesheet" type="text/css" href="/fast-store-app/css/style.css"
/>
<link rel="stylesheet" type="text/css"
href="/fast-store-app/css/template.css" />

but I'd like:

<link rel="stylesheet" type="text/css"
href="/fast-store-app/css/style.css"title="default"
/>
<link rel="stylesheet" type="text/css"
href="/fast-store-app/css/template.css" title="super"/>

So as I can select them on the fly from my browser's view->use style
setting. If you or anyone else has already figured out how to do this I'd
like to hear how it's done.

Thanks again, Brian.


On 9/1/06, Nick Westgate <ni...@key-planning.co.jp> wrote:
> Hi Brian.
>
> Hopefully someone using T4 can offer you more help,
> but in my current T3 project I do this via ...
>
> Border.jwc - which has a stylesheets parameter:
>
> ...
> <component-specification
>      class="blah.blah.Border"
>      allow-informal-parameters="no">
>
>      <parameter name="stylesheets" type="java.lang.Object"
direction="in"/>
>
>      <component id="shell" type="Shell">
>          <binding name="title" expression="title"/>
>          <binding name="stylesheets" expression="stylesheets"/>
>          <binding name="doctype">
>              'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
>          </binding>
>      </component>
> ...
>
> SomePage.html - which passes the array of stylesheet assets:
>
> <html>
> <head>
> </head>
> <body jwcid="$content$">
> <div jwcid="border" stylesheets="ognl:{assets.common, assets.apply}">
> ...
>
> SomePage.page - which defines the css assets:
>
>      <context-asset name="common" path="css/common.css"/>
>      <context-asset name="apply" path="css/apply.css"/>
>
> Cheers,
> Nick.
>
>
> Brian Long wrote:
> > Hi all,
> >
> > I'm afraid I might have dug myself into a hole (again!), but I hope
someone
> > my have already encountered this problem and is willing to let me know
of a
> > possible solution.
> >
> > I'm trying to add multiple stylesheets to my web project, I'm currently
> > using a @Shell component to enclose my web pages, this has a single
> > stylesheet as per the example on the tapestry website.
> >
> > <span jwcid="@Shell" stylesheet="asset:stylesheet" title="MyCorp
Customer
> > Login">
> >
> > I want to add some more, and according to the component description
there's
> > a parameter "stylesheets" that will take an array of IAssets, this is
want
> > I'd like to do, the only problem is that my shell in inside a custom
> > @Border
> > component.
> >
> > Soooooo, I have a Border.html and Border.jwc and I have to try and
create
> > an array of IAssets (my list of stylesheets). How do I do this, create a
> > Border.java?
> >
> > Any suggestions would be much appreciated . . .
> >
> > /Brian.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>