Package tripleplay.ui

Class Container<T extends Container<T>>

java.lang.Object
tripleplay.ui.Element<T>
tripleplay.ui.Container<T>
All Implemented Interfaces:
Iterable<Element<?>>
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.
  • Constructor Details

    • Container

      public Container()
  • Method Details

    • removeFromParent

      public static boolean removeFromParent(Element<?> element, boolean destroy)
      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 remove
      destroy - whether to also destroy the element
      Returns:
      true if the element had a parent and it was removed or destroyed
    • stylesheet

      public abstract Stylesheet stylesheet()
      Returns the stylesheet associated with this container, or null. Styles are resolved by searching up the container hierarchy. Only Container actually provides styles to its children.
    • childCount

      public abstract int childCount()
      Returns the number of children contained by this container.
    • childAt

      public abstract Element<?> childAt(int index)
      Returns the child at the specified index.
    • iterator

      public abstract Iterator<Element<?>> iterator()
      Returns an unmodifiable iterator over the children of this Container.
      Specified by:
      iterator in interface Iterable<T extends Container<T>>