java.lang.Object | |
↳ | com.google.gwt.uibinder.rebind.XMLElement |
A wrapper for Element that limits the way parsers can interact with the XML document, and provides some convenience methods.
The main function of this wrapper is to ensure that parsers can only read elements and attributes by 'consuming' them, which removes the given value. This allows for a natural hierarchy among parsers -- more specific parsers will run first, and if they consume a value, less-specific parsers will not see it.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
XMLElement.Interpreter<T> | Callback interface used by consumeInnerHtml(Interpreter) and
consumeChildElements(Interpreter) . |
||||||||||
XMLElement.Location | Represents the source location where the XMLElement was declared. | ||||||||||
XMLElement.PostProcessingInterpreter<T> | Extends XMLElement.Interpreter with a method to be called after all elements
have been processed. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Ensure that the receiver has no attributes left.
| |||||||||||
Require that the receiver's body is empty of text and has no child nodes.
| |||||||||||
Require that the receiver's body is empty of text.
| |||||||||||
Consumes the given attribute as a literal or field reference.
| |||||||||||
Like
consumeAttributeWithDefault(String, String, JType) , but
accommodates more complex type signatures. | |||||||||||
Consumes the given attribute as a literal or field reference.
| |||||||||||
Convenience method for parsing the named attribute as a boolean value or
reference.
| |||||||||||
Convenience method for parsing the named attribute as a boolean value or
reference.
| |||||||||||
Consumes the named attribute as a boolean expression.
| |||||||||||
Consumes and returns all child elements.
| |||||||||||
Consumes and returns all child elements selected by the interpreter.
| |||||||||||
Convenience method for parsing the named attribute as an ImageResource
value or reference.
| |||||||||||
Refines
consumeInnerHtml(Interpreter) to handle
PostProcessingInterpreter. | |||||||||||
Consumes all child elements, and returns an HTML interpretation of them.
| |||||||||||
Refines
consumeInnerTextEscapedAsHtmlStringLiteral(Interpreter) to
handle PostProcessingInterpreter. | |||||||||||
Consumes all child text nodes, and asserts that this element held only
text.
| |||||||||||
Convenience method for parsing the named attribute as a CSS length value.
| |||||||||||
Consumes all attributes, and returns a string representing the entire
opening tag.
| |||||||||||
Consumes the named attribute and parses it to an unparsed, unescaped array
of Strings.
| |||||||||||
Consumes the given attribute and returns its trimmed value, or null if it
was unset.
| |||||||||||
Consumes the given attribute and returns its trimmed value, or the given
default value if it was unset.
| |||||||||||
Consumes the given required attribute as a literal or field reference.
| |||||||||||
Convenience method for parsing the named required attribute as a double
value or reference.
| |||||||||||
Convenience method for parsing the named required attribute as a integer
value or reference.
| |||||||||||
Consumes the named attribute, or dies if it is missing.
| |||||||||||
Consumes a single child element, ignoring any text nodes and throwing an
exception if no child is found, or more than one child element is found.
| |||||||||||
Consumes the named attribute and parses it to an array of String
expressions.
| |||||||||||
Convenience method for parsing the named attribute as a String value or
reference.
| |||||||||||
Convenience method for parsing the named attribute as a String value or
reference.
| |||||||||||
Returns the unprocessed, unescaped, raw inner text of the receiver.
| |||||||||||
Get the attribute at the given index.
| |||||||||||
Get the attribute with the given name.
| |||||||||||
Returns the number of attributes this element has.
| |||||||||||
Returns the design time path of this element, in form of indexes from root,
such as "0/0/1/0".
| |||||||||||
Gets this element's local name (sans namespace prefix).
| |||||||||||
Gets this element's namespace URI.
| |||||||||||
Returns the parent element, or null if parent is null or a node type other
than Element.
| |||||||||||
Determines whether the element has a given attribute.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Ensure that the receiver has no attributes left.
UnableToCompleteException | if it does |
---|
Require that the receiver's body is empty of text and has no child nodes.
UnableToCompleteException | if it isn't |
---|
Require that the receiver's body is empty of text.
UnableToCompleteException | if it isn't |
---|
Consumes the given attribute as a literal or field reference. The type parameter is required to determine how the value is parsed and validated.
name | the attribute's full name (including prefix) |
---|---|
type | the type this attribute is expected to provide |
UnableToCompleteException | on parse failure |
---|
Like consumeAttributeWithDefault(String, String, JType)
, but
accommodates more complex type signatures.
UnableToCompleteException |
---|
Consumes the given attribute as a literal or field reference. The type parameter is required to determine how the value is parsed and validated.
name | the attribute's full name (including prefix) |
---|---|
defaultValue | the value to @return if the attribute was unset |
type | the type this attribute is expected to provide |
UnableToCompleteException | on parse failure |
---|
Convenience method for parsing the named attribute as a boolean value or reference.
UnableToCompleteException | on unparseable value |
---|
Convenience method for parsing the named attribute as a boolean value or reference.
defaultValue | value to return if attribute was not set |
---|
UnableToCompleteException | on unparseable value |
---|
Consumes the named attribute as a boolean expression. This will not accept {field.reference} expressions. Useful for values that must be resolved at compile time, such as generated annotation values.
UnableToCompleteException | on unparseable value |
---|
Consumes and returns all child elements.
UnableToCompleteException | if extra text nodes are found |
---|
Consumes and returns all child elements selected by the interpreter. Note that text nodes are not elements, and so are not presented for interpretation, and are not consumed.
interpreter | Should return true for any child that should be consumed and returned by the consumeChildElements call |
---|
UnableToCompleteException |
---|
Convenience method for parsing the named attribute as an ImageResource value or reference.
UnableToCompleteException | on unparseable value |
---|
Refines consumeInnerHtml(Interpreter)
to handle
PostProcessingInterpreter.
UnableToCompleteException |
---|
Consumes all child elements, and returns an HTML interpretation of them. Trailing and leading whitespace is trimmed.
Each element encountered will be passed to the given Interpreter for possible replacement. Escaping is performed to allow the returned text to serve as a Java string literal used as input to a setInnerHTML call.
This call requires an interpreter to make sense of any special children. The odds are you want to use com.google.gwt.uibinder.elementparsers.templates.parsers.HtmlInterpreter for an HTML value, or com.google.gwt.uibinder.elementparsers.templates.parsers.TextInterpreter for text.
interpreter | Called for each element, expected to return a string replacement for it, or null if it should be left as is |
---|
UnableToCompleteException |
---|
Refines consumeInnerTextEscapedAsHtmlStringLiteral(Interpreter)
to
handle PostProcessingInterpreter.
UnableToCompleteException |
---|
Consumes all child text nodes, and asserts that this element held only text. Trailing and leading whitespace is trimmed, and escaped for use as a string literal. Notice that HTML entities in the text are also escaped--is this a source of errors?
This call requires an interpreter to make sense of any special children. The odds are you want to use com.google.gwt.uibinder.elementparsers.templates.parsers.TextInterpreter
UnableToCompleteException | If any elements present are not consumed by the interpreter |
---|
Convenience method for parsing the named attribute as a CSS length value.
UnableToCompleteException | on unparseable value |
---|
Consumes all attributes, and returns a string representing the entire opening tag. E.g., "
Consumes the named attribute and parses it to an unparsed, unescaped array of Strings. The strings in the attribute may be comma or space separated (or a mix of both).
Consumes the given attribute and returns its trimmed value, or null if it was unset. The returned string is not escaped.
name | the attribute's full name (including prefix) |
---|
Consumes the given attribute and returns its trimmed value, or the given default value if it was unset. The returned string is not escaped.
name | the attribute's full name (including prefix) |
---|---|
defaultValue | the value to return if the attribute was unset |
Consumes the given required attribute as a literal or field reference. The types parameters are required to determine how the value is parsed and validated.
name | the attribute's full name (including prefix) |
---|---|
types | the type(s) this attribute is expected to provide |
UnableToCompleteException | on parse failure, or if the attribute is empty or unspecified |
---|
Convenience method for parsing the named required attribute as a double value or reference.
UnableToCompleteException | on unparseable value, or if the attribute is empty or unspecified |
---|
Convenience method for parsing the named required attribute as a integer value or reference.
UnableToCompleteException | on unparseable value, or if the attribute is empty or unspecified |
---|
Consumes the named attribute, or dies if it is missing.
UnableToCompleteException |
---|
Consumes a single child element, ignoring any text nodes and throwing an exception if no child is found, or more than one child element is found.
UnableToCompleteException | on no children, or too many |
---|
Consumes the named attribute and parses it to an array of String expressions. The strings in the attribute may be comma or space separated (or a mix of both).
UnableToCompleteException | on unparseable value |
---|
Convenience method for parsing the named attribute as a String value or reference.
UnableToCompleteException | on unparseable value |
---|
Convenience method for parsing the named attribute as a String value or reference.
UnableToCompleteException | on unparseable value |
---|
Returns the unprocessed, unescaped, raw inner text of the receiver. Dies if the receiver has non-text children.
You probably want to use
consumeInnerTextEscapedAsHtmlStringLiteral(XMLElement.Interpreter
instead.
UnableToCompleteException | if it held anything other than text nodes |
---|
Get the attribute at the given index. If you are consuming attributes, remember to traverse them in reverse.
Get the attribute with the given name.
Returns the number of attributes this element has.
Returns the design time path of this element, in form of indexes from root, such as "0/0/1/0".
Returns the parent element, or null if parent is null or a node type other than Element.