ImageThumbnail.register(registries.getElementHandlerRegistry(), attachmentManager,
new ThumbnailActionHandler() {
@Override
public boolean onClick(ImageThumbnailWrapper thumbnail) {
ContentElement e = thumbnail.getElement();
String newId = Window.prompt("New attachment id, or 'remove' to remove the attribute",
e.getAttribute(ImageThumbnail.ATTACHMENT_ATTR));
if (newId == null) {
// They hit escape
return true;
}
if ("remove".equals(newId)) {
newId = null;
}
e.getMutableDoc().setElementAttribute(e, ImageThumbnail.ATTACHMENT_ATTR, newId);
return true;
}
});