Package tripleplay.ui
Class Root
java.lang.Object
- All Implemented Interfaces:
AutoCloseable
,Iterable<Element<?>>
,react.Closeable
- Direct Known Subclasses:
CapturedRoot
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class tripleplay.ui.Container
Container.Mutable<T extends Container.Mutable<T>>
Nested classes/interfaces inherited from class tripleplay.ui.Element
Element.Take
Nested classes/interfaces inherited from interface react.Closeable
react.Closeable.Set, react.Closeable.Util
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRoot
(Interface iface, Layout layout, Stylesheet sheet) Creates a new root with the provided layout and stylesheet. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Gets this Root's menu host, creating it if necessary.boolean
Returns true only if this element and all its parents'Element.isVisible()
return true.pack()
Sizes this root element to its preferred size.pack
(float widthHint, float heightHint) Sizes this element to its preferred size, computed using the supplied hints.packToHeight
(float height) Sizes this root element to the specified height and its preferred width.packToWidth
(float width) Sizes this root element to the specified width and its preferred height.pythagoras.f.IDimension
preferredSize
(float hintX, float hintY) Computes the preferred size of this 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.setBounds
(float x, float y, float width, float height) Sets the size of this root element and its translation from its parent.void
setLocation
(float x, float y) Configures the location of this root, relative to its parent layer.void
setMenuHost
(MenuHost host) Sets this Root's menu host, allowing an application to more manage multiple roots with a single menu host.setSize
(float width, float height) Sets the size of this root element.setSize
(pythagoras.f.IDimension size) Sets the size of this root element.void
validate()
Applies the root size to all descendants.Methods inherited from class tripleplay.ui.Elements
add, add, childAdded, childAt, childCount, childRemoved, destroy, destroyAll, destroyAt, iterator, remove, removeAll, removeAt, setStylesheet, stylesheet
Methods inherited from class tripleplay.ui.Container
removeFromParent
Methods inherited from class tripleplay.ui.Element
addStyles, addStyles, bindEnabled, bindVisible, bounds, constraint, enabledSlot, hierarchyChanged, isAdded, isEnabled, 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
-
Field Details
-
iface
The interface of which this root is a part. -
validated
A signal emitted when this root is validated.
-
-
Constructor Details
-
Root
Creates a new root with the provided layout and stylesheet. a
-
-
Method Details
-
pack
Sizes this root element to its preferred size. -
pack
Sizes this element to its preferred size, computed using the supplied hints. -
packToWidth
Sizes this root element to the specified width and its preferred height. -
packToHeight
Sizes this root element to the specified height and its preferred width. -
setSize
Sets the size of this root element. -
setSize
Sets the size of this root element. -
setBounds
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. -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacereact.Closeable
-
preferredSize
public pythagoras.f.IDimension preferredSize(float hintX, float hintY) Computes the preferred size of this root. In general, one should usepack()
or one of the related pack methods, but if one has special sizing requirements, they may wish to callpreferredSize
directly, followed bysetSize(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() -
setAbsorbsClicks
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
Sets this Root's menu host, allowing an application to more manage multiple roots with a single menu host. -
getMenuHost
Gets this Root's menu host, creating it if necessary.
-