Class BuiltInComposite<T extends org.inspirenxe.strata.api.component.Component<T>>
java.lang.Object
org.inspirenxe.strata.core.node.BuiltInComponent<T>
org.inspirenxe.strata.core.node.BuiltInComposite<T>
- Type Parameters:
T- the type callers see the component as
- All Implemented Interfaces:
org.inspirenxe.strata.api.component.Component<T>, org.inspirenxe.strata.api.component.Enableable<T>, org.inspirenxe.strata.api.event.EventTarget<T>
- Direct Known Subclasses:
BuiltInContainer, ColorPickerImpl, ExpanderImpl, FlyoutImpl, GridViewImpl, InfoBarImpl, ListViewImpl, MessageBoxImpl, NavigationViewImpl, PasswordTextBoxImpl, SpinnerImpl, SplitPaneImpl, TabBarImpl, TableViewImpl, TreeViewImpl
public abstract class BuiltInComposite<T extends org.inspirenxe.strata.api.component.Component<T>>
extends BuiltInComponent<T>
Base class of Strata's own controls that are built from private parts, the counterpart of the public
CustomComposite. Its node is a ContainerNode whose children
callers cannot reach. Control events of a part added with addChild(Component) stop here; those of content added with
addContent(Component) pass on. BuiltInContainer extends it and makes the children public.
In BuiltInComponent.measure(MeasureContext, float, float) measure every child and in arrange(ArrangeContext, Rect) give every child a slot, hidden ones included,
as CustomComposite requires.
-
Field Summary
Fields inherited from interface org.inspirenxe.strata.api.component.Component
ATTACHED, DETACHED, ENABLED, MEASURED, OPACITY, PAINT, PAINTED, VISIBLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuiltInComposite(ComponentFactoryImpl factory) Creates the component and its node, whose children are private parts. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddChild(org.inspirenxe.strata.api.component.Component<?> child) Adds a private part at the end.protected final voidaddContent(org.inspirenxe.strata.api.component.Component<?> child) Adds a child that is content shown for the user, such as a cell from the user's cell factory.protected abstract voidarrange(org.inspirenxe.strata.api.extension.ArrangeContext context, org.inspirenxe.strata.api.geometry.Rect bounds) Gives every child its slot.protected org.inspirenxe.strata.api.geometry.RectReturns the rectangle children are clipped to and hit-tested against, unlesssetChildClipping(boolean)turned clipping off.protected final List<org.inspirenxe.strata.api.component.Component<?>> Returns the children in layout order, the order focus and Tab follow.protected final voidRemoves every child.protected final voidinsertChild(int index, org.inspirenxe.strata.api.component.Component<?> child) Adds a private part at a place in the layout order, which is also the tree order Tab follows.protected final voidinsertContent(int index, org.inspirenxe.strata.api.component.Component<?> child) Adds content, asaddContent(Component)does, at a place in the layout order, which is also the tree order Tab follows.protected final voidAsks for this component to be arranged again in its last bounds before the next frame, without measuring anything.protected final voidlowerChild(org.inspirenxe.strata.api.component.Component<?> child) Draws a child under its siblings with the same z index, so the pointer hits it last among them.protected final voidmoveChild(org.inspirenxe.strata.api.component.Component<?> child, int index) Moves a child to another place in the layout order.protected final ContainerNodenode()Returns the container node behind this component.protected voidonChildRemoved(org.inspirenxe.strata.api.component.Component<?> child) Called after a child is removed, to drop any data kept about it.protected voidonDescendantFocused(org.inspirenxe.strata.api.component.Component<?> descendant) Called after focus moves to a component inside this one, on every ancestor of it, innermost first.protected voidpaintOverChildren(org.inspirenxe.strata.api.extension.Painter painter, org.inspirenxe.strata.api.geometry.Rect bounds) Draws after the children, on top of them and outside their clip.protected final voidraiseChild(org.inspirenxe.strata.api.component.Component<?> child) Draws a child over its siblings with the same z index, and lets the pointer hit it first among them.protected final voidremoveChild(org.inspirenxe.strata.api.component.Component<?> child) Removes a child.protected final voidsetChildClipping(boolean clip) Sets whether children are clipped tochildClip().Methods inherited from class BuiltInComponent
acceptsTextInput, activatesOnPress, ancestor, background, baseline, bind, border, bounds, clearTooltip, contextMenu, cursor, desiredHeight, desiredWidth, environment, flow, flowDirection, hasStyleState, horizontalAlignment, hostRoot, id, invalidateLayout, isAttached, isEnabled, isFocusable, isFocused, isFocusFromPress, isFocusVisible, isFocusWithin, isHandled, isHitTestVisible, isHovered, isHoverWithin, isPressed, isRightToLeft, isTabbable, isVisible, margin, maxHeight, maxWidth, measure, measureMinimum, minHeight, minWidth, motionAnimator, nodeOf, offsetX, offsetY, onApplyTheme, onAttached, onChar, onClick, onDetached, onDisabled, onDrag, onDragEnd, onDragEnter, onDragExit, onDragOver, onDragStart, onDrop, onEdgeScroll, onEnabledChanged, onEvent, onFocusGained, onFocusLost, onKey, onOtherEvent, onPointerEnter, onPointerExit, onPointerMove, onPointerPress, onPointerRelease, onPressWithin, onReleased, onScroll, onTransferDone, opacity, paint, parent, parent, repaint, repaintAfter, repaintNextFrame, report, report, request, request, requestFocus, requiredStyleKeys, self, setAlignment, setBackground, setBorder, setContextMenu, setCursor, setEnabled, setFlowDirection, setFocusable, setFocusDelegate, setHeight, setHitTestVisible, setId, setMargin, setMaxSize, setMinSize, setOffset, setOpacity, setStyleState, setTabbable, setTabIndex, setTooltip, setVisible, setWidth, setZIndex, snapshotState, stylePaint, styleText, subscribe, tabIndex, textInputKind, theme, tooltip, toString, unbind, verticalAlignment, whileAttached, zIndexMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.inspirenxe.strata.api.component.Component
isEffectivelyEnabled, isEffectivelyVisible, setAnchor, setMargin, setMargin, setMargin, setSizeMethods inherited from interface org.inspirenxe.strata.api.event.EventTarget
onEvent
-
Constructor Details
-
BuiltInComposite
Creates the component and its node, whose children are private parts.- Parameters:
factory- the factory of the host that will show this component
-
-
Method Details
-
node
Returns the container node behind this component.- Overrides:
nodein classBuiltInComponent<T extends org.inspirenxe.strata.api.component.Component<T>>- Returns:
- the node
-
arrange
protected abstract void arrange(org.inspirenxe.strata.api.extension.ArrangeContext context, org.inspirenxe.strata.api.geometry.Rect bounds) Gives every child its slot. Called afterBuiltInComponent.measure(MeasureContext, float, float), with the component's final bounds, and again with the same bounds afterinvalidateArrangement().- Parameters:
context- child sizes and slot assignmentbounds- the component's bounds
-
onChildRemoved
protected void onChildRemoved(org.inspirenxe.strata.api.component.Component<?> child) Called after a child is removed, to drop any data kept about it. The default does nothing.- Parameters:
child- the removed child
-
childClip
protected org.inspirenxe.strata.api.geometry.Rect childClip()Returns the rectangle children are clipped to and hit-tested against, unlesssetChildClipping(boolean)turned clipping off. Called during painting and hit testing. The default is the bounds.- Returns:
- the clip, in the host's coordinates
-
paintOverChildren
protected void paintOverChildren(org.inspirenxe.strata.api.extension.Painter painter, org.inspirenxe.strata.api.geometry.Rect bounds) Draws after the children, on top of them and outside their clip. The default draws nothing.- Parameters:
painter- what to draw with; valid only during this callbounds- the component's bounds
-
onDescendantFocused
protected void onDescendantFocused(org.inspirenxe.strata.api.component.Component<?> descendant) Called after focus moves to a component inside this one, on every ancestor of it, innermost first. The default does nothing.- Parameters:
descendant- the component that gained focus
-
invalidateArrangement
protected final void invalidateArrangement()Asks for this component to be arranged again in its last bounds before the next frame, without measuring anything. -
childList
-
addChild
protected final void addChild(org.inspirenxe.strata.api.component.Component<?> child) Adds a private part at the end. Its control events, and those of anything inside it, stop at this component.- Parameters:
child- the child- Throws:
IllegalArgumentException- if the child already has a parent, is a host's content, would create a cycle, or was made by another factory
-
insertChild
protected final void insertChild(int index, org.inspirenxe.strata.api.component.Component<?> child) Adds a private part at a place in the layout order, which is also the tree order Tab follows. It is drawn over the existing children with the same z index, as a part added at the end is.- Parameters:
index- where the child goes: 0 for the first, the number of children for the lastchild- the child- Throws:
IndexOutOfBoundsException- if the index is negative or greater than the number of childrenIllegalArgumentException- if the child already has a parent, this component included, is a host's content, would create a cycle, or was made by another factory
-
addContent
protected final void addContent(org.inspirenxe.strata.api.component.Component<?> child) Adds a child that is content shown for the user, such as a cell from the user's cell factory. Its control events, and those of anything inside it, pass this component and every composite above it.- Parameters:
child- the child- Throws:
IllegalArgumentException- if the child already has a parent, is a host's content, would create a cycle, or was made by another factory
-
insertContent
protected final void insertContent(int index, org.inspirenxe.strata.api.component.Component<?> child) Adds content, asaddContent(Component)does, at a place in the layout order, which is also the tree order Tab follows. Only core can do this.- Parameters:
index- where the child goes: 0 for the first, the number of children for the lastchild- the child- Throws:
IndexOutOfBoundsException- if the index is negative or greater than the number of childrenIllegalArgumentException- if the child already has a parent, is a host's content, would create a cycle, or was made by another factory
-
moveChild
protected final void moveChild(org.inspirenxe.strata.api.component.Component<?> child, int index) Moves a child to another place in the layout order. The child stays attached, keeps focus, hover and press state, and fires no events of leaving or joining the tree. Layout runs again; where the child is drawn does not change.- Parameters:
child- the childindex- the place it ends up at, from 0 to the number of children minus one- Throws:
IllegalArgumentException- if the component is not a child of this componentIndexOutOfBoundsException- if the index is negative or not less than the number of children
-
raiseChild
protected final void raiseChild(org.inspirenxe.strata.api.component.Component<?> child) Draws a child over its siblings with the same z index, and lets the pointer hit it first among them. Nothing is laid out again.- Parameters:
child- the child- Throws:
IllegalArgumentException- if the component is not a child of this component
-
lowerChild
protected final void lowerChild(org.inspirenxe.strata.api.component.Component<?> child) Draws a child under its siblings with the same z index, so the pointer hits it last among them. Nothing is laid out again.- Parameters:
child- the child- Throws:
IllegalArgumentException- if the component is not a child of this component
-
removeChild
protected final void removeChild(org.inspirenxe.strata.api.component.Component<?> child) Removes a child. Does nothing if it is not a child of this component.- Parameters:
child- the child
-
clearChildren
protected final void clearChildren()Removes every child. -
setChildClipping
protected final void setChildClipping(boolean clip) Sets whether children are clipped tochildClip(). Children are clipped by default. ABuiltInContainerreports the setting through its publicclipsChildren().- Parameters:
clip- false to let children draw and be hit outside it
-