GWT 2.7.0

com.google.gwt.uibinder.client
Class LazyDomElement<T extends Element>

java.lang.Object
  extended by com.google.gwt.uibinder.client.LazyDomElement<T>
Type Parameters:
T - the Element type associated

public class LazyDomElement<T extends Element>
extends java.lang.Object

Wraps a call to a DOM element. LazyDomElement can boost performance of html elements and delay calls to getElementById() to when the element is actually used. But note that it will throw a RuntimeException in case the element is accessed but not yet attached in the DOM tree.

Usage example:

Template:

   <gwt:HTMLPanel>
      <div ui:field="myDiv" />
   </gwt:HTMLPanel>
 

Class:

   @UiField LazyDomElement<DivElement> myDiv;

   public setText(String text) {
     myDiv.get().setInnerHtml(text);
   }
 


Constructor Summary
LazyDomElement(java.lang.String domId)
          Creates an instance to fetch the element with the given id.
 
Method Summary
 T get()
          Returns the dom element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyDomElement

public LazyDomElement(java.lang.String domId)
Creates an instance to fetch the element with the given id.

Method Detail

get

public T get()
Returns the dom element.

Returns:
the dom element
Throws:
java.lang.RuntimeException - if the element cannot be found

GWT 2.7.0