If the image is not available.

Hi Guys!
I have a problem. I want to solve this probem when a Image is not available.
How can I check the previous situation? I think for example in .js (browser): the onError method. It is called when the image is unavailable, and I can change the url of the image to a common url in method.
So my question: How can I change the url of the (unavailbale) image to my common url in Vaadin.
I tired the setErrrorHadler, but it’s not work for me.

Any suggestion? Sorry for my english knowlege.
Thank’s the comments in anvance.
Gabor.

Hi,

Vaadin does not catch the image onerror event on the client side, but it should be quite easy to write an
component extension
that adds a error listener to the image widget. The client side would look something like this:

class ImageErrorConnector extends AbstractExtensionConnector {
  @Override
  protected void extend(ServerConnector target) {
    final VImage img = ((ImageConnector) target).getWidget();
    img.addErrorHandler(new ErrorHandler() {
      public void onError(ErrorEvent event) {
        img.setUrl(myDefaultUrl);
    });
  }
}