[EMAIL PROTECTED] wrote:
> Do you have this component code available along with how to use it?
>
> -
> Thanks,
> Ozzie G

Not yet, unfortunately. It's not completely finished, and I haven't made any documentation whatsoever. It also requires a few changes to @Shell to work - and I don't like just copying @Shell into a new component since it'll most likely result in a maintenance nightmare.

I'll be working on it for the next few days whenever I have time. It should be "done" soon, I hope.

Just to give you an idea of how the Style component works, I'll include an example for Tapestry 4.0:

Index.html:

  <html jwcid="@Shell" title="@Style Example">
  <head jwcid="$remove$">
    <title>@Style Example</title>
  </head>
  <body jwcid="@Body">
  <span jwcid="includeStyleSheet" />

  <p>Content here.</p>

  </body>
  </html>

- - -

Index.page

  <page-specification>
    <component id="includeStyleSheet" type="Style">
      <binding name="styleSheet" value="asset:styleSheet" />
    </component>

    <asset name="styleSheet" path="context:style.css" />
  </page-specification>

- - -

style.css

  p { color: red; }

- - -

This way, the paragraph should be rendered in red. Furthermore, since pages are components, the exact same approach can be used in components.

And for components without a template, the modified @Shell includes two new methods:

  public static BetterShell get(IRequestCycle cycle) { ... }

  and

  public void addStylesheet(IAsset stylesheet) { ... }

That's about what I have so far. Feedback would be appreciated!

-Filip

-----Original Message-----
From: Filip S. Adamsen [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 7:39 AM
To: Tapestry users
Subject: Re: CSS in page or component

Yeah, I saw it a while ago, but it relies on JavaScript. Furthermore, it's not able to do all the things I want such a component to do.

My own @Style component actually works now, including page/component style sheets on the go with only minor configuration - you need the style sheet declared as an IAsset somewhere.

Next up, I want it to be able to include small bits of CSS for the <head/> section's <style/> tag. And perhaps enabling it to attach instance-specific styles via the "#id { /* style here */ }" notation. That is, you'll be able to customize specific components' styles easily.

I don't think there's much else such a component should be able to do. But if you have any additional ideas, please share!

-Filip

Tomáš Drenčák wrote:

I've found TapFx library on http://tapfx.sf.net/ . There's a component
named Style and it seems that it solves problem in elegant way...

tomas

2005/8/25, Alan Chandler <[EMAIL PROTECTED]>:


On Thursday 25 Aug 2005 08:20, Tomáš Drenčák wrote:


Hi,
I'd like to ask how can I include a css file into a component or even
a page. I use own Border component with Shell. Stylesheets could be
imported there, but what if I want to include css specific to page or
component?


[...]

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to