What I do is the following:

Each component/page in my application can define its stylesheet as an asset named css. My Border goes through all of the components in a page and checks if they implement an interface named Styleable. If a component does, the border adds the css asset to a list which is cached and used as an argument to the shell's stylesheets parameter.

I find this strategy very convenient because each component/page can define its own stylesheet. The border defines also a css asset, which is a kind of "global" stylesheet.

Hope that helps...

Cheers,
ROn



ציטוט Kevin Menard:
Hi,

I've been thinking a bit about how to do CSS in my Picasso app, and was wondering what others thought.

The basic idea is that I have a stylesheet that I'd like applied on all my pages, and then in some of the pages, have some specialized styles. My initial thought was to use <style> tags, but that gets messy with my Border component, since the <style> tags need to appear in the <head> tags. I could simply inline the styles too, but once again, that makes things messy.

Ideally, I'd like to push as much of the CSS out of the HTML file as I can -- even if the CSS is really only valid for that one file. @importing other CSS files seems to be the best thing to do, but then it becomes a matter of overriding the stylesheet asset on each of the specialized pages. Just to reiterate what I think the problem here is, is that for a common stylesheet, I simply specify the asset in my Border component spec and I'm all set. If I need to shift this up to the page level though, each page needs to specify the stylesheet asset, which I think is just asking for trouble.

So, I've been toying with the @Asset annotation and inheritance. This is looking like a pretty decent solution. By creating a base class with the @Asset and setting the org.apache.tapestry.default- page-class meta value in the app spec file, I have basically what I want. There are a couple issues here though: 1) The stylesheet is specified in the Java file, so changes here require a recompilation (probably not that big of a deal though), and 2) pages that want specialized CSS and that previously didn't need specialized page classes now do, in order to override the getStylesheet() method. I'd almost rather in this latter case to specify the overriding stylesheet in the page spec file, rather than create a mostly useless class. However, this doesn't seem to work, as the getStylesheet() method clashes with the page spec definition.

So, what are you guys doing?  What are your thoughts on the matter?

Thanks,
Kevin

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