/** * Lock the current element, preventing any additional changes to it. The only * valid option is to call {@link #end()}. */ protected void lockCurrentElement() { maybeCloseStartTag(); assertEndTagNotForbidden("html"); isHtmlOrTextAdded = true; }
public void onStart(String tagName, ElementBuilderBase<?> builder) { if (isEmpty) { isEmpty = false; } else if (stack.isEmpty()) { // Check that we aren't creating another top level element. throw new IllegalStateException("You can only build one top level element."); } else { // Check that the element supports children. assertEndTagNotForbidden("child elements"); if (!getCurrentBuilder().isChildElementSupported()) { throw new UnsupportedOperationException(getCurrentTagName() + " does not support child elements."); } } // Check that asElement hasn't already been called. if (isHtmlOrTextAdded) { throw new IllegalStateException("Cannot append an element after setting text of html."); } // Validate the tagName. assertValidTagName(tagName); maybeCloseStartTag(); stack.push(builder, tagName); isStartTagOpen = true; isStyleOpen = false; isStyleClosed = false; isHtmlOrTextAdded = false; }
/** * End the current element without checking the tag name. * * @param tagName the tag name to end */ private void endImpl(String tagName) { // Close the start tag. maybeCloseStartTag(); /* * End the tag. The tag name is safe because it comes from the stack, and * tag names are checked before they are added to the stack. */ if (getCurrentBuilder().isEndTagForbidden()) { doEndStartTagImpl(); } else { doEndTagImpl(tagName); } // Popup the item off the top of the stack. isStartTagOpen = false; // Closed because this element was added. isStyleClosed = true; // Too late to add styles. stack.pop(); /* * If this element was added, then we did not add html or text to the * parent. */ isHtmlOrTextAdded = false; }
/** * Lock the current element, preventing any additional changes to it. The only * valid option is to call {@link #end()}. */ protected void lockCurrentElement() { maybeCloseStartTag(); assertEndTagNotForbidden("html"); isHtmlOrTextAdded = true; }
/** * Lock the current element, preventing any additional changes to it. The only * valid option is to call {@link #end()}. */ protected void lockCurrentElement() { maybeCloseStartTag(); assertEndTagNotForbidden("html"); isHtmlOrTextAdded = true; }
public void onStart(String tagName, ElementBuilderBase<?> builder) { if (isEmpty) { isEmpty = false; } else if (stack.isEmpty()) { // Check that we aren't creating another top level element. throw new IllegalStateException("You can only build one top level element."); } else { // Check that the element supports children. assertEndTagNotForbidden("child elements"); if (!getCurrentBuilder().isChildElementSupported()) { throw new UnsupportedOperationException(getCurrentTagName() + " does not support child elements."); } } // Check that asElement hasn't already been called. if (isHtmlOrTextAdded) { throw new IllegalStateException("Cannot append an element after setting text of html."); } // Validate the tagName. assertValidTagName(tagName); maybeCloseStartTag(); stack.push(builder, tagName); isStartTagOpen = true; isStyleOpen = false; isStyleClosed = false; isHtmlOrTextAdded = false; }
public void onStart(String tagName, ElementBuilderBase<?> builder) { if (isEmpty) { isEmpty = false; } else if (stack.isEmpty()) { // Check that we aren't creating another top level element. throw new IllegalStateException("You can only build one top level element."); } else { // Check that the element supports children. assertEndTagNotForbidden("child elements"); if (!getCurrentBuilder().isChildElementSupported()) { throw new UnsupportedOperationException(getCurrentTagName() + " does not support child elements."); } } // Check that asElement hasn't already been called. if (isHtmlOrTextAdded) { throw new IllegalStateException("Cannot append an element after setting text of html."); } // Validate the tagName. assertValidTagName(tagName); maybeCloseStartTag(); stack.push(builder, tagName); isStartTagOpen = true; isStyleOpen = false; isStyleClosed = false; isHtmlOrTextAdded = false; }
/** * End the current element without checking the tag name. * * @param tagName the tag name to end */ private void endImpl(String tagName) { // Close the start tag. maybeCloseStartTag(); /* * End the tag. The tag name is safe because it comes from the stack, and * tag names are checked before they are added to the stack. */ if (getCurrentBuilder().isEndTagForbidden()) { doEndStartTagImpl(); } else { doEndTagImpl(tagName); } // Popup the item off the top of the stack. isStartTagOpen = false; // Closed because this element was added. isStyleClosed = true; // Too late to add styles. stack.pop(); /* * If this element was added, then we did not add html or text to the * parent. */ isHtmlOrTextAdded = false; }
/** * End the current element without checking the tag name. * * @param tagName the tag name to end */ private void endImpl(String tagName) { // Close the start tag. maybeCloseStartTag(); /* * End the tag. The tag name is safe because it comes from the stack, and * tag names are checked before they are added to the stack. */ if (getCurrentBuilder().isEndTagForbidden()) { doEndStartTagImpl(); } else { doEndTagImpl(tagName); } // Popup the item off the top of the stack. isStartTagOpen = false; // Closed because this element was added. isStyleClosed = true; // Too late to add styles. stack.pop(); /* * If this element was added, then we did not add html or text to the * parent. */ isHtmlOrTextAdded = false; }