Class Element

java.lang.Object
dev.pfaff.altargui.improv.Element
Direct Known Subclasses:
AbstractMultiChildElement, AbstractSingleChildElement, RectElement, TextElement

public abstract class Element extends Object

Lifecycle

The element lifecycle follows this path:

  1. Create and attach to a Context
  2. Mount to a parent()
  3. Perform layout
  4. Unmount from the parent()
  5. Possibly go back to #2
  6. Dispose of the element
    NOTE: After this point the element can no longer be used, and internal state may be invalid.
  • Field Details

    • EMPTY_ARRAY

      public static final Element[] EMPTY_ARRAY
    • STACK_WALKER

      public static final StackWalker STACK_WALKER
  • Constructor Details

    • Element

      protected Element(Context context)
  • Method Details

    • context

      @NotNull public final @NotNull Context context()
      The UI context the element exists in.
    • parent

      @Nullable public final @Nullable Element parent()
      The element's current parent element, if any.
    • allocation

      @NotNull public final @NotNull VarRect allocation()
      Returns:
      the element's allocation rect. This return value is final.
    • ensureMounted

      public final void ensureMounted()
    • onMount

      @MustBeInvokedByOverriders public void onMount(@Nullable @Nullable Element parent)
      Do not call this directly, unless you are the Context implementation.
    • onUnmount

      @MustBeInvokedByOverriders public void onUnmount()
      Do not call this directly, unless you are the Context implementation.
    • onDispose

      @MustBeInvokedByOverriders public void onDispose()
      Do not call this directly, unless you are the Context implementation.
    • setAvailable

      @Deprecated public final void setAvailable(@NotNull @NotNull ExprRect available)
      Deprecated.
    • onSetAvailable

      @MustBeInvokedByOverriders protected void onSetAvailable()
      Override this to invalidate parts of your layout when the "available" variables change. Note that any changes in this method should be queued, not executed immediately.
    • queueLayout

      public final void queueLayout(LayoutMutation mutation)
    • mutateLayoutImmediately

      public final void mutateLayoutImmediately(LayoutMutation mutation) throws LayoutException
      Throws:
      LayoutException
    • equals

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

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