Package tripleplay.ui
Class Element<T extends Element<T>>
java.lang.Object
tripleplay.ui.Element<T>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Ways in which a preferred and an original dimension can be "taken" to produce a result. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddStyles
(Style.Binding<?>... styles) Adds the supplied styles to this element (in the DEFAULT mode).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 aSignal
orValue
.react.SignalView<Boolean>
Returns a signal that will dispatch when this element is added or removed from the hierarchy.boolean
isAdded()
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.Container<?>
parent()
Returns the parent of this element, or null.setConstraint
(Layout.Constraint constraint) 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).Configures the styles for this element.setVisible
(boolean visible) Configures whether this element is visible.pythagoras.f.IDimension
size()
Returns the width and height of this element's bounds.styles()
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 aSignal
orValue
.float
x()
Returns this element's x offset relative to its parent.float
y()
Returns this element's y offset relative to its parent.
-
Field Details
-
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
Returns the parent of this element, or null. -
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
Returns the styles configured on this element. -
setStyles
Configures the styles for this element. Any previously configured styles are overwritten.- Returns:
- this element for convenient call chaining.
-
setStyles
Configures styles for this element (in the DEFAULT mode). Any previously configured styles are overwritten.- Returns:
- this element for convenient call chaining.
-
addStyles
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
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
Enables or disables this element. Disabled elements are not interactive and are usually rendered so as to communicate this state to the user. -
enabledSlot
Returns a slot which can be used to wire the enabled status of this element to aSignal
orValue
. -
bindEnabled
Binds the enabledness of this element to the supplied value view. The current enabledness will be adjusted to match the state ofisEnabled
. -
isVisible
public boolean isVisible()Returns whether this element is visible. -
setVisible
Configures whether this element is visible. An invisible element is not rendered and consumes no space in a group. -
visibleSlot
Returns a slot which can be used to wire the visible status of this element to aSignal
orValue
. -
bindVisible
Binds the visibility of this element to the supplied value view. The current visibility will be adjusted to match the state ofisVisible
. -
isShowing
public boolean isShowing()Returns true only if this element and all its parents'isVisible()
return true. -
constraint
Returns the layout constraint configured on this element, or null. -
setConstraint
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.
-