Package tripleplay.ui
Class Container<T extends Container<T>>
java.lang.Object
tripleplay.ui.Element<T>
tripleplay.ui.Container<T>
- Direct Known Subclasses:
Composite
,Container.Mutable
public abstract class Container<T extends Container<T>>
extends Element<T>
implements Iterable<Element<?>>
A shared base class for elements which contain other elements.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Container.Mutable<T extends Container.Mutable<T>>
A container that allows mutation (adding and removal) of its children.Nested classes/interfaces inherited from class tripleplay.ui.Element
Element.Take
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Element<?>
childAt
(int index) Returns the child at the specified index.abstract int
Returns the number of children contained by this container.iterator()
Returns an unmodifiable iterator over the children of this Container.static boolean
removeFromParent
(Element<?> element, boolean destroy) Removes and optionally destroys the given element from its parent, if the parent is a mutable container.abstract Stylesheet
Returns the stylesheet associated with this container, or null.Methods inherited from class tripleplay.ui.Element
addStyles, addStyles, bindEnabled, bindVisible, bounds, constraint, enabledSlot, hierarchyChanged, isAdded, isEnabled, isShowing, isVisible, location, parent, setConstraint, setEnabled, setStyles, setStyles, setVisible, size, styles, visibleSlot, x, y
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Container
public Container()
-
-
Method Details
-
removeFromParent
Removes and optionally destroys the given element from its parent, if the parent is a mutable container. This is set apart as a utility method since it is not desirable to have on all containers, but is frequently useful to have. The caller is willing to accept the class cast exception if the parent container is not mutable. Does nothing if the element has no parent.- Parameters:
element
- the element to removedestroy
- whether to also destroy the element- Returns:
- true if the element had a parent and it was removed or destroyed
-
stylesheet
Returns the stylesheet associated with this container, or null. Styles are resolved by searching up the container hierarchy. OnlyContainer
actually provides styles to its children. -
childCount
public abstract int childCount()Returns the number of children contained by this container. -
childAt
Returns the child at the specified index. -
iterator
Returns an unmodifiable iterator over the children of this Container.
-