How new Widget ?

Hello to all,
I am writing to ask for advice on an example of widget that I am creating.
My intention is to create a custom Image component with an attribute more than the normal html tag (altering the original html) and would like to pass a Fileresoure the src of the image (then encoded with the uri “internal” of Vaadin).

So I would expect to call the component as well:
MyImage im = new MyImage (new FileResource (new File (“physical path on the disk image”));
layout.addComponent (im);

that will be translated in html:

Of this then I have to be able to call functions from a javascript that will import.

Thanks for any help and sorry for my english!