Revision: 10323
Author:   [email protected]
Date:     Mon Jun 13 03:14:47 2011
Log: Adds setTagName to PotentialElement, so that PotentialElement instances can be passed to the as() method of Element subclasses (it's nicer than blindly calling .cast(), I think). Let me know if this looks clearner to you guys.

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

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

Modified:
 /trunk/user/src/com/google/gwt/user/client/ui/PotentialElement.java
 /trunk/user/src/com/google/gwt/user/client/ui/RenderablePanel.java

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/PotentialElement.java Wed Jun 8 04:46:32 2011 +++ /trunk/user/src/com/google/gwt/user/client/ui/PotentialElement.java Mon Jun 13 03:14:47 2011
@@ -41,6 +41,15 @@
     assert isPotential(e);
     return (PotentialElement) e;
   }
+
+  /**
+   * Builds a new PotentialElement with the tag name set to "div".
+   *
+   * @see #build(UIObject,String)
+   */
+  public static PotentialElement build(UIObject o) {
+    return build(o, "div");
+  }

   /**
    * Builds a new PotentialElement. This element keeps track of the
@@ -48,7 +57,7 @@
    * {@link UIObject#resolvePotentialElement} to get a real element when
    * that is needed.
    */
-  public static native PotentialElement build(UIObject o) /*-{
+ public static native PotentialElement build(UIObject o, String tagName) /*-{ return @com.google.gwt.dom.client.Element::as(Lcom/google/gwt/core/client/JavaScriptObject;)({
       className: '',
       clientHeight: 0,
@@ -71,6 +80,7 @@
       },
       src: '',
       style: {},
+      tagName: tagName,
__gwt_resolve: @com.google.gwt.user.client.ui.PotentialElement::buildResolveCallback(Lcom/google/gwt/user/client/ui/UIObject;)(o),
       title: ''
     });
=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/RenderablePanel.java Mon Jun 6 04:09:34 2011 +++ /trunk/user/src/com/google/gwt/user/client/ui/RenderablePanel.java Mon Jun 13 03:14:47 2011
@@ -36,6 +36,8 @@

   private static Element hiddenDiv;

+  private static String TAG_NAME = "div";
+
   interface HTMLTemplates extends SafeHtmlTemplates {
     @Template("<div id=\"{0}\">{1}</div>")
     SafeHtml renderWithId(String id, SafeHtml innerHtml);
@@ -86,7 +88,7 @@
    */
   public RenderablePanel(SafeHtml safeHtml) {
     this.html = safeHtml;
-    setElement(PotentialElement.build(this));
+    setElement(PotentialElement.build(this, TAG_NAME));
   }

   /**

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

Reply via email to