Re: Create ImageResource from URL derived from DB?

2013-12-16 Thread Thomas Broyer
I think Nolan wants to use APIs such as 
http://www.gwtproject.org/javadoc/latest/com/google/gwt/cell/client/ButtonCellBase.html#setIcon(com.google.gwt.resources.client.ImageResource)that
 expect an ImageResource.

On Monday, December 16, 2013 8:31:55 AM UTC+1, Benjamin Possolo wrote:

 This is not what ImageResource was designed for. ImageResource is part of 
 ClientBundle and is intended for bundling images into a single sprite map 
 to reduce the number of network requests between the user's browser and 
 your server. The artifacts are generated at compile time.

 If you want to define the background image of your GWT Button widget 
 (which is just a button or input element), use the DOM api and CSS to 
 set the background to the desired image url.

 String urlToImage = http://www.foo.com/your-image.png;;
 Button b = new Button();
 b.getElement().getStyle().setProperty(background, url(' + urlToImage + 
 ') no-repeat);

 Here is a stackoverflow post that talks about setting background images on 
 input elements

 http://stackoverflow.com/questions/2738920/background-image-for-input-type-button


 On Saturday, December 7, 2013 9:18:06 AM UTC-8, Nolan Brassard wrote:

 Is there a way to create an ImageResource from a URL?

 I have a scenario where I'd like to allow the user to give me a URL to an 
 image that will then be used as the Icon of a certain button later on. The 
 only way I know how to create an ImageResource is via a client bundle and 
 setting @Source. Is there another way to do this?



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Create ImageResource from URL derived from DB?

2013-12-15 Thread Benjamin Possolo
This is not what ImageResource was designed for. ImageResource is part of 
ClientBundle and is intended for bundling images into a single sprite map 
to reduce the number of network requests between the user's browser and 
your server. The artifacts are generated at compile time.

If you want to define the background image of your GWT Button widget (which 
is just a button or input element), use the DOM api and CSS to set the 
background to the desired image url.

String urlToImage = http://www.foo.com/your-image.png;;
Button b = new Button();
b.getElement().getStyle().setProperty(background, url(' + urlToImage + 
') no-repeat);

Here is a stackoverflow post that talks about setting background images on 
input elements
http://stackoverflow.com/questions/2738920/background-image-for-input-type-button


On Saturday, December 7, 2013 9:18:06 AM UTC-8, Nolan Brassard wrote:

 Is there a way to create an ImageResource from a URL?

 I have a scenario where I'd like to allow the user to give me a URL to an 
 image that will then be used as the Icon of a certain button later on. The 
 only way I know how to create an ImageResource is via a client bundle and 
 setting @Source. Is there another way to do this?


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Create ImageResource from URL derived from DB?

2013-12-07 Thread Nolan Brassard
Is there a way to create an ImageResource from a URL?

I have a scenario where I'd like to allow the user to give me a URL to an 
image that will then be used as the Icon of a certain button later on. The 
only way I know how to create an ImageResource is via a client bundle and 
setting @Source. Is there another way to do this?

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Create ImageResource from URL derived from DB?

2013-12-07 Thread Thomas Broyer

On Saturday, December 7, 2013 6:18:06 PM UTC+1, Nolan Brassard wrote:

 Is there a way to create an ImageResource from a URL?

 I have a scenario where I'd like to allow the user to give me a URL to an 
 image that will then be used as the Icon of a certain button later on. The 
 only way I know how to create an ImageResource is via a client bundle and 
 setting @Source. Is there another way to do this?


You can also just implement the interface (or use 
com.google.gwt.resources.client.impl.ImageResourcePrototype, but we don't 
guarantee forward-compatibility with future versions of GWT)
The main issue is that the code that uses ImageResource might make use of 
the image size, so you'd have to return accurate values for the URL. 

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.