Hi,

Thanks for this change!

My suggestions and optimalization notes:
1. In some cases there is no necessary to create an anonymous class
for each ImageItem (using AbstractImageItem). When @ImageBundle
interface has not locale specified, then SimpleImageItem(String
imageSrc, String imageStyle) can be used.

2. The call:
String locale = RequestCycle.get().getSession().getLocale().toString();
does not look very good for me :). Now you cannot call any method
outside of a Wicket thread.

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);

Then implementation will be more clear:

@Override
public ImageItem a(Locale locale) {
  if ((locale != null) && "ta_IN".equals(locale.toString()) {
    return new SimpleImageItem("images/clear.gif", " background-image
:url(resources/org.imagebundler.wicket.examples.SampleImageBundle
/SampleImageBundle_ta_IN.png) ; background-position:-50px -0px;
width:25px; height:25px;  ") ;
    }
    // default
    return new SimpleImageItem("images/clear.gif", "background-image
:url(resources/org.imagebundler.wicket.examples.SampleImageBundle/SampleImageBundle.png)
; background-position:-48px -0px; width:24px; height:24px;  ") ;
  }


Another solution is to add a Locale argument to getStyle() method (but
then maybe getSrc() should also have a Locale argument, so maybe the
first option with "ImageItem getSomeImage(Locale locale);" is better).

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).

--
Daniel


On Sun, Apr 18, 2010 at 5:20 PM, Anantha Kumaran
<ananthakuma...@gmail.com> wrote:
> http://ananthakumaran.github.com/imagebundler-wicket/
>
> version 1.2 released
>
> * localization support added
> * style and src of the image is available through the ImageItem interface
>
> your comments are welcome
>
> ----
> Anantha Kumaran(http://ananthakumaran.github.com)
>

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

Reply via email to