public abstract class AbstractUiRenderer extends Object implements UiRenderer
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractUiRenderer.UiRendererDispatcher<T>
Helps handle method dispatch to classes that use UiRenderer.
|
Modifier and Type | Field and Description |
---|---|
static String |
RENDERED_ATTRIBUTE
Marker attribute for DOM structures previously generated by UiRenderer.
|
static String |
ROOT_FAKE_NAME
Field name used to identify the root element while dispatching events.
|
static String |
UI_ID_SEPARATOR |
protected String |
uiId
Holds the part of the id attribute common to all elements being rendered.
|
Constructor and Description |
---|
AbstractUiRenderer() |
Modifier and Type | Method and Description |
---|---|
protected static String |
buildInnerId(String fieldName,
String uiId)
Build id strings used to identify DOM elements related to ui:fields.
|
protected static Element |
findInnerField(Element parent,
String fieldName,
String attribute)
Retrieves a specific element within a previously rendered element.
|
protected static Element |
findRootElement(Element parent,
String attribute)
Retrieves the root of a previously rendered element contained within the
parent . |
boolean |
isParentOrRenderer(Element parent)
Checks whether
parent is a valid element to use as an argument for field getters. |
protected static SafeHtml |
stampUiRendererAttribute(SafeHtml safeHtml,
String attributeName,
String attributeValue)
Inserts an attribute into the first tag found in a
safeHtml template. |
public static final String RENDERED_ATTRIBUTE
public static final String ROOT_FAKE_NAME
public static final String UI_ID_SEPARATOR
protected String uiId
protected static String buildInnerId(String fieldName, String uiId)
fieldName
- name of the field that identifies the elementuiId
- common part of the identifier for all elements in the rendered DOM structureprotected static Element findInnerField(Element parent, String fieldName, String attribute)
parent
- parent element containing the element of interestfieldName
- name of the field to retrieveattribute
- that identifies the root element as suchfieldName
IllegalArgumentException
- if the parent
does not point to or contains
a previously rendered element. In DevMode also when the root element is not
attached to the DOMIllegalStateException
- parent does not contain an element matching
filedName
RuntimeException
- if the root element is not attached to the DOM and not running in
DevModeNullPointerException
- if parent
== nullprotected static Element findRootElement(Element parent, String attribute)
parent
.
The parent
must either contain the previously rendered DOM structure as its only child,
or point directly to the rendered element root.parent
- element containing, or pointing to, a previously rendered DOM structureattribute
- attribute name that identifies the root of the DOM structureNullPointerException
- if parent
== nullIllegalArgumentException
- if parent
does not contain a previously rendered
elementprotected static SafeHtml stampUiRendererAttribute(SafeHtml safeHtml, String attributeName, String attributeValue)
safeHtml
template.
This method assumes that the safeHtml
template begins with an open HTML tag.
SafeHtml
templates produced by UiBinder always meet these conditions.
This method does not attempt to ensure atributeName
and attributeValue
contain safe values.
public boolean isParentOrRenderer(Element parent)
UiRenderer
parent
is a valid element to use as an argument for field getters.isParentOrRenderer
in interface UiRenderer
true
if parent contains or directly points to a previously rendered element.
In DevMode it also checks whether the parent is attached to the DOMCopyright © 2018. All rights reserved.