Class CompositeAccessor<T extends org.eclipse.swt.widgets.Composite>

  • Type Parameters:
    T - the actual object type to access.
    All Implemented Interfaces:
    java.util.function.Supplier<T>
    Direct Known Subclasses:
    DecorationsAccessor

    public class CompositeAccessor<T extends org.eclipse.swt.widgets.Composite>
    extends ControlAccessor<T>
    Accessor class for Composite objects.
    • Constructor Detail

      • CompositeAccessor

        public CompositeAccessor​(@Nullable T composite)
        Constructs a new CompositeAccessor instance.
        Parameters:
        composite - the Composite instance to access.
      • CompositeAccessor

        public CompositeAccessor​(java.util.Optional<T> compositeHolder)
        Constructs a new CompositeAccessor instance.
        Parameters:
        compositeHolder - the optional Composite instance to access.
      • CompositeAccessor

        public CompositeAccessor​(Accessor<T> accessor)
        Constructs a new CompositeAccessor instance.
        Parameters:
        accessor - the accessor to the Composite instance to access.
    • Method Detail

      • children

        public java.util.stream.Stream<org.eclipse.swt.widgets.Control> children()
        Gets all child Controls of this Composite.

        Calling this function is equivalent to calling children(Integer.MAX_VALUE, true).

        Returns:
        all child Controls of this Composite.
      • accessChild

        public <C extends org.eclipse.swt.widgets.Control,​A extends Accessor<C>> @NonNull A accessChild​(WrapFunction<C,​A> wrap,
                                                                                                              java.lang.Class<C> childClass,
                                                                                                              java.util.function.Predicate<C> predicate)
        Convenience function which gets a specific child Control.

        A test failure is signaled if either none or more than one matching Control exists.

        Type Parameters:
        C - the actual control type to access.
        A - the actual control accessor type.
        Parameters:
        wrap - the function to use to wrap the found control.
        childClass - the type of requested control.
        predicate - the match criteria to use.
        Returns:
        the found Control.
      • accessChild

        public <C extends org.eclipse.swt.widgets.Control,​A extends Accessor<?>> A accessChild​(WrapFunction<C,​A> wrap,
                                                                                                     java.lang.Class<C> childClass,
                                                                                                     int childIndex)
        Convenience function which gets a specific child Control.

        A test failure is signaled if the requested Control does not exist.

        Type Parameters:
        C - the actual control type to access.
        A - the actual control accessor type.
        Parameters:
        wrap - the function to use to wrap the found control.
        childClass - the type of requested control.
        childIndex - the child index to access.
        Returns:
        the found Control.
      • accessButton

        public ButtonAccessor accessButton​(java.util.function.Predicate<org.eclipse.swt.widgets.Button> predicate)
        Convenience function which gets a specific Button.

        A test failure is signaled if either none or more than one matching Button exists.

        Parameters:
        predicate - the match criteria to use.
        Returns:
        the found Button.
      • accessButton

        public ButtonAccessor accessButton​(java.lang.String text)
        Convenience function which gets a specific Button.

        A test failure is signaled if either none or more than one matching Button exists.

        Parameters:
        text - the button text to match.
        Returns:
        the found Button.
      • accessButton

        public ButtonAccessor accessButton​(int childIndex)
        Convenience function which gets a specific Button.

        A test failure is signaled if either none or more than one matching Button exists.

        Parameters:
        childIndex - the child index to access.
        Returns:
        the found Button.