java.lang.Object
com.ultikits.ultitools.abstracts.gui.declarative.core.Element
com.ultikits.ultitools.abstracts.gui.declarative.widgets.ContainerElement

public class ContainerElement extends Element
The Element counterpart of Container.
Since:
6.2.0
Version:
1.0.0
Author:
UltiTools Team
  • Field Details

    • childElements

      private final List<Element> childElements
  • Constructor Details

    • ContainerElement

      public ContainerElement(@NotNull @NotNull Container container)
  • Method Details

    • mount

      public void mount(@Nullable @Nullable Element parent)
      Description copied from class: Element
      Mounts this Element into the tree.

      Called the first time the Element is inserted into the tree. Subclasses should perform initialization work here and mount their child Elements.

      CR-01 (T-05-62 / #371): every mount(Element) override in this codebase calls super.mount(parent) before doing its own work (mounting children, running the first performRebuild(), etc.) -- this base method is therefore the single choke point through which the ENTIRE mounting recursion passes, one call per Element, regardless of subtype: ContainerElement/GridViewElement.mountChildren() mounting each child through updateChildren() and updateChild(), and the mount()->performRebuild()->updateChild()->mount() cascade StatelessElement/StatefulElement drive when composing a child Widget for the first time. Checking the depth HERE, rather than separately in every subclass's own mounting method, guards the mount recursion exactly once per node without needing to duplicate the check at each override. update()/unmount()'s own recursions need no separate guard: they only ever walk a subtree whose depth was already validated here when it was first mounted, so they can never exceed RenderDepthGuard.MAX_DEPTH without first passing through an unguarded mount() call -- which this check closes.

      Overrides:
      mount in class Element
      Parameters:
      parent - the parent Element, or null if this is the root Element
    • update

      public void update(@NotNull @NotNull Widget newWidget)
      Description copied from class: Element
      Updates this Element with a new Widget.

      Called when the Widget rebuilds. Subclasses should update their reference to the Widget and perform any necessary updates.

      Overrides:
      update in class Element
      Parameters:
      newWidget - the new Widget instance
    • performRebuild

      public void performRebuild()
      Description copied from class: Element
      Performs a rebuild.

      Subclasses should implement this method to build or rebuild the Widget tree.

      Specified by:
      performRebuild in class Element
    • unmount

      public void unmount()
      Description copied from class: Element
      Removes this Element from the tree.

      Called when the Element is no longer needed. Subclasses should perform cleanup work here and unmount their child Elements.

      Overrides:
      unmount in class Element
    • getChildren

      @NotNull public @NotNull List<Element> getChildren()
      Description copied from class: Element
      Gets the list of child Elements.
      Overrides:
      getChildren in class Element
      Returns:
      the child Element list, or an empty list if there are none
    • mountChildren

      private void mountChildren()