Class RenderableStamper


  • public class RenderableStamper
    extends java.lang.Object
    Used by IsRenderable to mark their root element in such a way that they can be later retrieved. This class abstracts the exact details of how the element is marked and retrieved, so that we can always use the best method avaialable without having to change all implementations of IsRenderable.

    The expected flow is for the IsRenderable object to use one of the stamp(com.google.gwt.safehtml.shared.SafeHtml) methods below to mark their HTML. At a later point, its parent widget will use the findStampedElement() to retrieve the right element.

    • Constructor Summary

      Constructors 
      Constructor Description
      RenderableStamper​(java.lang.String token)
      Creates a stamper that will be use the given token, which is assumed to be unique and will be escaped before being used.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Element findStampedElement()
      Finds the element that was previously stamped in the DOM.
      SafeHtml stamp​(SafeHtml safeHtml)
      Stamps an HTML element in such a way that it can be later found in the DOM tree.
      <T extends HtmlElementBuilderBase<?>>
      T
      stamp​(T elementBuilder)
      Stamps an HTML element in such a way that it can be later found in the DOM tree.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RenderableStamper

        public RenderableStamper​(java.lang.String token)
        Creates a stamper that will be use the given token, which is assumed to be unique and will be escaped before being used.
    • Method Detail

      • findStampedElement

        public Element findStampedElement()
        Finds the element that was previously stamped in the DOM. For this to work properly the element must be attached to the document.
      • stamp

        public SafeHtml stamp​(SafeHtml safeHtml)
        Stamps an HTML element in such a way that it can be later found in the DOM tree. To be used by IsRenderable objects built using SafeHtml directly, this assumes the element to be stamped is the first found in the given SafeHtml. Returns safeHtml untouched if it does not being with a tag.
      • stamp

        public <T extends HtmlElementBuilderBase<?>> T stamp​(T elementBuilder)
        Stamps an HTML element in such a way that it can be later found in the DOM tree. To be used by IsRenderable objects built using ElementBuilder, this assumes the given elementBuilder is for the root element that should later be claimed.