Re: Image Bundler For Apache Wicket

2010-04-20 Thread Daniel Stoch
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



Re: Image Bundler For Apache Wicket

2010-04-20 Thread Anantha Kumaran

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


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



 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.




Anantha Kumaran(http://ananthakumaran.github.com)


Re: Image Bundler For Apache Wicket

2010-04-20 Thread Daniel Stoch


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



Re: Image Bundler For Apache Wicket

2010-04-20 Thread Daniel Stoch

And one more thing:
ImageItem interface (and posiibly ImageItemProvider too) should extend  
Serializable (or maybe better IClusterable?).


--
Daniel

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



Re: Image Bundler For Apache Wicket

2010-04-18 Thread Anantha Kumaran
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)


Image Bundler For Apache Wicket

2010-01-26 Thread Anantha Kumaran
http://ananthakumaran.github.com/imagebundler-wicket


Re: Image Bundler For Apache Wicket

2010-01-26 Thread Riyad Kalla
Very cool Anantha, do you have a site online that uses the bundler that we
could take a peek at as a running example?

On Tue, Jan 26, 2010 at 7:42 AM, Anantha Kumaran
ananthakuma...@gmail.comwrote:

 http://ananthakumaran.github.com/imagebundler-wicket



Re: Image Bundler For Apache Wicket

2010-01-26 Thread Anantha Kumaran
i will try to put it in the google appspot later. Here is the source code of
a sample http://github.com/ananthakumaran/imagebundler-wicket

On Tue, Jan 26, 2010 at 7:20 AM, Riyad Kalla rka...@gmail.com wrote:

 Very cool Anantha, do you have a site online that uses the bundler that we
 could take a peek at as a running example?

 On Tue, Jan 26, 2010 at 7:42 AM, Anantha Kumaran
 ananthakuma...@gmail.comwrote:

  http://ananthakumaran.github.com/imagebundler-wicket
 



Re: Image Bundler For Apache Wicket

2010-01-26 Thread Andrew Lombardi
This is very very cool.

Congrats Anantha!  

On Jan 26, 2010, at 9:07 AM, Anantha Kumaran wrote:

 i will try to put it in the google appspot later. Here is the source code of
 a sample http://github.com/ananthakumaran/imagebundler-wicket
 
 On Tue, Jan 26, 2010 at 7:20 AM, Riyad Kalla rka...@gmail.com wrote:
 
 Very cool Anantha, do you have a site online that uses the bundler that we
 could take a peek at as a running example?
 
 On Tue, Jan 26, 2010 at 7:42 AM, Anantha Kumaran
 ananthakuma...@gmail.comwrote:
 
 http://ananthakumaran.github.com/imagebundler-wicket
 
 


To our success!

Mystic Coders, LLC | Code Magic | www.mysticcoders.com

ANDREW LOMBARDI | and...@mysticcoders.com
2321 E 4th St. Ste C-128, Santa Ana CA 92705
ofc: 714-816-4488
fax: 714-782-6024
cell: 714-697-8046
linked-in: http://www.linkedin.com/in/andrewlombardi
twitter: http://www.twitter.com/kinabalu

Eco-Tip: Printing e-mails is usually a waste.


This message is for the named person's use only. You must not, directly or 
indirectly, use,
 disclose, distribute, print, or copy any part of this message if you are not 
the intended recipient.




Re: Image Bundler For Apache Wicket

2010-01-26 Thread Edward Zarecor
Do the comments in the inspiration design document about localization
also apply to your Wicket ImageBundle implementation?  If Wicket's
built in image handling functions as a locale-specific factory does
image localization work as expected with bundles?

Ed.


On Tue, Jan 26, 2010 at 12:23 PM, Andrew Lombardi
and...@mysticcoders.com wrote:
 This is very very cool.

 Congrats Anantha!

 On Jan 26, 2010, at 9:07 AM, Anantha Kumaran wrote:

 i will try to put it in the google appspot later. Here is the source code of
 a sample http://github.com/ananthakumaran/imagebundler-wicket

 On Tue, Jan 26, 2010 at 7:20 AM, Riyad Kalla rka...@gmail.com wrote:

 Very cool Anantha, do you have a site online that uses the bundler that we
 could take a peek at as a running example?

 On Tue, Jan 26, 2010 at 7:42 AM, Anantha Kumaran
 ananthakuma...@gmail.comwrote:

 http://ananthakumaran.github.com/imagebundler-wicket




 To our success!

 Mystic Coders, LLC | Code Magic | www.mysticcoders.com

 ANDREW LOMBARDI | and...@mysticcoders.com
 2321 E 4th St. Ste C-128, Santa Ana CA 92705
 ofc: 714-816-4488
 fax: 714-782-6024
 cell: 714-697-8046
 linked-in: http://www.linkedin.com/in/andrewlombardi
 twitter: http://www.twitter.com/kinabalu

 Eco-Tip: Printing e-mails is usually a waste.

 
 This message is for the named person's use only. You must not, directly or 
 indirectly, use,
  disclose, distribute, print, or copy any part of this message if you are not 
 the intended recipient.
 



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



Re: Image Bundler For Apache Wicket

2010-01-26 Thread Jeremy Thomerson
Looks cool - but rather than generating a static string, why don't you
generate a string that includes a call to urlFor(Class, imageName) so that
you can allow for internationalization? (Wicket will generate the proper
internationalized URL for you this way)...

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Jan 26, 2010 at 8:42 AM, Anantha Kumaran
ananthakuma...@gmail.comwrote:

 http://ananthakumaran.github.com/imagebundler-wicket



Re: Image Bundler For Apache Wicket

2010-01-26 Thread Riyad Kalla
Just ran across another base64-based method of spriting images that
Cappuccino is using:
http://cappuccino.org/discuss/2009/11/11/just-one-file-with-cappuccino-0-8

pretty interesting and supports back to IE6. Just wanted to share incase
anyone else reading on this subject was curious about other techniques.

-R

On Tue, Jan 26, 2010 at 1:59 PM, Jeremy Thomerson jer...@wickettraining.com
 wrote:

 Looks cool - but rather than generating a static string, why don't you
 generate a string that includes a call to urlFor(Class, imageName) so that
 you can allow for internationalization? (Wicket will generate the proper
 internationalized URL for you this way)...

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 8:42 AM, Anantha Kumaran
 ananthakuma...@gmail.comwrote:

  http://ananthakumaran.github.com/imagebundler-wicket
 



Re: Image Bundler For Apache Wicket

2010-01-26 Thread Anantha Kumaran
Thanks for the Reply. I will look into it.

On Tue, Jan 26, 2010 at 12:59 PM, Jeremy Thomerson 
jer...@wickettraining.com wrote:

 Looks cool - but rather than generating a static string, why don't you
 generate a string that includes a call to urlFor(Class, imageName) so that
 you can allow for internationalization? (Wicket will generate the proper
 internationalized URL for you this way)...

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 8:42 AM, Anantha Kumaran
 ananthakuma...@gmail.comwrote:

  http://ananthakumaran.github.com/imagebundler-wicket