Revision: 10084
Author:   her...@google.com
Date:     Tue Apr 26 12:50:53 2011
Log: This fix a bug in WidgetPlaceholderInterpreter (missing convertField) and create a new FieldWriterType to substitute the ugly setBuildPrecedence().
It also make LazyDomElement used in more places. This saved a few bytes.

Review at http://gwt-code-reviews.appspot.com/1420810

http://code.google.com/p/google-web-toolkit/source/detail?r=10084

Modified:
 /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java

=======================================
--- /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java Tue Apr 26 11:22:45 2011 +++ /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java Tue Apr 26 12:50:53 2011
@@ -26,6 +26,7 @@
 import com.google.gwt.uibinder.attributeparsers.BundleAttributeParser;
 import com.google.gwt.uibinder.attributeparsers.BundleAttributeParsers;
 import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiBinderUtil.LazyDomElement;
 import com.google.gwt.uibinder.elementparsers.AttributeMessageParser;
 import com.google.gwt.uibinder.elementparsers.BeanParser;
 import com.google.gwt.uibinder.elementparsers.ElementParser;
@@ -370,13 +371,11 @@
     String name = declareDomIdHolder();

     if (useLazyWidgetBuilders) {
-      // Initialize and add the removeAttribute('id') statement for the new
-      // DOM field.
+      // Create and initialize the dom field with LazyDomElement.
       FieldWriter field = fieldManager.require(fieldName);
-      field.setInitializer(formatCode(
-          "com.google.gwt.dom.client.Document.get().getElementById(%s).cast()",
+      field.setInitializer(formatCode("new %s(%s).get().cast()",
+          LazyDomElement.class.getCanonicalName(),
           fieldManager.convertFieldToGetter(name)));
-      field.addStatement("%s.removeAttribute(\"id\");", fieldName);

       // The dom must be created by its ancestor.
       fieldManager.require(ancestorField).addAttachStatement(

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to