I had the same issue once, had to do image lookup by name - I ended up creating an Interface with a static reference to the ImageBundle, and then using a GWT Generator to create "Map Entries" to an ImageFactory type. This was only worth the work because it was a Toolkit for apps where there could be many, many images, and many bundles, and possibly several "sizes".
You only have 32, the if/then may be ugly, but it's only one image bundle. Perhaps a switch statement would look cleaner. Or maybe you could wrap it all up in a nice little Enum class. On Jul 12, 8:18 pm, Sean <[email protected]> wrote: > So, I am making a small personal page to keep track of my NFL picks > for this coming season. There are 32 teams, and I want to have their > logos appear next to their stats, etc. Being as it'll be an almost > constant 32 image requests for a pretty small image, the overhead will > be huge, I figure this will be a perfect use for ImageBundle. > > However, ImageBundle is very hard coded. So, if I want to make a > TeamDisplay and I pass in say, New York Giants, I want to show the > stats (pass into RPC to get stats) and show the logo. Now the problem > is getting the logo out of the image bundle. The only way I can figure > out how to do this is with a giant 32 branch of if/else. > > Is there any other way to go from a team name (String) to picking the > right image out of the bundle? The giant if/else will work, it'll just > be ugly as hell. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
