Reviewers: rjrjr,
Description:
Fix error in usage of newly-creted helper method in AttachableHTMLPanel,
correct double-calling of wrapElement in exceptional case, and fix the
documentation.
Please review this at http://gwt-code-reviews.appspot.com/1427812/
Affected files:
M user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
Index: user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
===================================================================
--- user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
(revision 10128)
+++ user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
(working copy)
@@ -202,14 +202,16 @@
@Override
public void wrapElement(Element element) {
- if (!isFullyInitialized()) {
- // NOTE(rdcastro): This code is only run when Attachable is in
active use.
+ if (isFullyInitialized()) {
+ // If wrapElement is being called after the widget is fully
initialized,
+ // all we have to do is replace the given element with the the DOM
tree
+ // we already built.
element.getParentNode().replaceChild(getElement(), element);
- } else {
- setElement(element);
- html = null;
- }
-
+ return;
+ }
+
+ setElement(element);
+ html = null;
if (wrapInitializationCallback != null) {
wrapInitializationCallback.execute();
wrapInitializationCallback = null;
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors