Class RelationsKt

  • All Implemented Interfaces:

    
    public final class RelationsKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static <S extends Component> S prioritize(S $self) Prioritize this component, meaning it will, in relation to its siblings:
      • be drawn last (so visually on top)

      • receive events first

      this method is experimental as it may interfere with statically-typed references to children.
      final static <S extends Component> S relegate(S $self) Relegate this component, meaning it will, in relation to its siblings:
      • be drawn first (so visually on the bottom)

      • receive events last

      this method is experimental as it may interfere with statically-typed references to children.
      final static <T extends Component> T childOf(T $self, Component parent) Register this component to be a child of parent.
      final static <S extends Component> S locate(Component $self, String id) Locate a component by its name.
      final static Boolean isChildOf(Component $self, Component component) Returns true if this component is a child of the specified component.
      final static Boolean isRelatedTo(Component $self, Component component) Returns true if this component is a child of the specified component, or if the component is a child of this.
      final static Integer countChildren(Component $self) Returns a count of this component's children, including children of children.
      final static Boolean hasChildIn(Component $self, Float x, Float y, Float width, Float height)
      final static TextInput getTextFromBoxedTextInput(Component $self) Return the actual TextInput from a org.polyfrost.polyui.component.impl.BoxedTextInput component.
      final static TextInput getNumericTextInput(Component $self) Return the actual TextInput from a org.polyfrost.polyui.component.impl.BoxedNumericInput component.
      final static <T extends Component> Unit onAll(Component $self, Class<T> cls, Function1<T, Unit> action) Perform a function on all matching components (itself and its children) of the given class.
      final static <T extends Component> Unit onAll(Component $self, Function1<T, Unit> action) Perform a function on all matching components (itself and its children) of the given type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • prioritize

        @ApiStatus.Experimental() final static <S extends Component> S prioritize(S $self)

        Prioritize this component, meaning it will, in relation to its siblings:

        • be drawn last (so visually on top)

        • receive events first

        this method is experimental as it may interfere with statically-typed references to children.

        Since:

        1.0.0

      • relegate

        @ApiStatus.Experimental() final static <S extends Component> S relegate(S $self)

        Relegate this component, meaning it will, in relation to its siblings:

        • be drawn first (so visually on the bottom)

        • receive events last

        this method is experimental as it may interfere with statically-typed references to children.

        Since:

        1.1.71

      • childOf

         final static <T extends Component> T childOf(T $self, Component parent)

        Register this component to be a child of parent.

        This allows for an Elementa-style syntax to be used for creating UIs.

        Since:

        1.7.27

      • locate

         final static <S extends Component> S locate(Component $self, String id)

        Locate a component by its name.

        This method is recursive, meaning it will search through all children of this component.

        Parameters:
        id - the name of the drawable to locate.
        Returns:

        the drawable with the given name, or null if it was not found.

        Since:

        1.1.72

      • isRelatedTo

         final static Boolean isRelatedTo(Component $self, Component component)

        Returns true if this component is a child of the specified component, or if the component is a child of this.

        Since:

        1.4.2

      • countChildren

         final static Integer countChildren(Component $self)

        Returns a count of this component's children, including children of children.

        Since:

        1.0.1

      • getTextFromBoxedTextInput

         final static TextInput getTextFromBoxedTextInput(Component $self)

        Return the actual TextInput from a org.polyfrost.polyui.component.impl.BoxedTextInput component.

        Will fail if the component is not the correct type, so make sure to check before you run this method.

        Since:

        1.8.2

      • getNumericTextInput

         final static TextInput getNumericTextInput(Component $self)

        Return the actual TextInput from a org.polyfrost.polyui.component.impl.BoxedNumericInput component.

        Will fail if the component is not the correct type, so make sure to check before you run this method.

        Since:

        1.8.2

      • onAll

         final static <T extends Component> Unit onAll(Component $self, Class<T> cls, Function1<T, Unit> action)

        Perform a function on all matching components (itself and its children) of the given class.

        Since:

        1.8.3

      • onAll

         final static <T extends Component> Unit onAll(Component $self, Function1<T, Unit> action)

        Perform a function on all matching components (itself and its children) of the given type.

        Since:

        1.8.3