Class WidgetInstance<W extends Widget>

java.lang.Object
dev.pfaff.altargui.WidgetInstance<W>
Direct Known Subclasses:
CustomLayoutSingleChildWidgetInstance

public abstract non-sealed class WidgetInstance<W extends Widget> extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • configure

      public abstract void configure(StateContext stateContext, W widget, boolean init)
      Configures the instance's state according to the inputs in the specified widget.

      Other initialization might be done if init is true.

    • onMount

      public void onMount()
      Called when the element is mounted to a new parent.
    • onUnmount

      @MustBeInvokedByOverriders public void onUnmount()
      Called when the element is unmounted from the current parent.
    • dispose

      @MustBeInvokedByOverriders public void dispose()
      Disposes of the element... currently the element may be reused, but this will likely change in the future.
    • stencilLayout

      public final void stencilLayout(StencilLayoutContext context)
      Sets positions of element content and children.

      This will usually call StencilLayoutContext.layout(WidgetInstance, WidgetInstance, BiConsumer) with each child and go through a layout procedure wherein setAvailableSize(float, float) and then stencilLayout(StencilLayoutContext) are called (in that order) on each child.

    • traceLayout

      public final void traceLayout()
      mounts children and computes actual size and position from the allocated rect

      This will usually call StencilLayoutContext.layout(WidgetInstance, WidgetInstance, BiConsumer) with each child and go through a layout procedure wherein setAvailableSize(float, float) and then traceLayout() are called (in that order) on each child.

    • mount

      public final void mount(MountContext context)
    • uSpecMount

      public void uSpecMount(MountContext context)
    • computeFillLayout

      protected static void computeFillLayout(WidgetInstance element, StencilLayoutContext context)
    • computeStencilLayout

      protected abstract void computeStencilLayout(StencilLayoutContext context)
    • computeTraceLayout

      protected abstract void computeTraceLayout()
    • computeMount

      protected abstract void computeMount(MountContext context)
    • markNeedsStencilLayout

      protected final void markNeedsStencilLayout()
    • markNeedsTraceLayout

      protected final void markNeedsTraceLayout()
    • markNeedsLayout

      @Deprecated protected final void markNeedsLayout()
      Deprecated.
      use markNeedsStencilLayout() and/or markNeedsTraceLayout() as appropriate instead.
    • propagateNeedsStencilLayoutFromChild

      protected void propagateNeedsStencilLayoutFromChild()
      This will need to be overridden for any aligned positioning to include markNeedsTraceLayout().
    • takeNeedsStencilLayout

      protected final boolean takeNeedsStencilLayout()
    • takeNeedsTraceLayout

      protected final boolean takeNeedsTraceLayout()
    • allocatedX

      public final float allocatedX()
    • allocatedY

      public final float allocatedY()
    • allocatedWidth

      public final float allocatedWidth()
    • allocatedHeight

      public final float allocatedHeight()
    • markNeedsStencilLayoutOnAllocationChange

      protected final void markNeedsStencilLayoutOnAllocationChange()
    • markNeedsTraceLayoutOnAllocationChange

      protected final void markNeedsTraceLayoutOnAllocationChange()
    • setPosition

      public final void setPosition(float x, float y)
      Called by the parent element to set the position of its children.
    • setAvailableSize

      public final void setAvailableSize(float width, float height)
      Called by the parent element to communicate the amount of space available to its children.
    • copyPositionFrom

      public final void copyPositionFrom(WidgetInstance other)
      Copies the position from the given other widget (usually the parent).
    • copyAvailableSizeFrom

      public final void copyAvailableSizeFrom(WidgetInstance other)
      Copies the available size from the given other widget (usually the parent).
    • requireFiniteAllocatedWidth

      protected final void requireFiniteAllocatedWidth()
    • requireFiniteAllocatedHeight

      protected final void requireFiniteAllocatedHeight()
    • computedWidth

      public final float computedWidth()
    • computedHeight

      public final float computedHeight()
    • setComputedSize

      protected final void setComputedSize(float width, float height)
    • copyComputedSizeFrom

      protected final void copyComputedSizeFrom(WidgetInstance other)
    • fillAllocated

      protected final void fillAllocated()
      Sets the computed size to fill the entire allocated rect.
    • isInside

      public final boolean isInside(double checkX, double checkY)
    • applyBuiltinSelector

      public void applyBuiltinSelector(BuiltinSelector selector, Consumer<WidgetInstance> consumer)
    • toStringShort

      public final String toStringShort()
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • guiContext

      public final GuiContext guiContext()
    • key

      public final long key()
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object