iobts / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

Images in GWT with deffrent extention #395

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:
2.01
Detailed description:
If you have two images with same name and different extension
eg: test.gif and test.png
like in images
 look at that code first to make a tree with icon from mail app sample
private String imageItemHTML(AbstractImagePrototype imageProto, String title) {
        return imageProto.getHTML() + " " + title;
    }

    private TreeItem addImageItem(TreeItem root, String title,
            AbstractImagePrototype imageProto) {
        TreeItem item = new TreeItem(imageItemHTML(imageProto, title));
        root.addItem(item);
        return item;
    }

    public interface Images extends ImageBundle, TreeImages {
        AbstractImagePrototype drafts();
        AbstractImagePrototype home();
        AbstractImagePrototype inbox();
        AbstractImagePrototype sent();
        AbstractImagePrototype templates();
        AbstractImagePrototype trash();
                AbstractImagePrototype treeLeaf();
        AbstractImagePrototype tasksgroup();
        AbstractImagePrototype error();
        AbstractImagePrototype test();
        @Resource("noimage.png")

    }
    private static final Images images = GWT.create(Images.class);

and these in client ... (onModuleLoad)
            Tree tree = new Tree(images);
            TreeItem roota = new TreeItem(imageItemHTML(images.home(), "foo@example.com"));
            tree.addItem(roota);
            addImageItem(roota, "Inbox", images.inbox());
            addImageItem(roota, "Drafts", images.drafts());
            addImageItem(roota, "Templates", images.templates());
            addImageItem(roota, "Sentxxx", images.sent());
            addImageItem(roota, "test", images.test());
            addImageItem(roota, "test2", images.test());
            RootPanel.get().add(tree);

GWT will take on of two images randomly  in images.sent() 
may be test.gif and may be test.png

Workaround if you have one:

Links to the relevant GWT Developer Forum posts:

Original issue reported on code.google.com by ahmedana...@gmail.com on 1 Jul 2010 at 12:04

Attachments:

GoogleCodeExporter commented 9 years ago
 i wonder how to control the choose !

Original comment by ahmedana...@gmail.com on 1 Jul 2010 at 12:06

GoogleCodeExporter commented 9 years ago
Using the @Source() annotation for your methods that return 
AbstractImagePrototype, you can disambiguate the image names or even pull them 
from a different path (which is what I've done in the past to keep images 
separate from Java src.)

For further help, I recommend you post this to the google-web-toolkit group.  
This issue list is for bugs in the Google APIs library for GWT.

Original comment by zundel@google.com on 1 Jul 2010 at 2:51

GoogleCodeExporter commented 9 years ago
Using the @Source() annotation for your methods that return 
AbstractImagePrototype, you can disambiguate the image names or even pull them 
from a different path (which is what I've done in the past to keep images 
separate from Java src.)

For further help, I recommend you post this to the google-web-toolkit group.  
This issue list is for bugs in the Google APIs library for GWT.

Original comment by zundel@google.com on 1 Jul 2010 at 2:51