Package tripleplay.ui

Class Element<T extends Element<T>>

java.lang.Object
tripleplay.ui.Element<T>
Direct Known Subclasses:
Container, Widget

public abstract class Element<T extends Element<T>> extends Object
The root of the interface element hierarchy. See Widget for the root of all interactive elements, and Container for the root of all container elements. Param T is used as a "self" type; when subclassing Element, T must be the type of the subclass.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Ways in which a preferred and an original dimension can be "taken" to produce a result.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The layer associated with this element.
  • Method Summary

    Modifier and Type
    Method
    Description
    addStyles(Style.Binding<?>... styles)
    Adds the supplied styles to this element (in the DEFAULT mode).
    addStyles(Styles styles)
    Adds the supplied styles to this element.
    bindEnabled(react.ValueView<Boolean> isEnabledV)
    Binds the enabledness of this element to the supplied value view.
    bindVisible(react.ValueView<Boolean> isVisibleV)
    Binds the visibility of this element to the supplied value view.
    pythagoras.f.Rectangle
    bounds(pythagoras.f.Rectangle bounds)
    Writes the current bounds of this element into the supplied bounds.
    Returns the layout constraint configured on this element, or null.
    react.Slot<Boolean>
    Returns a slot which can be used to wire the enabled status of this element to a Signal or Value.
    react.SignalView<Boolean>
    Returns a signal that will dispatch when this element is added or removed from the hierarchy.
    boolean
    Returns true if this element is part of an interface heirarchy.
    boolean
    Returns whether this element is enabled.
    boolean
    Returns true only if this element and all its parents' isVisible() return true.
    boolean
    Returns whether this element is visible.
    pythagoras.f.Point
    location(pythagoras.f.Point loc)
    Writes the location of this element (relative to its parent) into the supplied point.
    Returns the parent of this element, or null.
    Configures the layout constraint on this element.
    setEnabled(boolean enabled)
    Enables or disables this element.
    setStyles(Style.Binding<?>... styles)
    Configures styles for this element (in the DEFAULT mode).
    setStyles(Styles styles)
    Configures the styles for this element.
    setVisible(boolean visible)
    Configures whether this element is visible.
    pythagoras.f.IDimension
    Returns the width and height of this element's bounds.
    Returns the styles configured on this element.
    react.Slot<Boolean>
    Returns a slot which can be used to wire the visible status of this element to a Signal or Value.
    float
    x()
    Returns this element's x offset relative to its parent.
    float
    y()
    Returns this element's y offset relative to its parent.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • layer

      public final GroupLayer layer
      The layer associated with this element.
  • Method Details

    • x

      public float x()
      Returns this element's x offset relative to its parent.
    • y

      public float y()
      Returns this element's y offset relative to its parent.
    • size

      public pythagoras.f.IDimension size()
      Returns the width and height of this element's bounds.
    • location

      public pythagoras.f.Point location(pythagoras.f.Point loc)
      Writes the location of this element (relative to its parent) into the supplied point.
      Returns:
      loc for convenience.
    • bounds

      public pythagoras.f.Rectangle bounds(pythagoras.f.Rectangle bounds)
      Writes the current bounds of this element into the supplied bounds.
      Returns:
      bounds for convenience.
    • parent

      public Container<?> parent()
      Returns the parent of this element, or null.
    • hierarchyChanged

      public react.SignalView<Boolean> hierarchyChanged()
      Returns a signal that will dispatch when this element is added or removed from the hierarchy. The emitted value is true if the element was just added to the hierarchy, false if removed.
    • styles

      public Styles styles()
      Returns the styles configured on this element.
    • setStyles

      public T setStyles(Styles styles)
      Configures the styles for this element. Any previously configured styles are overwritten.
      Returns:
      this element for convenient call chaining.
    • setStyles

      public T setStyles(Style.Binding<?>... styles)
      Configures styles for this element (in the DEFAULT mode). Any previously configured styles are overwritten.
      Returns:
      this element for convenient call chaining.
    • addStyles

      public T addStyles(Styles styles)
      Adds the supplied styles to this element. Where the new styles overlap with existing styles, the new styles are preferred, but non-overlapping old styles are preserved.
      Returns:
      this element for convenient call chaining.
    • addStyles

      public T addStyles(Style.Binding<?>... styles)
      Adds the supplied styles to this element (in the DEFAULT mode). Where the new styles overlap with existing styles, the new styles are preferred, but non-overlapping old styles are preserved.
      Returns:
      this element for convenient call chaining.
    • isEnabled

      public boolean isEnabled()
      Returns whether this element is enabled.
    • setEnabled

      public T setEnabled(boolean enabled)
      Enables or disables this element. Disabled elements are not interactive and are usually rendered so as to communicate this state to the user.
    • enabledSlot

      public react.Slot<Boolean> enabledSlot()
      Returns a slot which can be used to wire the enabled status of this element to a Signal or Value.
    • bindEnabled

      public T bindEnabled(react.ValueView<Boolean> isEnabledV)
      Binds the enabledness of this element to the supplied value view. The current enabledness will be adjusted to match the state of isEnabled.
    • isVisible

      public boolean isVisible()
      Returns whether this element is visible.
    • setVisible

      public T setVisible(boolean visible)
      Configures whether this element is visible. An invisible element is not rendered and consumes no space in a group.
    • visibleSlot

      public react.Slot<Boolean> visibleSlot()
      Returns a slot which can be used to wire the visible status of this element to a Signal or Value.
    • bindVisible

      public T bindVisible(react.ValueView<Boolean> isVisibleV)
      Binds the visibility of this element to the supplied value view. The current visibility will be adjusted to match the state of isVisible.
    • isShowing

      public boolean isShowing()
      Returns true only if this element and all its parents' isVisible() return true.
    • constraint

      public Layout.Constraint constraint()
      Returns the layout constraint configured on this element, or null.
    • setConstraint

      public T setConstraint(Layout.Constraint constraint)
      Configures the layout constraint on this element. Note: if the element already has a constraint set, it will be replaced. Constraints cannot be automatically composed.
      Returns:
      this element for call chaining.
    • isAdded

      public boolean isAdded()
      Returns true if this element is part of an interface heirarchy.