How to clear an embedded image

Hi,

I’m wondering of a way to clear an embedded image.

If I call embedded.setSource(null) then the previously displayed image remains unchanged. I would like to just blank it out, like it’s state before an image is set.

Thanks, Ryan

Did you have tried to set the embedded to immediate or the layout, usually this should help?

Florian

Remove the embedded from the layout or setVisible(false);

When it is initially displayed with no content it has a border on it. If I remove it then the border goes with it. Also if I set a blank image as the content then the border disappears.

I’ll try the setImmediate, but I thought that was for responding to client side events?

setImmediate() has no effect on layouts or Embedded. This behaviour sounds like a bug; I’d expect an Embedded to clear its content after calling setSource(null). What version of Vaadin are you using?

When adding a blank image instead, you say that the ‘border disappears’. What do you mean by border: is it a margin, padding, or a border in the CSS sense?

And then for a possible solution; try creating a new Embedded with a null resource, and replacing the old Embedded with the new one with replaceComponent().

Using version 6.8.3

Looks like a css border to me. Just a light grey border. After setting an image the border no longer displays. It feels like that would be by design, otherwise you wouldn’t see that an embedded component was actually there.

Anyway for now I’m just setting it to a transparent png on creation, then I can manage my own border, and instead of setting to null, it set it back to the blank png.