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?
> 
> I have done it 3 different ways now, trying various things out using TAP 4..
> My final way is still not working, but I think its finding the style sheet,
> its just that other parts of my application is not working
> 
> 1) Built my Border Component into a library and had the stylesheet and image
> assets served from within that component.  Have the style sheet (and related
> image assets) stored within a library component.  (NOTE I never tried
> refering to all image assets from within the style sheet in this form - so
> the is limited)
> 
> Package the style sheet and images within directories underneath component
> library specification (in the path refered to by <library id="xxx"
> specification-path="/path/to/libarry /> element of the application
> specification.
> 
> In my Border.java file
> 
> @ComponentClass
> public abstract class Border extends BaseComponent{
> 
> //  Style Sheet
>    @Asset("styles/border.css")
>    public abstract IAsset getSiteStyle();
> ...
> 
> In Border.html I have
> 
> <html jwcid="@Shell" stylesheet="asset:siteStyle" title="ognl:windowTitle">
> 
> 2) I moved the stylesheet out to the webcontext path of the surrounding
> application.  At this point, I added all the images that the stylesheet
> refered to into the same directory as the stylesheet itself.  Tapestry knows
> nothing about them.
> 
> The only difference was to add the context: in from on the stylesheet
> annotation in the Border.java file.
> 
> //  Style Sheet
>    @Asset("context:styles/border.css")
>    public abstract IAsset getSiteStyle();
> 
> 
> 3) (NOTE NOT YET FULLY WORKING) I have put the stylesheet in the Root Context
> of tomcat.  In the server.xml file for tomcat (hosted via eclipse) I have
> 
>       <!-- Tomcat Root Context -->
> 
>                <Context path="" docBase="/home/alan/dev/famtree/rootContext" 
> debug="0"/>
> 
>        <!-- Tomcat Examples Context -->
> 
> 
>                <Context docBase="/home/alan/dev/famtree/.deployables/famtree"
> path="/famtree" reloadable="true"
> source="com.ibm.wtp.web.server:famtree"/></Host>
> 
> 
> The stylesheet and related images are all stored
> in /home/alan/dev/famtree/rootContext/styles
> 
> and my component Border.html now simply refers to it via
> 
> <html jwcid="@Shell" stylesheet="asset:stylesheet" title="Family Tree
> Application">
> 
> But because I have simplified my border and so longer have an associated java
> class, I have add to add a component specification  Border.jwc with
> 
> <?xml version="1.0"?>
> <!DOCTYPE component-specification PUBLIC
>  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
>  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
> <component-specification>
>        <asset name="stylesheet" path="/styles/chandler.css" />
> </component-specification>
> 
> 
> in it.
> 
> 
> 
> 
> --
> Alan Chandler
> http://www.chandlerfamily.org.uk
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to