Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    background images and image bundles howto

    Hi,

    I've created an image bundle

    public interface LayoutImagesBundle extends ImageBundle {

    public AbstractImagePrototype layout_bg();
    }

    I'm trying to set the background image of a canvas with this image but I only see a string as a parameter...
    canvas.setBackgroundImage(String) - can someone give me a tip as to how this should be done? Thanks.

    Joe

    #2
    So, it seems like SmartGWT doesn't work with GWT ImageBundles... is this correct?

    I don't necessarily have to use ImageBundles - I just want a background image to show up - can anyone give me an example of what I would need to do to have a custom image render as a background image for a canvas? Thank you very much.

    Joe

    Comment


      #3
      It looks like that the imageBundle works for stand alone images in layouts and other components, but when it is used for setting up a background image of these elements it returns the whole bundle. That is all the images in one and not just the one specified.

      For example:

      Code:
      VLayout vLayout = new VLayout();
      
      vLayout.setWidth100();
      vLayout.setHeight100();
      
      Image loginImage = MyBundleImages.Impl.getInstance().loginBackgroundImg().createImage();
      
      vLayout.setBackgroundImage(loginImage.getUrl());
      vLayout.draw();
      where MyBundleImages is:
      Code:
      public interface MyBundleImages extends ImageBundle {
      
      	@Resource("image1.jpg")
      	AbstractImagePrototype loginBackgroundImg();
      	
      	@Resource("image2.gif")
      	AbstractImagePrototype logoImg();
      	
      	public static class Impl {
      	    	
      		private static MyBundleImages instance;
      
      		public static MyBundleImages getInstance() {
      			if (instance == null) {
      				instance = GWT.create(MyBundleImages.class);
      			}
      			return instance;
      		}
      	}
      
      }
      This will return a composite image of image1 and image2 and not just image1.
      Any way to overcome this with using bundles? Or do I have to go to plain URLs?

      Comment

      Working...
      X