Class ElementBuilderImpl
java.lang.Object
com.google.gwt.dom.builder.shared.ElementBuilderImpl
- Direct Known Subclasses:
DomBuilderImpl
,HtmlBuilderImpl
Base implementation of
ElementBuilderBase
that handles state, but
nothing else.
DO NOT USE THIS CLASS. This class is an implementation class and may change in the future.
This class is used to ensure that the HTML and DOM implementations throw the same exceptions, even if something is valid in one and not the other. For example, the DOM implementation supports changing an attribute after setting inner HTML, but the HTML version does not, so they should both throw an error. Otherwise, they would not be swappable.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Assert that the builder is in a state where an attribute can be added.protected void
Assert that a style property can be added, and setup the state as if one is about to be added.protected void
assertValidTagName
(String tagName) Assert that the specified tag name is valid.protected abstract void
Close the start tag.protected abstract void
Close the style attribute.protected abstract void
Self-close the start tag.protected abstract void
doEndTagImpl
(String tagName) End the specified tag.protected abstract Element
Return the build element.protected abstract void
doHtmlImpl
(SafeHtml html) Set the specified html as the inner HTML of the current element.protected abstract void
Open the style attribute.protected abstract void
doTextImpl
(String text) Set the specified text as the inner text of the current element.void
end()
void
protected void
End all open tags, including the root element.void
endStyle()
finish()
Return the built DOM as anElement
.int
getDepth()
void
protected void
Lock the current element, preventing any additional changes to it.void
onStart
(String tagName, ElementBuilderBase<?> builder) abstract StylesBuilder
style()
Get theStylesBuilder
used to add style properties to the current element.void
-
Constructor Details
-
ElementBuilderImpl
public ElementBuilderImpl()
-
-
Method Details
-
end
public void end() -
end
-
endStyle
public void endStyle() -
finish
Return the built DOM as anElement
.- Returns:
- the
Element
that was built
-
getDepth
public int getDepth() -
style
Get theStylesBuilder
used to add style properties to the current element.- Returns:
- a
StylesBuilder
-
text
-
assertCanAddAttributeImpl
protected void assertCanAddAttributeImpl()Assert that the builder is in a state where an attribute can be added. -
assertCanAddStylePropertyImpl
protected void assertCanAddStylePropertyImpl()Assert that a style property can be added, and setup the state as if one is about to be added. -
assertValidTagName
Assert that the specified tag name is valid.- Throws:
IllegalArgumentException
- if not valid
-
doCloseStartTagImpl
protected abstract void doCloseStartTagImpl()Close the start tag. -
doCloseStyleAttributeImpl
protected abstract void doCloseStyleAttributeImpl()Close the style attribute. -
doEndStartTagImpl
protected abstract void doEndStartTagImpl()Self-close the start tag. This method is called for elements that forbid the end tag. -
doEndTagImpl
End the specified tag.- Parameters:
tagName
- the name of the tag to end
-
doFinishImpl
Return the build element.- Returns:
- the element
-
doOpenStyleImpl
protected abstract void doOpenStyleImpl()Open the style attribute. -
doTextImpl
Set the specified text as the inner text of the current element.- Parameters:
text
- the text to set
-
endAllTags
protected void endAllTags()End all open tags, including the root element.Doing so also ensures that all builder methods will throw an exception because the stack is empty, and a new element cannot be started.
-
lockCurrentElement
protected void lockCurrentElement()Lock the current element, preventing any additional changes to it. The only valid option is to callend()
.
-