Revision: 10140
Author: rdcas...@google.com
Date: Wed May 4 12:02:05 2011
Log: Fix error in usage of newly-creted helper method in
AttachableHTMLPanel, correct double-calling of wrapElement in exceptional
case, and fix the documentation.
Review at http://gwt-code-reviews.appspot.com/1427812
Review by: rj...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=10140
Modified:
/trunk/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
Mon May 2 12:51:01 2011
+++ /trunk/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
Wed May 4 12:02:05 2011
@@ -202,14 +202,20 @@
@Override
public void wrapElement(Element element) {
- if (!isFullyInitialized()) {
- // NOTE(rdcastro): This code is only run when Attachable is in
active use.
- element.getParentNode().replaceChild(getElement(), element);
- } else {
- setElement(element);
- html = null;
+ if (isFullyInitialized()) {
+ /*
+ * If wrapElement is being called after the widget is fully
initialized,
+ * that's probably a programming error, as it's much more efficient
to
+ * build the whole tree at once.
+ */
+ throw new IllegalStateException(
+ "wrapElement() cannot be called twice, or after a call to
getElement()"
+ + "has forced the widget to render itself (e.g. after adding it
to a"
+ + "panel)");
}
+ setElement(element);
+ html = null;
if (wrapInitializationCallback != null) {
wrapInitializationCallback.execute();
wrapInitializationCallback = null;
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors