// To replace the existing tag with the widget created above, the HTMLPanel needs
// to have the id of the element being replaced. Since we can't expect users to assign
// unique ids in every tag, we do this here automatically.
String uniqueId = HTMLPanel.createUniqueId();
tagElement.setId(uniqueId);
contentPanel.addAndReplaceElement(widget, uniqueId);
}
}
}
} catch (Exception e) {
// Just return the panel with the original content