You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Hugo Palma <hp...@digitalis.pt> on 2005/05/18 19:54:23 UTC

Reference asset from css

Is there anyway i can reference an asset from a css ?
I would like the css not to reference the images directly but to use 
tapestry assets instead, but i have no idea on how to do this. Is it 
possible ?


Cheers

Hugo

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


Re: dynamic forms that are stateless

Posted by Eric Schneider <er...@centralparksoftware.com>.
Robert,

> Tell me, if all initialization is done in pageBeginRender, then
> how are the dynamic elements (lists, etc.) initialized in the first
> place?

The object is inflated and passed to the page via an action on  
another page.   For that first render, no initialization is required  
in pageBeginRender.

So, after the page is rendered, it's stripped of its state and  
returned to the page pool. It's the form submission part that's  
jacking me all up.

> I suspect that you're also using
> cayenne...? If you are, watch out for null data contexts on
> re-serialization.

Bingo!  Actually, I went with a struts style form bean thing.  The  
bean takes the values from the form and has convenience methods to  
copy it's values to a DataObject.

So, for existing objects (ones committed to the db)....

- I re-inflate my DataObject from a key passed in a hidden input
- copy form bean values to it,
- validate,
- then commit

Clear as mud, huh?  :-)

Eric

On May 18, 2005, at 10:31 PM, Robert Zeigler wrote:

> I think I'm understanding the issue better now. :)
> Tell me, if all initialization is done in pageBeginRender, then
> how are the dynamic elements (lists, etc.) initialized in the first
> place? You gave example of shipping addresses... how do you know how
> to initialize the shippingAddresses list to begin with? Is the  
> composite
> object set in a listener method elsewhere? Or...?
> Richard's suggestion sounded fine. I suspect that you're also using
> cayenne...? If you are, watch out for null data contexts on
> re-serialization.
>
> Robert
>
> Eric Schneider wrote:
>
>> Robert,
>>
>>
>>> I'm curious as to how putting the count in a hidden is too late?
>>>
>>
>>
>> Maybe you can tell me?   As far as I can tell, the composite object
>> (which holds all the form elements) is null when pageBeginRender() is
>> invoked.   In other words, it has not taken any values from the form
>> yet.  If I don't instantiate the object in pageBeginRender(), the   
>> page
>> throws because it's attempting to set a value on a null object.
>>
>> I'm going to try Richard's suggestion.   See if that gets me  
>> somewhere.
>>
>> Thanks,
>> e.
>>
>> On May 18, 2005, at 5:00 PM, Robert Zeigler wrote:
>>
>>
>>> Eric Schneider wrote:
>>>
>>>
>>>> Hi,
>>>>
>>>> I have a requirement that I'm stumbling on.   I have an editor page
>>>> that needs to be completely stateless containing no persistent
>>>> properties.   Users must be able to open this page in multiple
>>>> browsers
>>>> windows, switching back and forth and performing updates.
>>>>
>>>> This is no problem if there are a fixed amount of form  elements.
>>>> When
>>>> the user clicks save, I instantiate the bean in pageBeginRender ()
>>>> so it
>>>> can successfully take the values from the form.
>>>>
>>>> Where it gets awkward is when you have a dynamic number form    
>>>> elements.
>>>> (i.e. - a customer has 0-many shipping addresses).   I  have to
>>>> re-inflate that list of shipping addresses before values are   
>>>> set  to
>>>> the
>>>> beans within the lists.  Unfortunately, there really isn't  a  
>>>> good  way
>>>> to tell how many shipping address there are, aside from  putting  
>>>> this
>>>> count in a hidden form input (which is too late  anyway).  Has  
>>>> anyone
>>>> geared up something like this?
>>>>
>>>>
>>>
>>> I'm curious as to how putting the count in a hidden is too late?  
>>> When
>>> the page is first rendered, do you have access to the size of the  
>>> list
>>> before the loop? If so, couldn't you just put in the size of the   
>>> list in
>>> a @Hidden (before the loop) and use a listener with the @Hidden to
>>> re-instantiate the list? I've used this strategy several times with
>>> success. But... maybe I'm missing something? :)
>>>
>>> Robert
>>>
>>>
>>>>
>>>> I hope I'm explaining this well enough.  Any suggestions would be
>>>> greatly appreciated.
>>>>
>>>> Thanks,
>>>> e.
>>>> ------------------------------------------------------------------- 
>>>> --
>>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: dynamic forms that are stateless

Posted by Robert Zeigler <ro...@scazdl.org>.
I think I'm understanding the issue better now. :)
Tell me, if all initialization is done in pageBeginRender, then
how are the dynamic elements (lists, etc.) initialized in the first
place? You gave example of shipping addresses... how do you know how
to initialize the shippingAddresses list to begin with? Is the composite
object set in a listener method elsewhere? Or...?
Richard's suggestion sounded fine. I suspect that you're also using
cayenne...? If you are, watch out for null data contexts on
re-serialization.

Robert

Eric Schneider wrote:
> Robert,
> 
>> I'm curious as to how putting the count in a hidden is too late?
> 
> 
> Maybe you can tell me?   As far as I can tell, the composite object 
> (which holds all the form elements) is null when pageBeginRender() is 
> invoked.   In other words, it has not taken any values from the form 
> yet.  If I don't instantiate the object in pageBeginRender(), the  page
> throws because it's attempting to set a value on a null object.
> 
> I'm going to try Richard's suggestion.   See if that gets me somewhere.
> 
> Thanks,
> e.
> 
> On May 18, 2005, at 5:00 PM, Robert Zeigler wrote:
> 
>> Eric Schneider wrote:
>>
>>> Hi,
>>>
>>> I have a requirement that I'm stumbling on.   I have an editor page
>>> that needs to be completely stateless containing no persistent
>>> properties.   Users must be able to open this page in multiple  
>>> browsers
>>> windows, switching back and forth and performing updates.
>>>
>>> This is no problem if there are a fixed amount of form  elements.   
>>> When
>>> the user clicks save, I instantiate the bean in pageBeginRender () 
>>> so it
>>> can successfully take the values from the form.
>>>
>>> Where it gets awkward is when you have a dynamic number form   elements.
>>> (i.e. - a customer has 0-many shipping addresses).   I  have to
>>> re-inflate that list of shipping addresses before values are  set  to
>>> the
>>> beans within the lists.  Unfortunately, there really isn't  a good  way
>>> to tell how many shipping address there are, aside from  putting this
>>> count in a hidden form input (which is too late  anyway).  Has anyone
>>> geared up something like this?
>>>
>>
>> I'm curious as to how putting the count in a hidden is too late? When
>> the page is first rendered, do you have access to the size of the list
>> before the loop? If so, couldn't you just put in the size of the  list in
>> a @Hidden (before the loop) and use a listener with the @Hidden to
>> re-instantiate the list? I've used this strategy several times with
>> success. But... maybe I'm missing something? :)
>>
>> Robert
>>
>>>
>>> I hope I'm explaining this well enough.  Any suggestions would be
>>> greatly appreciated.
>>>
>>> Thanks,
>>> e.
>>> ---------------------------------------------------------------------
>>> 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


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


Re: dynamic forms that are stateless

Posted by Eric Schneider <er...@centralparksoftware.com>.
Robert,

> I'm curious as to how putting the count in a hidden is too late?

Maybe you can tell me?   As far as I can tell, the composite object  
(which holds all the form elements) is null when pageBeginRender() is  
invoked.   In other words, it has not taken any values from the form  
yet.  If I don't instantiate the object in pageBeginRender(), the  
page throws because it's attempting to set a value on a null object.

I'm going to try Richard's suggestion.   See if that gets me somewhere.

Thanks,
e.

On May 18, 2005, at 5:00 PM, Robert Zeigler wrote:

> Eric Schneider wrote:
>
>> Hi,
>>
>> I have a requirement that I'm stumbling on.   I have an editor page
>> that needs to be completely stateless containing no persistent
>> properties.   Users must be able to open this page in multiple   
>> browsers
>> windows, switching back and forth and performing updates.
>>
>> This is no problem if there are a fixed amount of form  
>> elements.    When
>> the user clicks save, I instantiate the bean in pageBeginRender ()  
>> so it
>> can successfully take the values from the form.
>>
>> Where it gets awkward is when you have a dynamic number form   
>> elements.
>> (i.e. - a customer has 0-many shipping addresses).   I  have to
>> re-inflate that list of shipping addresses before values are  set  
>> to the
>> beans within the lists.  Unfortunately, there really isn't  a good  
>> way
>> to tell how many shipping address there are, aside from  putting this
>> count in a hidden form input (which is too late  anyway).  Has anyone
>> geared up something like this?
>>
>
> I'm curious as to how putting the count in a hidden is too late? When
> the page is first rendered, do you have access to the size of the list
> before the loop? If so, couldn't you just put in the size of the  
> list in
> a @Hidden (before the loop) and use a listener with the @Hidden to
> re-instantiate the list? I've used this strategy several times with
> success. But... maybe I'm missing something? :)
>
> Robert
>
>>
>> I hope I'm explaining this well enough.  Any suggestions would be
>> greatly appreciated.
>>
>> Thanks,
>> e.
>> ---------------------------------------------------------------------
>> 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: dynamic forms that are stateless

Posted by Robert Zeigler <ro...@scazdl.org>.
Eric Schneider wrote:
> Hi,
> 
> I have a requirement that I'm stumbling on.   I have an editor page 
> that needs to be completely stateless containing no persistent 
> properties.   Users must be able to open this page in multiple  browsers
> windows, switching back and forth and performing updates.
> 
> This is no problem if there are a fixed amount of form elements.    When
> the user clicks save, I instantiate the bean in pageBeginRender () so it
> can successfully take the values from the form.
> 
> Where it gets awkward is when you have a dynamic number form  elements. 
> (i.e. - a customer has 0-many shipping addresses).   I  have to
> re-inflate that list of shipping addresses before values are  set to the
> beans within the lists.  Unfortunately, there really isn't  a good way
> to tell how many shipping address there are, aside from  putting this
> count in a hidden form input (which is too late  anyway).  Has anyone
> geared up something like this?

I'm curious as to how putting the count in a hidden is too late? When
the page is first rendered, do you have access to the size of the list
before the loop? If so, couldn't you just put in the size of the list in
a @Hidden (before the loop) and use a listener with the @Hidden to
re-instantiate the list? I've used this strategy several times with
success. But... maybe I'm missing something? :)

Robert
> 
> I hope I'm explaining this well enough.  Any suggestions would be 
> greatly appreciated.
> 
> Thanks,
> e.   
> ---------------------------------------------------------------------
> 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: dynamic forms that are stateless

Posted by Mind Bridge <mi...@yahoo.com>.
Hi,

Just curious, why is placing the info in a Hidden too late?

Also, do ListEdit or For (on www.t-deli.com) do what you want?

-mb

----- Original Message ----- 
From: "Eric Schneider" <er...@centralparksoftware.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, May 18, 2005 10:16 PM
Subject: dynamic forms that are stateless


> Hi,
> 
> I have a requirement that I'm stumbling on.   I have an editor page  
> that needs to be completely stateless containing no persistent  
> properties.   Users must be able to open this page in multiple  
> browsers windows, switching back and forth and performing updates.
> 
> This is no problem if there are a fixed amount of form elements.    
> When the user clicks save, I instantiate the bean in pageBeginRender 
> () so it can successfully take the values from the form.
> 
> Where it gets awkward is when you have a dynamic number form  
> elements.  (i.e. - a customer has 0-many shipping addresses).   I  
> have to re-inflate that list of shipping addresses before values are  
> set to the beans within the lists.  Unfortunately, there really isn't  
> a good way to tell how many shipping address there are, aside from  
> putting this count in a hidden form input (which is too late  
> anyway).  Has anyone geared up something like this?
> 
> I hope I'm explaining this well enough.  Any suggestions would be  
> greatly appreciated.
> 
> Thanks,
> e. 
>     
> 
> ---------------------------------------------------------------------
> 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


dynamic forms that are stateless

Posted by Eric Schneider <er...@centralparksoftware.com>.
Hi,

I have a requirement that I'm stumbling on.   I have an editor page  
that needs to be completely stateless containing no persistent  
properties.   Users must be able to open this page in multiple  
browsers windows, switching back and forth and performing updates.

This is no problem if there are a fixed amount of form elements.    
When the user clicks save, I instantiate the bean in pageBeginRender 
() so it can successfully take the values from the form.

Where it gets awkward is when you have a dynamic number form  
elements.  (i.e. - a customer has 0-many shipping addresses).   I  
have to re-inflate that list of shipping addresses before values are  
set to the beans within the lists.  Unfortunately, there really isn't  
a good way to tell how many shipping address there are, aside from  
putting this count in a hidden form input (which is too late  
anyway).  Has anyone geared up something like this?

I hope I'm explaining this well enough.  Any suggestions would be  
greatly appreciated.

Thanks,
e. 
    

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


Re: Reference asset from css

Posted by Alberto Lepe <al...@gmail.com>.
One way I think it is possible, is to serve the CSS file from
tapestry, for example,
your CSS file will be: mycss.html. At mycss.page, you can now include assets. 

To include that css file, you will have to write:
<link href="/app?service=page/mycss" ... />

It's the only way I can think of it...

Maybe you can do it different: write down a normal servlet and keep on
a .property your path to your images...

Please visit: www.tapestryforums.com and join us!

Lepe.

2005/5/18, Hugo Palma <hp...@digitalis.pt>:
> Is there anyway i can reference an asset from a css ?
> I would like the css not to reference the images directly but to use
> tapestry assets instead, but i have no idea on how to do this. Is it
> possible ?
> 
> Cheers
> 
> Hugo
> 
> ---------------------------------------------------------------------
> 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: Reference asset from css [auf Viren geprueft]

Posted by Andreas Andreou <an...@di.uoa.gr>.
Maybe, instead of a static css,
you need to create a Tapestry page that ouputs css data, and that gets 
included as a css in other pages.
In that page, you can then define private-assets for the images, and 
output their URLs where needed.
So,
1) You need to write some code to extract the URL from an asset (see 
IAsset.buildURL(cycle) )
2) You need to be able to include a Tapestry page as stylesheet (the 
Shell components only accepts IAsset for stylesheet)

Hugo Palma wrote:

> That doesn't work if the css and the images are bundled as a component 
> in a library.
> What i have is a Border component bundled in a library, this component 
> has a .css and some images. None of these are in the webcontext 
> because they are in the library archive. So my problem is: how do i 
> reference the component images from the component css ? I've tried 
> relative path but it doesn't work.
>
>
> Cheers
>
> Hugo
>
> Jonathan O'Connor wrote:
>
>> Hugo,
>> url references in a css file are always relative to the location of 
>> the css file. You may have to create your own asset service, and 
>> ../.. your way up to that.
>> Unless you are creating assets on the fly or selecting language 
>> specific assets, if you expose your images directory, it'll work fine 
>> without an asset.
>> Ciao,
>> Jonathan O'Connor
>> XCOM Dublin
>> Inactive hide details for Hugo Palma <hp...@digitalis.pt>Hugo Palma 
>> <hp...@digitalis.pt>
>>
>>
>>                         *Hugo Palma <hp...@digitalis.pt>*
>>
>>                         18/05/2005 18:54
>>                         Please respond to
>>                         "Tapestry users"
>>                         <ta...@jakarta.apache.org>
>>
>>     
>>
>> To
>>     
>> tapestry-user@jakarta.apache.org
>>
>> cc
>>     
>>
>> Subject
>>     
>> Reference asset from css [auf Viren geprueft]
>>
>>     
>>
>>
>> Is there anyway i can reference an asset from a css ?
>> I would like the css not to reference the images directly but to use
>> tapestry assets instead, but i have no idea on how to do this. Is it
>> possible ?
>>
>>
>> Cheers
>>
>> Hugo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>
>>
>> IBM Workplace 2.5 Launch Events:
>> XCOM AG und IBM laden zum weltweiten Launch von IBM Workplace 
>> Collaboration Services 2.5 nach Duesseldorf, Frankfurt und Berlin: 
>> http://lotus.xcom.de/events
>>
>> XCOM Express Programm:
>> Der schnelle Einstieg in neueste Technologien zum kleinen Preis - 
>> Portale, e-Mail Security und Mobility: http://lotus.xcom.de/express
>>
>>
>> *** XCOM AG Legal Disclaimer ***
>>
>> Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist 
>> allein fόr den Gebrauch durch den vorgesehenen Empfaenger bestimmt. 
>> Dritten ist das Lesen, Verteilen oder Weiterleiten dieser E-Mail 
>> untersagt. Wir bitten, eine fehlgeleitete E-Mail unverzueglich 
>> vollstaendig zu loeschen und uns eine Nachricht zukommen zu lassen.
>>
>> This email may contain material that is confidential and for the sole 
>> use of the intended recipient. Any review, distribution by others or 
>> forwarding without express permission is strictly prohibited. If you 
>> are not the intended recipient, please contact the sender and delete 
>> all copies.
>>
>

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


Re: Reference asset from css [auf Viren geprueft]

Posted by Hugo Palma <hp...@digitalis.pt>.
That doesn't work if the css and the images are bundled as a component 
in a library.
What i have is a Border component bundled in a library, this component 
has a .css and some images. None of these are in the webcontext because 
they are in the library archive. So my problem is: how do i reference 
the component images from the component css ? I've tried relative path 
but it doesn't work.


Cheers

Hugo

Jonathan O'Connor wrote:

> Hugo,
> url references in a css file are always relative to the location of 
> the css file. You may have to create your own asset service, and ../.. 
> your way up to that.
> Unless you are creating assets on the fly or selecting language 
> specific assets, if you expose your images directory, it'll work fine 
> without an asset.
> Ciao,
> Jonathan O'Connor
> XCOM Dublin
> Inactive hide details for Hugo Palma <hp...@digitalis.pt>Hugo Palma 
> <hp...@digitalis.pt>
>
>
>                         *Hugo Palma <hp...@digitalis.pt>*
>
>                         18/05/2005 18:54
>                         Please respond to
>                         "Tapestry users"
>                         <ta...@jakarta.apache.org>
>
> 	
>
> To
> 	
> tapestry-user@jakarta.apache.org
>
> cc
> 	
>
> Subject
> 	
> Reference asset from css [auf Viren geprueft]
>
> 	
>
>
> Is there anyway i can reference an asset from a css ?
> I would like the css not to reference the images directly but to use
> tapestry assets instead, but i have no idea on how to do this. Is it
> possible ?
>
>
> Cheers
>
> Hugo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
>
> IBM Workplace 2.5 Launch Events:
> XCOM AG und IBM laden zum weltweiten Launch von IBM Workplace 
> Collaboration Services 2.5 nach Duesseldorf, Frankfurt und Berlin: 
> http://lotus.xcom.de/events
>
> XCOM Express Programm:
> Der schnelle Einstieg in neueste Technologien zum kleinen Preis - 
> Portale, e-Mail Security und Mobility: http://lotus.xcom.de/express
>
>
> *** XCOM AG Legal Disclaimer ***
>
> Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist 
> allein für den Gebrauch durch den vorgesehenen Empfaenger bestimmt. 
> Dritten ist das Lesen, Verteilen oder Weiterleiten dieser E-Mail 
> untersagt. Wir bitten, eine fehlgeleitete E-Mail unverzueglich 
> vollstaendig zu loeschen und uns eine Nachricht zukommen zu lassen.
>
> This email may contain material that is confidential and for the sole 
> use of the intended recipient. Any review, distribution by others or 
> forwarding without express permission is strictly prohibited. If you 
> are not the intended recipient, please contact the sender and delete 
> all copies.
>

Re: Reference asset from css [auf Viren geprueft]

Posted by Pablo Ruggia <pr...@gmail.com>.
I can't get what you really want, or the way you want to do it. But
i'll try to guess.

If you wan't to change or override some css class property you can use
the html syle attribute.
Perhaps something like this in your template:

<div jwcid="@Any" class="baseClasss"
style="ognl:getStyleForMe('thisIsAParameter', 'andThisIsAnother') />

And in your page class or it's superclass you define the method: 
public String getStyleForMe(String param1, String param2);

It's the simple approach, obviously.

Also, you can define a servlet or an engine service and include a
<link rel ......   to that servlet or service url, and in it's service
method you can do some logic to output a css with the classes you want
created dinamically. I don't like this approach. I like to keep things
simple.





On 5/20/05, David Leangen <dl...@canada.com> wrote:
> 
> Hi, Random Tapestry User, or tappapp, whichever you prefer...
> 
> > > It would be nice to be able to dynamically generate CSS. Is
> > > there a (simple) way this could be done?
> 
> > Ideally, you probably have an "images" directory that is probably a
> > peer directory to your "css" directory.
> 
> 
> Sorry that my question was not so clear.
> 
> You gave the example :
> 
> .titleGradient
> {
>     text-align: top;
>     background: url(../images/title-gradient.gif) 0px 0px repeat-y;
> }
> 
> 
> But what if I want "text-align: top" in one case, but "text-align: bottom"
> in another?
> 
> Now, I know very well I could have two classes, like "titleGradientTop" and
> "titleGradientBottom", and set the class being used dynamically. The problem
> with this is that it clutters up the CSS. If you think about all the
> possible combinations of styles, it's just not practical. It just seems so
> much elegant and useful to be able to generate the CSS dynamically.
> 
> 
> It would be very useful to be able to do something like:
> 
> public void setTitleGradientCssClass(final Object testParam)
> {
> 
>     if ( testParam.isSomeTestTrue )
>     {
>         getCss().getText().setAlign(TOP);
>     |
>     else
>     {
>         getCss().getText().setAlign(BOTTOM);
>     }
> 
> }
> 
> 
> Cheers,
> Dave
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Reference asset from css [auf Viren geprueft]

Posted by Random Tapestry User <ta...@comcast.net>.
Dave,

I see what you're saying. I thought you were specifically referring only 
to the image issue.
What your considering is conditional CSS, which yes, is a bit different.
You might consider maybe the simplest approach by having one stylesheet 
with all the common stuff that is not variable, and conditionally 
include the other stylesheets based on your criteria.

In my case, I did that (briefly, until I worked out the issue) to 
include one stylesheed for MSIE, and another for Firefox/Mozilla.

Regards,
tappapp

David Leangen wrote:

>Hi, Random Tapestry User, or tappapp, whichever you prefer...
>
>  
>
>>>It would be nice to be able to dynamically generate CSS. Is
>>>there a (simple) way this could be done?
>>>      
>>>
>
>  
>
>>Ideally, you probably have an "images" directory that is probably a
>>peer directory to your "css" directory.
>>    
>>
>
>
>Sorry that my question was not so clear.
>
>You gave the example :
>
>.titleGradient
>{
>    text-align: top;
>    background: url(../images/title-gradient.gif) 0px 0px repeat-y;
>}
>
>
>But what if I want "text-align: top" in one case, but "text-align: bottom"
>in another?
>
>Now, I know very well I could have two classes, like "titleGradientTop" and
>"titleGradientBottom", and set the class being used dynamically. The problem
>with this is that it clutters up the CSS. If you think about all the
>possible combinations of styles, it's just not practical. It just seems so
>much elegant and useful to be able to generate the CSS dynamically.
>
>
>It would be very useful to be able to do something like:
>
>public void setTitleGradientCssClass(final Object testParam)
>{
>
>    if ( testParam.isSomeTestTrue )
>    {
>        getCss().getText().setAlign(TOP);
>    |
>    else
>    {
>        getCss().getText().setAlign(BOTTOM);
>    }
>
>}
>
>
>Cheers,
>Dave
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


RE: Reference asset from css [auf Viren geprueft]

Posted by David Leangen <dl...@canada.com>.
Hi, Random Tapestry User, or tappapp, whichever you prefer...

> > It would be nice to be able to dynamically generate CSS. Is
> > there a (simple) way this could be done?

> Ideally, you probably have an "images" directory that is probably a
> peer directory to your "css" directory.


Sorry that my question was not so clear.

You gave the example :

.titleGradient
{
    text-align: top;
    background: url(../images/title-gradient.gif) 0px 0px repeat-y;
}


But what if I want "text-align: top" in one case, but "text-align: bottom"
in another?

Now, I know very well I could have two classes, like "titleGradientTop" and
"titleGradientBottom", and set the class being used dynamically. The problem
with this is that it clutters up the CSS. If you think about all the
possible combinations of styles, it's just not practical. It just seems so
much elegant and useful to be able to generate the CSS dynamically.


It would be very useful to be able to do something like:

public void setTitleGradientCssClass(final Object testParam)
{

    if ( testParam.isSomeTestTrue )
    {
        getCss().getText().setAlign(TOP);
    |
    else
    {
        getCss().getText().setAlign(BOTTOM);
    }

}


Cheers,
Dave



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


Re: Reference asset from css [auf Viren geprueft]

Posted by Random Tapestry User <ta...@comcast.net>.
Ideally, you probably have an "images" directory that is probably a peer 
directory to your "css" directory.
You simply reference the images with  "../images/whateverImage.gif"

Here's an examply from my .css file :

.titleGradient
{
    text-align: top;
    background: url(../images/title-gradient.gif) 0px 0px repeat-y;
}

all works great

Regards,
tappapp


David Leangen wrote:

>Actually, I have a similar question... I haven't yet tried, but since this
>thread is on the same topic, I just thought I'd ask.
>
>It would be nice to be able to dynamically generate CSS. Is there a (simple)
>way this could be done?
>
>One complicated way is to have Tapestry generate an XML file and transform
>the XML file to output CSS, but that seems a bit to heavy.
>
>
>Any ideas?
>
>
>:dml
>
>
>
>
>-----Original Message-----
>From: Jonathan O'Connor [mailto:Jonathan.OConnor@xcom.de]
>Sent: 19 May 2005 17:33
>To: Tapestry users
>Subject: Re: Reference asset from css [auf Viren geprueft]
>
>
>Hugo,
>url references in a css file are always relative to the location of the css
>file. You may have to create your own asset service, and ../.. your way up
>to that.
>Unless you are creating assets on the fly or selecting language specific
>assets, if you expose your images directory, it'll work fine without an
>asset.
>Ciao,
>Jonathan O'Connor
>XCOM Dublin
>Hugo Palma <hp...@digitalis.pt>
>
>
>Hugo Palma <hp...@digitalis.pt>
>18/05/2005 18:54 Please respond to
>"Tapestry users" <ta...@jakarta.apache.org>
>
>
>To
>tapestry-user@jakarta.apache.org
>
>
>cc
>
>
>
>Subject
>Reference asset from css [auf Viren geprueft]
>
>
>
>Is there anyway i can reference an asset from a css ?
>I would like the css not to reference the images directly but to use
>tapestry assets instead, but i have no idea on how to do this. Is it
>possible ?
>
>
>Cheers
>
>Hugo
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
>
>IBM Workplace 2.5 Launch Events:
>XCOM AG und IBM laden zum weltweiten Launch von IBM Workplace Collaboration
>Services 2.5 nach Duesseldorf, Frankfurt und Berlin:
>http://lotus.xcom.de/events
>
>XCOM Express Programm:
>Der schnelle Einstieg in neueste Technologien zum kleinen Preis - Portale,
>e-Mail Security und Mobility: http://lotus.xcom.de/express
>
>
>*** XCOM AG Legal Disclaimer ***
>
>Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist allein
>für den Gebrauch durch den vorgesehenen Empfaenger bestimmt. Dritten ist das
>Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir bitten, eine
>fehlgeleitete E-Mail unverzueglich vollstaendig zu loeschen und uns eine
>Nachricht zukommen zu lassen.
>
>This email may contain material that is confidential and for the sole use of
>the intended recipient. Any review, distribution by others or forwarding
>without express permission is strictly prohibited. If you are not the
>intended recipient, please contact the sender and delete all copies.
>
>
>---------------------------------------------------------------------
>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: Reference asset from css [auf Viren geprueft]

Posted by David Leangen <dl...@canada.com>.
Actually, I have a similar question... I haven't yet tried, but since this
thread is on the same topic, I just thought I'd ask.

It would be nice to be able to dynamically generate CSS. Is there a (simple)
way this could be done?

One complicated way is to have Tapestry generate an XML file and transform
the XML file to output CSS, but that seems a bit to heavy.


Any ideas?


:dml




-----Original Message-----
From: Jonathan O'Connor [mailto:Jonathan.OConnor@xcom.de]
Sent: 19 May 2005 17:33
To: Tapestry users
Subject: Re: Reference asset from css [auf Viren geprueft]


Hugo,
url references in a css file are always relative to the location of the css
file. You may have to create your own asset service, and ../.. your way up
to that.
Unless you are creating assets on the fly or selecting language specific
assets, if you expose your images directory, it'll work fine without an
asset.
Ciao,
Jonathan O'Connor
XCOM Dublin
Hugo Palma <hp...@digitalis.pt>


Hugo Palma <hp...@digitalis.pt>
18/05/2005 18:54 Please respond to
"Tapestry users" <ta...@jakarta.apache.org>


To
tapestry-user@jakarta.apache.org


cc



Subject
Reference asset from css [auf Viren geprueft]



Is there anyway i can reference an asset from a css ?
I would like the css not to reference the images directly but to use
tapestry assets instead, but i have no idea on how to do this. Is it
possible ?


Cheers

Hugo

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





IBM Workplace 2.5 Launch Events:
XCOM AG und IBM laden zum weltweiten Launch von IBM Workplace Collaboration
Services 2.5 nach Duesseldorf, Frankfurt und Berlin:
http://lotus.xcom.de/events

XCOM Express Programm:
Der schnelle Einstieg in neueste Technologien zum kleinen Preis - Portale,
e-Mail Security und Mobility: http://lotus.xcom.de/express


*** XCOM AG Legal Disclaimer ***

Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist allein
für den Gebrauch durch den vorgesehenen Empfaenger bestimmt. Dritten ist das
Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir bitten, eine
fehlgeleitete E-Mail unverzueglich vollstaendig zu loeschen und uns eine
Nachricht zukommen zu lassen.

This email may contain material that is confidential and for the sole use of
the intended recipient. Any review, distribution by others or forwarding
without express permission is strictly prohibited. If you are not the
intended recipient, please contact the sender and delete all copies.


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


Re: Reference asset from css [auf Viren geprueft]

Posted by Jonathan O'Connor <Jo...@xcom.de>.
Hugo,
url references in a css file are always relative to the location of the css
file. You may have to create your own asset service, and ../.. your way up
to that.
Unless you are creating assets on the fly or selecting language specific
assets, if you expose your images directory, it'll work fine without an
asset.
Ciao,
Jonathan O'Connor
XCOM Dublin


                                                                           
             Hugo Palma                                                    
             <hpalma@digitalis                                             
             .pt>                                                       To 
                                       tapestry-user@jakarta.apache.org    
             18/05/2005 18:54                                           cc 
                                                                           
                                                                   Subject 
             Please respond to         Reference asset from css [auf Viren 
             "Tapestry users"          geprueft]                           
             <tapestry-user@ja                                             
             karta.apache.org>                                             
                                                                           
                                                                           
                                                                           
                                                                           




Is there anyway i can reference an asset from a css ?
I would like the css not to reference the images directly but to use
tapestry assets instead, but i have no idea on how to do this. Is it
possible ?


Cheers

Hugo

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





IBM Workplace 2.5 Launch Events:
XCOM AG und IBM laden zum weltweiten Launch von IBM Workplace Collaboration
Services 2.5 nach Duesseldorf, Frankfurt und Berlin:
http://lotus.xcom.de/events

XCOM Express Programm:
Der schnelle Einstieg in neueste Technologien zum kleinen Preis - Portale,
e-Mail Security und Mobility: http://lotus.xcom.de/express


*** XCOM AG Legal Disclaimer ***

Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist allein
für den Gebrauch durch den vorgesehenen Empfaenger bestimmt. Dritten ist
das Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir bitten,
eine fehlgeleitete E-Mail unverzueglich vollstaendig zu loeschen und uns
eine Nachricht zukommen zu lassen.

This email may contain material that is confidential and for the sole use
of the intended recipient. Any review, distribution by others or forwarding
without express permission is strictly prohibited. If you are not the
intended recipient, please contact the sender and delete all copies.