I't much easier in T4 now.

Inject the AssetFactory:
<set-object property="assetFactory" 
value="service:tapestry.asset.ContextAssetFactory"/>


To return the IAsset:
assetFactory.createAbsoluteAsset(cssName.toString(),null,null);


"Kevin Menard" <[EMAIL PROTECTED]> skrev i en meddelelse 
news:[EMAIL PROTECTED]
>I haven't actually tried this, but it would seem that if you passed the CSS
> context path as the "stylesheet" parameter with OGNL to the Shell 
> component,
> that you could do this.  Otherwise, you could look more at using the 
> Shell's
> "delegate" parameter if you need finer grain control.
>
> The hardest part is creating the context path.  I've only done this for
> images, but the idea should be the same.  Here's a code snippet I use that
> should hopefully help you out.
>
> @InjectObject("service:tapestry.globals.IRequestCycle")
> public abstract IRequestCycle getRequestCycle();
>
> @InjectObject("service:tapestry.globals.ServletContext")
> public abstract ServletContext getServletContext();
>
> @InjectObject("service:tapestry.globals.WebRequest")
> public abstract WebRequest getWebRequest();
>
> public IAsset getStoreImage(final ServletContext context, final WebRequest
> request, final IRequestCycle cycle)
>    {
>        final ContextResource resource = new ContextResource(context,
> "/images/store/" + getBaseImageName() + "_small.jpg");
>
>        return new ContextAsset(request.getContextPath(), resource, null,
> cycle);
>    }
>
> It has been a bit of time since I last tried this (the above code does 
> work
> though), so maybe there's a much simpler way of doing this.  You wouldn't
> believe how long it took me to figure out the above code.
>
> -- 
> Kevin Menard
> Servprise International
> Remote Reboot Without Pulling the Plug
> 800.832.3823
>
>> -----Original Message-----
>> From: Peter Dawn [mailto:[EMAIL PROTECTED]
>> Sent: Monday, August 07, 2006 12:22 AM
>> To: tapestry-user@jakarta.apache.org
>> Subject: Multiple themes
>>
>> guys,
>> i am trying to implement multiple themes within my web app. what i
>> really want to do is depending upon who is logging in (or a set
>> condition or maybe a user selection) change the app css file. has
>> somebody done this before. any ideas on how about i should approach
>> this.
>> thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to