Package tripleplay.ui

Class Root

All Implemented Interfaces:
AutoCloseable, Iterable<Element<?>>, react.Closeable
Direct Known Subclasses:
CapturedRoot

public class Root extends Elements<Root> implements react.Closeable
The root of a display hierarchy. An application can have one or more roots, but they should not overlap and will behave as if oblivious to one another's existence.
  • Field Details

    • iface

      public final Interface iface
      The interface of which this root is a part.
    • validated

      public final react.SignalView<Root> validated
      A signal emitted when this root is validated.
  • Constructor Details

    • Root

      public Root(Interface iface, Layout layout, Stylesheet sheet)
      Creates a new root with the provided layout and stylesheet. a
  • Method Details

    • pack

      public Root pack()
      Sizes this root element to its preferred size.
    • pack

      public Root pack(float widthHint, float heightHint)
      Sizes this element to its preferred size, computed using the supplied hints.
    • packToWidth

      public Root packToWidth(float width)
      Sizes this root element to the specified width and its preferred height.
    • packToHeight

      public Root packToHeight(float height)
      Sizes this root element to the specified height and its preferred width.
    • setSize

      public Root setSize(float width, float height)
      Sets the size of this root element.
    • setSize

      public Root setSize(pythagoras.f.IDimension size)
      Sets the size of this root element.
    • setBounds

      public Root setBounds(float x, float y, float width, float height)
      Sets the size of this root element and its translation from its parent.
    • setLocation

      public void setLocation(float x, float y)
      Configures the location of this root, relative to its parent layer.
    • isShowing

      public boolean isShowing()
      Description copied from class: Element
      Returns true only if this element and all its parents' Element.isVisible() return true.
      Overrides:
      isShowing in class Element<Root>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface react.Closeable
    • preferredSize

      public pythagoras.f.IDimension preferredSize(float hintX, float hintY)
      Computes the preferred size of this root. In general, one should use pack() or one of the related pack methods, but if one has special sizing requirements, they may wish to call preferredSize directly, followed by setSize(float, float).
      Parameters:
      hintX - the width hint (a width in which the layout will attempt to fit itself), or 0 to allow the layout to use unlimited width.
      hintY - the height hint (a height in which the layout will attempt to fit itself), or 0 to allow the layout to use unlimited height.
    • validate

      public void validate()
      Applies the root size to all descendants. The size normally comes from a call to pack() or a related method. Validation is performed automatically by Interface.paint(playn.core.Clock) if the root is created via Interface.
    • setAbsorbsClicks

      public Root setAbsorbsClicks(boolean absorbsClicks)
      By default, all clicks that fall within a root's bounds are dispatched to the root's layer if they do not land on an interactive child element. This prevents clicks from "falling through" to lower roots, which are visually obscured by this root. Call this method with false if you want this root not to absorb clicks (if it's "transparent").
    • setMenuHost

      public void setMenuHost(MenuHost host)
      Sets this Root's menu host, allowing an application to more manage multiple roots with a single menu host.
    • getMenuHost

      public MenuHost getMenuHost()
      Gets this Root's menu host, creating it if necessary.