Class HtmlInterpreter
- java.lang.Object
-
- com.google.gwt.uibinder.elementparsers.HtmlInterpreter
-
- All Implemented Interfaces:
com.google.gwt.uibinder.rebind.XMLElement.Interpreter<java.lang.String>
public class HtmlInterpreter extends java.lang.Object implements com.google.gwt.uibinder.rebind.XMLElement.Interpreter<java.lang.String>
This is the most generally useful interpreter, and the most likely to be used by a custom parser when callingXMLElement.consumeInnerHtml(com.google.gwt.uibinder.rebind.XMLElement.Interpreter<java.lang.String>)
.- Assigns computed values to element attributes (e.g. class="{style.pretty}")
- Generates fields to hold named dom elements (e.g. <div gwt:field="importantDiv">)
- Turns <ui:msg> and <ui:attr> elements into methods on a generated Messages interface
- Fails if any element encountered is a widget
-
-
Constructor Summary
Constructors Constructor Description HtmlInterpreter(com.google.gwt.uibinder.rebind.UiBinderWriter writer, java.lang.String ancestorExpression, com.google.gwt.uibinder.rebind.XMLElement.Interpreter<java.lang.String> messageInterpreter)
Rather than using this constructor, you probably want to use thenewInterpreterForUiObject(com.google.gwt.uibinder.rebind.UiBinderWriter, java.lang.String)
factory method.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
interpretElement(com.google.gwt.uibinder.rebind.XMLElement elem)
Given an XMLElement, return its filtered value.static HtmlInterpreter
newInterpreterForUiObject(com.google.gwt.uibinder.rebind.UiBinderWriter writer, java.lang.String uiExpression)
A convenience factory method for the most common use of this class, to work with HTML that will eventually be rendered under aUIObject
(or really, any object that responds togetElement()
).
-
-
-
Constructor Detail
-
HtmlInterpreter
public HtmlInterpreter(com.google.gwt.uibinder.rebind.UiBinderWriter writer, java.lang.String ancestorExpression, com.google.gwt.uibinder.rebind.XMLElement.Interpreter<java.lang.String> messageInterpreter)
Rather than using this constructor, you probably want to use thenewInterpreterForUiObject(com.google.gwt.uibinder.rebind.UiBinderWriter, java.lang.String)
factory method.- Parameters:
ancestorExpression
- An expression that can be evaluated at runtime to find an Element that will be an ancestor of all Elements generated from the interpreted HTML.messageInterpreter
- an interpreter to handle msg and ph elements, typically an instance ofHtmlMessageInterpreter
. This interpreter gets last crack
-
-
Method Detail
-
newInterpreterForUiObject
public static HtmlInterpreter newInterpreterForUiObject(com.google.gwt.uibinder.rebind.UiBinderWriter writer, java.lang.String uiExpression)
A convenience factory method for the most common use of this class, to work with HTML that will eventually be rendered under aUIObject
(or really, any object that responds togetElement()
). Uses an instance ofHtmlMessageInterpreter
to process message elements.- Parameters:
uiExpression
- An expression that can be evaluated at runtime to find an object whose getElement() method can be called to get an ancestor of all Elements generated from the interpreted HTML.
-
interpretElement
public java.lang.String interpretElement(com.google.gwt.uibinder.rebind.XMLElement elem) throws UnableToCompleteException
Description copied from interface:com.google.gwt.uibinder.rebind.XMLElement.Interpreter
Given an XMLElement, return its filtered value.- Specified by:
interpretElement
in interfacecom.google.gwt.uibinder.rebind.XMLElement.Interpreter<java.lang.String>
- Throws:
UnableToCompleteException
- on error
-
-