Class ComponentElement
- Direct Known Subclasses:
StatefulElement,StatelessElement
It manages a single child Widget and builds it as needed. Both StatelessWidget and StatefulWidget use this kind of Element.
- Since:
- 6.2.0
- Version:
- 1.0.0
- Author:
- UltiTools Team
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.ultikits.ultitools.abstracts.gui.declarative.core.Element
addChild, assignContext, canUpdate, clearDirty, getContext, getParent, getWidget, isDirty, isMounted, markChildNeedsBuild, markNeedsBuild, setRootBuildScheduler, toString, update, updateChild, updateChildren
-
Field Details
-
_child
-
-
Constructor Details
-
ComponentElement
-
-
Method Details
-
build
Builds the child Widget.- Returns:
- the child Widget
-
performRebuild
public void performRebuild()Description copied from class:ElementPerforms a rebuild.Subclasses should implement this method to build or rebuild the Widget tree.
- Specified by:
performRebuildin classElement
-
getChildren
Description copied from class:ElementGets the list of child Elements.- Overrides:
getChildrenin classElement- Returns:
- the child Element list, or an empty list if there are none
-
mount
Description copied from class:ElementMounts 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 callssuper.mount(parent)before doing its own work (mounting children, running the firstperformRebuild(), 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()callingchildElement.mount(this)for each child, and themount()->performRebuild()->updateChild()->mount()cascadeStatelessElement/StatefulElementdrive 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 exceedRenderDepthGuard.MAX_DEPTHwithout first passing through an unguardedmount()call -- which this check closes. -
unmount
public void unmount()Description copied from class:ElementRemoves this Element from the tree.Called when the Element is no longer needed. Subclasses should perform cleanup work here and unmount their child Elements.
-