Class HtmlElementContainer<SELF extends HtmlElementContainer<SELF>>

java.lang.Object
org.apache.juneau.bean.html5.HtmlElement<SELF>
org.apache.juneau.bean.html5.HtmlElementContainer<SELF>
Type Parameters:
SELF - The self type for fluent setters.
Direct Known Subclasses:
Colgroup, Datalist, Dl, Figure, Head, Html, Main, Map, Ol, Optgroup, Select, Table, Tbody, Tfoot, Thead, Tr, Ul

public abstract class HtmlElementContainer<SELF extends HtmlElementContainer<SELF>> extends HtmlElement<SELF>
A subclass of HTML elements that contain only other elements, not text.
See Also:
  • Constructor Details

  • Method Details

    • child

      public SELF child(Object value)
      Adds a child element to this element.
      Parameters:
      value - The child to add as a child element. Can be null (a null entry is added to the children list).
      Returns:
      This object.
    • children

      public SELF children(Object... value)
      Adds one or more child elements to this element.
      Parameters:
      value - The children to add as child elements. Must not be null.
      Returns:
      This object.
    • getChild

      public <T> T getChild(Class<T> type, int index)
      Returns the child node at the specified index.
      Type Parameters:
      T - The class type of the node.
      Parameters:
      type - The class type of the node.
      index - The index of the node in the list of children.
      Returns:
      The child node, or null if it doesn't exist.
      Throws:
      InvalidConversionException - If node is not the expected type.
    • getChild

      public Object getChild(int index)
      Returns the child node at the specified index.
      Parameters:
      index - The index of the node in the list of children.
      Returns:
      The child node, or null if it doesn't exist.
    • getChild

      public Object getChild(int... index)
      Returns the child node at the specified address.

      Indexes are zero-indexed.

      For example, calling getChild(1,2,3); will return the 4th child of the 3rd child of the 2nd child.

      Parameters:
      index - The child indexes.
      Returns:
      The child node, or null if it doesn't point to a valid child.
    • getChildren

      The children of this element.
      Returns:
      The children of this element, or null if no children are set.
    • setChildren

      @BeanProp("c") public SELF setChildren(List<Object> children)
      Sets the children for this container.
      Parameters:
      children - The new children for this container. Can be null to clear all children.
      Returns:
      This object.