Class ContainerElement<T extends ContainerElement<T>>
- All Implemented Interfaces:
Container
This class makes the container methods from Element publicly accessible.
Elements that extend this class allow callers to add, insert, remove, and set
child elements and text content. Non-container elements keep these methods
protected to prevent misuse.
- Since:
- 2026
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionContainerElement(String tagName) Constructs a container element with the specified tag name and a closing tag.ContainerElement(String tagName, boolean closed) Constructs a container element with the specified tag name and closing behavior. -
Method Summary
Modifier and TypeMethodDescriptionaddElement(Element child) Adds a child element to this element.voidaddLineOfText(String text) Appends text content followed by a line break to this element.voidaddLineOfText(String text, CssStyle style) Appends text content with a CssStyle followed by a line break to this element.voidaddLineOfText(String text, String style) Appends text content with inline CSS styling followed by a line break to this element.voidAdds an empty paragraph element.voidaddParagraph(String text) Adds a paragraph element containing the specified text.voidaddSpacer(int height) Adds a vertical spacer element with the specified height in pixels.voidAppends a Text element to this element.voidAppends text content to this element.voidAppends text content with a CssStyle to this element.voidAppends text content with inline CSS styling to this element.insertElement(int index, Element child) Inserts a child element at the specified index.voidRemoves all child elements from this element.voidremoveElement(Element child) Removes a child element from this element.voidremoveElement(String id) Removes a child element by its ID.setElement(Element child) Replaces all child elements with a single child element.voidSets the text content of this element, replacing any existing content.voidSets the text content of this element with a CssStyle, replacing any existing content.voidSets the text content of this element with a font, replacing any existing content.voidSets the text content of this element with inline CSS styling, replacing any existing content.Methods inherited from class com.oorian.html.Element
addAttribute, addAttribute, addAttribute, addAttribute, addLineBreak, assignId, containsElement, containsElement, create, dispatchEvent, dispatchEvent, dispatchEvent, dispatchEvent, equals, excludeId, executeJs, executeJs, executeJs, getAccept, getAllElements, getAncestor, getAttribute, getAttributes, getComponent, getDir, getElement, getElementById, getElementCount, getElementCount, getElements, getElements, getElementsByComponentName, getElementsByTagName, getHtml, getHtml, getId, getInnerHtml, getInnerHtml, getIs, getItemId, getItemProp, getItemRef, getItemType, getLang, getNextSibling, getPage, getParent, getPart, getPrevSibling, getSlot, getTagName, getTextContent, getUrl, hasAttribute, hasElements, hidden, initialize, isChildOf, isClosedTag, isCreated, isDescendantOf, isDescendantOf, isInitialized, isItemScope, isTranslate, onCallback, onCreated, onElementAdded, onElementRemoved, onHashChange, onHidden, onInitialized, onJsReturn, onPageLoaded, onPageUnloaded, onRefresh, onRemovedFromPage, onShown, onUpdated, onUserEvent, prewrite, recreate, refresh, refresh, registerAddition, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerSubtraction, registerUpdate, removeAttribute, removeAttribute, removeFromParent, requestCallback, requestCallback, requestCallback, requestCallback, resetId, scrollTo, scrollToBottom, scrollToTop, self, sendCommand, sendUpdate, setAccept, setComponent, setDir, setDir, setId, setIs, setItemId, setItemProp, setItemRef, setItemScope, setItemType, setLang, setOnError, setOnLoad, setPage, setParent, setPart, setSlot, setTagName, setTranslate, shown, toString, unregisterListener, update, updateAttributesMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oorian.html.Container
getElement, getElementCount
-
Constructor Details
-
ContainerElement
Constructs a container element with the specified tag name and a closing tag.- Parameters:
tagName- the HTML tag name (e.g., "div", "section")
-
ContainerElement
Constructs a container element with the specified tag name and closing behavior.- Parameters:
tagName- the HTML tag nameclosed- true for elements with closing tags, false for self-closing elements
-
-
Method Details
-
addElement
Description copied from class:ElementAdds a child element to this element.The child is removed from its previous parent if it has one, then added to this element's children. If this element is already attached to a page, the child is also attached and registered for DOM addition.
- Specified by:
addElementin interfaceContainer- Overrides:
addElementin classElement<T extends ContainerElement<T>>- Parameters:
child- The child element to add.- Returns:
- this element for method chaining
-
setElement
Description copied from class:ElementReplaces all child elements with a single child element.All existing children are removed before adding the new child.
- Specified by:
setElementin interfaceContainer- Overrides:
setElementin classElement<T extends ContainerElement<T>>- Parameters:
child- The child element to set as the only child.- Returns:
- This element for method chaining.
-
insertElement
Description copied from class:ElementInserts a child element at the specified index.The child is removed from its previous parent if it has one, then inserted at the specified index in this element's children.
- Specified by:
insertElementin interfaceContainer- Overrides:
insertElementin classElement<T extends ContainerElement<T>>- Parameters:
index- The index at which to insert the child.child- The child element to insert.- Returns:
- this element for method chaining
-
addText
Description copied from class:ElementAppends a Text element to this element. -
addText
Description copied from class:ElementAppends text content with a CssStyle to this element. -
addText
Description copied from class:ElementAppends text content with inline CSS styling to this element. -
addText
Description copied from class:ElementAppends text content to this element. -
setText
Description copied from class:ElementSets the text content of this element with a CssStyle, replacing any existing content. -
setText
Description copied from class:ElementSets the text content of this element with a font, replacing any existing content. -
setText
Description copied from class:ElementSets the text content of this element with inline CSS styling, replacing any existing content. -
setText
Description copied from class:ElementSets the text content of this element, replacing any existing content. -
addParagraph
Description copied from class:ElementAdds a paragraph element containing the specified text.- Specified by:
addParagraphin interfaceContainer- Overrides:
addParagraphin classElement<T extends ContainerElement<T>>- Parameters:
text- the text content for the paragraph
-
addParagraph
public void addParagraph()Description copied from class:ElementAdds an empty paragraph element.- Specified by:
addParagraphin interfaceContainer- Overrides:
addParagraphin classElement<T extends ContainerElement<T>>
-
addSpacer
public void addSpacer(int height) Description copied from class:ElementAdds a vertical spacer element with the specified height in pixels. -
addLineOfText
Description copied from class:ElementAppends text content with a CssStyle followed by a line break to this element.- Specified by:
addLineOfTextin interfaceContainer- Overrides:
addLineOfTextin classElement<T extends ContainerElement<T>>- Parameters:
text- The text content to append.style- The CssStyle to apply to the text.
-
addLineOfText
Description copied from class:ElementAppends text content with inline CSS styling followed by a line break to this element.- Specified by:
addLineOfTextin interfaceContainer- Overrides:
addLineOfTextin classElement<T extends ContainerElement<T>>- Parameters:
text- The text content to append.style- The inline CSS style string to apply to the text.
-
addLineOfText
Description copied from class:ElementAppends text content followed by a line break to this element.- Specified by:
addLineOfTextin interfaceContainer- Overrides:
addLineOfTextin classElement<T extends ContainerElement<T>>- Parameters:
text- The text content to append.
-
removeAllElements
public void removeAllElements()Description copied from class:ElementRemoves all child elements from this element.Each child is unlinked and registered for DOM removal if the element is attached to a page.
- Specified by:
removeAllElementsin interfaceContainer- Overrides:
removeAllElementsin classElement<T extends ContainerElement<T>>
-
removeElement
Description copied from class:ElementRemoves a child element by its ID.- Specified by:
removeElementin interfaceContainer- Overrides:
removeElementin classElement<T extends ContainerElement<T>>- Parameters:
id- The ID of the child element to remove.
-
removeElement
Description copied from class:ElementRemoves a child element from this element.The child is unlinked from this parent and registered for DOM removal if the element is attached to a page.
- Specified by:
removeElementin interfaceContainer- Overrides:
removeElementin classElement<T extends ContainerElement<T>>- Parameters:
child- The child element to remove.
-