On 2010-04-20, at 19:28, Anantha Kumaran wrote:


Maybe for methods returning an ImageItem a Locale should be a method
argument (but only if image is locale relative). So:
// for not locale relative images
ImageItem getSomeImage();
// for locale related
ImageItem getSomeImage(Locale locale);


The first option looks good.
I will add it (may be tomorrow).


I thought about it once again and now I think it is not a good solution (a method: "ImageItem getSomeImage(Locale locale);") for the same reasons as I wrote about Image components. When I get an ImageItem instance for specified Locale and pass this instance somewhere to components, then any locale changes in session will not affect this ImageItem. So it is going to be more complicated :(.

So maybe the second solution (from my previous mail) is better: add a Locale argument to getStyle() method (and maybe also to getSrc()).

Or it should be one more interface, eg: ImageItemProvider :) :
interface ImageItemProvider {

  ImageItem getImageItem(Locale locale);

}
and then image bundle should have a methods which return ImageItemProvider instead of ImageItem (this interface will not change) directly:
ImageItemProvider a();




For methods returning Image component maybe it would be better to get
Locale during the rendering, not when creating an Image. So maybe it
should be a special AttributeModifier which calculates a proper style
in eg. beforeRender() method?
For now when user changes a locale in application and images are not
recreated (eg. page will be not created again, but only refreshed in a
non-bookmarkable request), they will be still using a style from an
old locale (assigned in creation time).


I am not sure how to handle this.


I will try to prepare a proposal solution for this ;).

--
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to