I'm building my first Tapestry Component and I'm trying to encapsulate
some common HTML components for my applications into a Tapestry
Component. The component also needs a few styles to look and function
properly, and I'd like these styles to be included on the page whenever
the component is used automatically (just like the javascript which is
included automatically when I use my component).
The component so far works great, but I cannot seem to also make it
include a stylesheet.
On the Tapestry site I found this:
> Often, a component must be packaged up with images, stylesheets or
> other resources (collectively termed "assets") that are needed at
> runtime. A reference to such an asset can be created using the <asset>
> element of the page or component specification. For example:
>
> <asset name="logo" path="images/logo_200.png"/>
>
> <component id="image" type="Image">
> <binding name="image" value="asset:logo"/>
> </component>
However, I cannot figure out how to "package stylesheets" with my
component. I've tried the following:
<asset name="css" path="MenuPicker.css"/>
<component id="stylesheet" type="Any">
<binding name="stylesheet" value="asset:css"/>
</component>
This however doesn't do anything, I get no errors, and I see no changes.
For one thing, I'm not sure what the "type" parameter should be for
including a stylesheet. I don't see any Stylesheet or CSS component,
like there is for Image.
I've checked the tapestry site, googled, and looked at the last few
months of posts on this mailinglist, but I couldn't find anything that
sheds light on this. I'd be grateful for a pointer in the right
direction :)
Here's the full component specification I'm using:
<component-specification
class="com.bmw.tapestry.components.menupicker.MenuPicker" allow-body="no">
<parameter name="displayName"/>
<parameter name="id" property="idParameter" default-value="id"/>
<inject property="script" type="script" object="MenuPicker.script"/>
<asset name="css" path="MenuPicker.css"/>
<component id="stylesheet" type="Any">
<binding name="stylesheet" value="asset:css"/>
</component>
</component-specification>
The files are all in the same package
(com.bmw.tapestry.components.menupicker); MenuPicker.java, jwc,
properties, css, script and js
Any ideas?
--John
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]