>
> Among the remaining problems, is the fact that references to image files
> inside the css don't work

Probably all the same problem of not having them pre-registered.
Please could you try using the version in svn (WICKET_1_2 branch), or
download the intermediate version at
http://sourceforge.net/project/showfiles.php?group_id=119783&package_id=173489&release_id=428730
?

There are many components, like the Tree, DatePicker, YUI Slider and
Calendar etc that work with relative images like that. So far -
besides that pre-registering - that didn't give any problems.


> BTW, I have struggled with another problem about loading images dynamically
> at run time while having to pass not only the file name but the width,
> height and alt attributes. After days of experiments, I ended with this
> solution :
>
>     WebMarkupContainer wmc = new WebMarkupContainer("image0");
>     wmc.add(new AttributeModifier("src", new
> Model("images/vd-contrebasse.png")));
>     wmc.add(new AttributeModifier("width", new Model("132")));
>     wmc.add(new AttributeModifier("height", new Model("101")));
>     wmc.add(new AttributeModifier("alt", new Model("Mains sur une
> contrebasse")));
>     add(wmc);
>
> Although it works, it looks a bit like brute force ! (This approach also
> work for linking to a css file, and I suppose it could work for setting any
> attribute of any element, but it looks ugly ! Is there a better way to
> achieve this ?

Well, first off, programming will always take a few lines here and
there. The whole trick with Wicket and it's philosophy of reusable
components is that you hide the ugly parts in components and expose a
nice API on them.

Instead of those static models (new Model("value")), use dynamic
models that e.g. work on properties of your component (new
PropertyModel(this, "alt")).

Furthermore, instead of using attribute modifiers, you could e.g.
override onComponentTag body, and do your attribute modification there
like: openTag.getAttributes().put(key, value) or in 2.0 (alpha
currently) you can even do it int the constructor:
getMarkupAttributes().put(key, value);

Eelco

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to