Class ComponentsManager

java.lang.Object
io.fluentlenium.core.components.AbstractComponentInstantiator
io.fluentlenium.core.components.ComponentsManager
All Implemented Interfaces:
ComponentInstantiator, ComponentsAccessor, ProxyElementListener

Manage living components for a WebDriver instance.

A component is an Object implementing no particular interface, but capable of wrapping a WebElement.

FluentWebElement is the most common component.

  • Constructor Details

    • ComponentsManager

      public ComponentsManager (FluentControl control)
      Creates a new components manager.
      Parameters:
      control - control interface
  • Method Details

    • getInstantiator

      public ComponentInstantiator getInstantiator()
      Get the component instantiator used by this components manager.
      Returns:
      component instantiator
    • getComponents

      public Set<Object> getComponents (org.openqa.selenium.WebElement element)
      Description copied from interface: ComponentsAccessor
      Get the related components from the given element.
      Specified by:
      getComponents in interface ComponentsAccessor
      Parameters:
      element - selenium element
      Returns:
      components wrapping the given selenium element
    • isComponentClass

      public boolean isComponentClass (Class<?> componentClass)
      Description copied from interface: ComponentInstantiator
      Check if this class is a component class.
      Specified by:
      isComponentClass in interface ComponentInstantiator
      Parameters:
      componentClass - class to check
      Returns:
      true if this class is a component class, false otherwise
    • isComponentListClass

      public boolean isComponentListClass (Class<? extends List<?>> componentListClass)
      Description copied from interface: ComponentInstantiator
      Check if this class is a component list class.
      Specified by:
      isComponentListClass in interface ComponentInstantiator
      Parameters:
      componentListClass - class to check
      Returns:
      true if this class is a component list class, false otherwise
    • newComponent

      public <T> T newComponent (Class<T> componentClass, org.openqa.selenium.WebElement element)
      Description copied from interface: ComponentInstantiator
      Create and register a new component of the provided type from the given WebElement.
      Specified by:
      newComponent in interface ComponentInstantiator
      Type Parameters:
      T - type of the component
      Parameters:
      componentClass - type of the component
      element - wrapped element
      Returns:
      new instance of the component
    • addComponentsListener

      public boolean addComponentsListener (ComponentsListener listener)
      Description copied from interface: ComponentsAccessor
      Add a component listener to be notified when a component is registered or unregistered.
      Specified by:
      addComponentsListener in interface ComponentsAccessor
      Parameters:
      listener - components listener
      Returns:
      true if listener is added
    • removeComponentsListener

      public boolean removeComponentsListener (ComponentsListener listener)
      Description copied from interface: ComponentsAccessor
      Remove a component listener.
      Specified by:
      removeComponentsListener in interface ComponentsAccessor
      Parameters:
      listener - components listener to remove
      Returns:
      true if listener is removed
    • fireComponentRegistered

      protected void fireComponentRegistered (org.openqa.selenium.WebElement element, Object component)
      Fire component registered event.
      Parameters:
      element - underlying element
      component - registered component
    • fireComponentReleased

      protected void fireComponentReleased (org.openqa.selenium.WebElement element, Object component)
      Fire component released event.
      Parameters:
      element - underlying element
      component - released component
    • newComponentList

      public <L extends List<T>, T> L newComponentList (Class<L> listClass, Class<T> componentClass, List<T> componentsList)
      Description copied from interface: ComponentInstantiator
      Create and register a new list of component from the given component list.
      Specified by:
      newComponentList in interface ComponentInstantiator
      Type Parameters:
      L - type of the list
      T - type of the component
      Parameters:
      listClass - type of the list
      componentClass - type of the component
      componentsList - components list
      Returns:
      new list of components
    • asComponentList

      public <L extends List<T>, T> L asComponentList (Class<L> listClass, Class<T> componentClass, Iterable<org.openqa.selenium.WebElement> elementList)
      Description copied from interface: ComponentInstantiator
      Create and register a new list of component from the given element iterable.
      Specified by:
      asComponentList in interface ComponentInstantiator
      Overrides:
      asComponentList in class AbstractComponentInstantiator
      Type Parameters:
      L - type of the list
      T - type of the component
      Parameters:
      listClass - type of the list
      componentClass - type of the component
      elementList - elements
      Returns:
      new list of components
    • proxyElementSearch

      public void proxyElementSearch (Object proxy, org.openqa.selenium.support.pagefactory.ElementLocator locator)
      Description copied from interface: ProxyElementListener
      Invoked when proxy element search is starting.
      Specified by:
      proxyElementSearch in interface ProxyElementListener
      Parameters:
      proxy - proxy
      locator - element locator
    • proxyElementFound

      public void proxyElementFound (Object proxy, org.openqa.selenium.support.pagefactory.ElementLocator locator, List<org.openqa.selenium.WebElement> elements)
      Description copied from interface: ProxyElementListener
      Invoked when proxy element search is over and elements were found.
      Specified by:
      proxyElementFound in interface ProxyElementListener
      Parameters:
      proxy - proxy
      locator - element locator
      elements - found elements
    • release

      public void release()
      Release this manager.