don't know if the base wicket core should handle this.
This means some kind of parser in wicket for those kind of files.

please make a RFE for this.

johan


On 3/13/06, Siddharth Agarwal <[EMAIL PROTECTED]> wrote:
Thanks Johan !
 
So having something like this hardcoded..
 
background: url(contextroot/wicketservlet/resources/my.com.package.MyCom/images/hello.gif) ;
is probably ruled out since if i were to ship a component, I would not have any idea of the user's contextroot etc?.
 
So the only way left is to generate the url/css dynamically through call to
new PackageResourceReference(MyComp.class, "images/hello.gif")  ?
 
How do you guys typically handle this (generating the background: CSS attribute dynamically?)
I would have loved to have it in the css.
 
Ok am thinking of just generating that attribute dynamically.
So,
 
style.css
-----------
.style1 {
 width:16px; height:22px;
}
 
While i try to do somethign in renderHead for just specifying that attribute.
 
//dynamically specified by the component
<style>
.style1{
 background: url(contextroot/wicketservlet/resources/my.com.package.MyCom/images/hello.gif) ;
}
</style>
 
Ok tell me this. Does it make sense for wicket to provide some place holders in the CSS for such things ?....am a newbie and i might be way off mark.
 
style.css
-----------
.style1 {
 width:16px; height:22px;
 background: url($(hellogif)) ;
}
-----------
 
and while creating a Creating a StyleSheetReference,
 
Map context = new HashMap();
context.put("hello.gif",new PackageResourceReference(MyComp.class, "images/hello.gif"));
new StyleSheetReference("css_id", MyComp.class, "style.css",context);
 
thanks!
 

 
On 3/13/06, Johan Compagner <[EMAIL PROTECTED] > wrote:
fist of all

you have to do this:


com
     -something
                   -component
                                   -MyComp.java
                                   -style.css     
                   -images
                             - hello.gif
 



or this



com
     -something
                   -component
                                   -MyComp.java
                                   -style.css     
                                   -images
                                         - hello.gif

With the last it is: new PackageResourceReference(MyComp.class, "images/hello.gif")


But in youre css you have this:


 background: url(../../images/hello.gif) ;

that will not work. Because there you have to put in a real working url that
new PackageResourceReference(MyComp.class, "images/hello.gif")

generates
and that is something like this:

contextroot/wicketservlet/resources/my.com.package.MyCom/images/hello.gif

So you need to dynamically replace that background css or generated the css on the fly.
Or have a fixed url in it like above. But then you have to know the context root and wicketservlet name upfront.
 

johan



On 3/13/06, Siddharth Agarwal <[EMAIL PROTECTED] > wrote:
Hi,
 
I have a CSS that has something like this ..

style.css
-----------
.style1 {
 width:16px; height:22px;
 background: url(../../images/hello.gif) ;
}
-----------

I have style.css in the same package as the components and have added it as a
StyleSheetReference. How do i make sure that the images inside the CSS are rendered fine. Will having something like this work?

com
     -something
                   -component
                                   -MyComp.java
                                   -style.css     
                   -images
                             - hello.gif
 

OR

com
     -something
                   -component
                                   - MyComp.java
                                   - style.css     
                                   - hello.gif

should the image url in the CSS be replaced with string returned by call to
urlFor( new PackageResourceReference(MyComp.class, "hello.gif"))
 
It would be great if i can get the existing CSS ( url(../../images/hello.gif) ) to work because there are references to images in lots of other places as well.
If yes, how s'd the package structure look like. I want to be able to package the whole component as a jar.
 
thanks.
- Siddharth




--
- Siddharth

Reply via email to