Package tripleplay.ui

Class Box

All Implemented Interfaces:
Iterable<Element<?>>
Direct Known Subclasses:
Box.Clipped

public class Box extends Container.Mutable<Box>
A container that holds zero or one widget. The box delegates everything to its current contents (its preferred size is its content's preferred size, it sizes its contents to its size).
  • Constructor Details

    • Box

      public Box()
      Creates an empty box.
    • Box

      public Box(Element<?> contents)
      Creates a box with the specified starting contents.
  • Method Details

    • contents

      public Element<?> contents()
      Returns the box's current contents.
    • set

      public Box set(Element<?> contents)
      Updates the box's contents. The previous contents, if any, is removed but not destroyed. To destroy the old contents and set the new, use destroyContents().set(contents).
    • transition

      public Box transition(Element<?> contents, Box.Trans trans)
      Performs an animated transition from the box's current contents to contents.
      Parameters:
      trans - describes and manages the transition (duration, style, etc.).
    • clear

      public Box clear()
      Clears out the box's current contents.
    • destroyContents

      public Box destroyContents()
      Clears out the box's current contents and destroys it immediately.
    • stylesheet

      public Stylesheet stylesheet()
      Description copied from class: Container
      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.
      Specified by:
      stylesheet in class Container<Box>
    • childCount

      public int childCount()
      Description copied from class: Container
      Returns the number of children contained by this container.
      Specified by:
      childCount in class Container<Box>
    • childAt

      public Element<?> childAt(int index)
      Description copied from class: Container
      Returns the child at the specified index.
      Specified by:
      childAt in class Container<Box>
    • iterator

      public Iterator<Element<?>> iterator()
      Description copied from class: Container
      Returns an unmodifiable iterator over the children of this Container.
      Specified by:
      iterator in interface Iterable<Element<?>>
      Specified by:
      iterator in class Container<Box>
    • remove

      public void remove(Element<?> child)
      Description copied from class: Container.Mutable
      Removes the specified child from this container.
      Specified by:
      remove in class Container.Mutable<Box>
    • removeAt

      public void removeAt(int index)
      Description copied from class: Container.Mutable
      Removes the child at the specified index from this container.
      Specified by:
      removeAt in class Container.Mutable<Box>
    • removeAll

      public void removeAll()
      Description copied from class: Container.Mutable
      Removes all children from this container.
      Specified by:
      removeAll in class Container.Mutable<Box>
    • destroy

      public void destroy(Element<?> child)
      Description copied from class: Container.Mutable
      Removes and destroys the specified child.
      Specified by:
      destroy in class Container.Mutable<Box>
    • destroyAt

      public void destroyAt(int index)
      Description copied from class: Container.Mutable
      Removes and destroys the child at the specified index.
      Specified by:
      destroyAt in class Container.Mutable<Box>
    • destroyAll

      public void destroyAll()
      Description copied from class: Container.Mutable
      Removes and destroys all children from this container.
      Specified by:
      destroyAll in class Container.Mutable<Box>