Note that there are some explanatory texts on larger screens.

plurals
  1. POGWT AbstractCell - render an image with a URL and include an error handler?
    primarykey
    data
    text
    <p>GWT's AbstractCell allows you to create custom cells, including the ability to render an image in the cell. Is there a way to render an image by setting it's URL property <strong>and</strong> have an error handler associated with it (to take action in the event the image resource is not available or has a problem loading)? In testing the image properties render properly but it doesn't appear that the error handler is included.</p> <p>Here is the example code I'm attempting to use:</p> <pre><code>new AbstractCell&lt;String&gt;() { @Override public void render (Context context, String value, final SafeHtmlBuilder sb) { final Image testImage = new Image(); testImage.addErrorHandler(new ErrorHandler() { @Override public void onError(ErrorEvent event) { // image SRC failed to load so pick a different image and set the tool tip testImage.setResource(images.errorLoading()); // from an image bundle testImage.setTitle("Image Load Failed"); } }); // the value passed in is the image src testImage.setUrl(value); sb.append(SafeHtmlUtils.fromTrustedString(testImage.toString())); } </code></pre> <p>I think the problem resides in the <code>testImage.toString()</code>. To implement the AbstractCell you must append to the SafeHtmlBuilder. When using the <code>toString()</code> method on the image, the image URL is set correctly and other attributes are set correctly, but the Error Handler is not included in the <code>toString()</code> method (as best I can tell). Is there another way to go about this? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload