Package io.fluentlenium.core.components
Class ComponentsManager
java.lang.Object
io.fluentlenium.core.components.AbstractComponentInstantiator
io.fluentlenium.core.components.ComponentsManager
- All Implemented Interfaces:
ComponentInstantiator,ComponentsAccessor,ProxyElementListener
public class ComponentsManager
extends AbstractComponentInstantiator
implements 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddComponentsListener(ComponentsListener listener) Add a component listener to be notified when a component is registered or unregistered.<L extends List<T>,T>
LasComponentList(Class<L> listClass, Class<T> componentClass, Iterable<org.openqa.selenium.WebElement> elementList) Create and register a new list of component from the given element iterable.protected voidfireComponentRegistered(org.openqa.selenium.WebElement element, Object component) Fire component registered event.protected voidfireComponentReleased(org.openqa.selenium.WebElement element, Object component) Fire component released event.getComponents(org.openqa.selenium.WebElement element) Get the related components from the given element.Get the component instantiator used by this components manager.booleanisComponentClass(Class<?> componentClass) Check if this class is a component class.booleanisComponentListClass(Class<? extends List<?>> componentListClass) Check if this class is a component list class.<T> TnewComponent(Class<T> componentClass, org.openqa.selenium.WebElement element) Create and register a new component of the provided type from the givenWebElement.<L extends List<T>,T>
LnewComponentList(Class<L> listClass, Class<T> componentClass, List<T> componentsList) Create and register a new list of component from the given component list.voidproxyElementFound(Object proxy, org.openqa.selenium.support.pagefactory.ElementLocator locator, List<org.openqa.selenium.WebElement> elements) Invoked when proxy element search is over and elements were found.voidproxyElementSearch(Object proxy, org.openqa.selenium.support.pagefactory.ElementLocator locator) Invoked when proxy element search is starting.voidrelease()Release this manager.booleanremoveComponentsListener(ComponentsListener listener) Remove a component listener.Methods inherited from class io.fluentlenium.core.components.AbstractComponentInstantiator
asComponentList, asComponentList, asComponentList, asComponentList, asComponentList, asFluentList, asFluentList, asFluentList, asFluentList, asFluentList, asFluentList, newComponentList, newComponentList, newComponentList, newComponentList, newComponentList, newFluent, newFluentList, newFluentList, newFluentList, newFluentList, newFluentList, newFluentListMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.fluentlenium.core.components.ComponentInstantiator
asComponentList, asComponentList, asComponentList, asComponentList, asComponentList, asFluentList, asFluentList, asFluentList, asFluentList, asFluentList, asFluentList, newComponentList, newComponentList, newComponentList, newComponentList, newComponentList, newFluent, newFluentList, newFluentList, newFluentList, newFluentList, newFluentList, newFluentList
-
Constructor Details
-
ComponentsManager
Creates a new components manager.- Parameters:
control- control interface
-
-
Method Details
-
getInstantiator
Get the component instantiator used by this components manager.- Returns:
- component instantiator
-
getComponents
Description copied from interface:ComponentsAccessorGet the related components from the given element.- Specified by:
getComponentsin interfaceComponentsAccessor- Parameters:
element- selenium element- Returns:
- components wrapping the given selenium element
-
isComponentClass
Description copied from interface:ComponentInstantiatorCheck if this class is a component class.- Specified by:
isComponentClassin interfaceComponentInstantiator- Parameters:
componentClass- class to check- Returns:
- true if this class is a component class, false otherwise
-
isComponentListClass
Description copied from interface:ComponentInstantiatorCheck if this class is a component list class.- Specified by:
isComponentListClassin interfaceComponentInstantiator- Parameters:
componentListClass- class to check- Returns:
- true if this class is a component list class, false otherwise
-
newComponent
Description copied from interface:ComponentInstantiatorCreate and register a new component of the provided type from the givenWebElement.- Specified by:
newComponentin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- type of the componentelement- wrapped element- Returns:
- new instance of the component
-
addComponentsListener
Description copied from interface:ComponentsAccessorAdd a component listener to be notified when a component is registered or unregistered.- Specified by:
addComponentsListenerin interfaceComponentsAccessor- Parameters:
listener- components listener- Returns:
- true if listener is added
-
removeComponentsListener
Description copied from interface:ComponentsAccessorRemove a component listener.- Specified by:
removeComponentsListenerin interfaceComponentsAccessor- Parameters:
listener- components listener to remove- Returns:
- true if listener is removed
-
fireComponentRegistered
Fire component registered event.- Parameters:
element- underlying elementcomponent- registered component
-
fireComponentReleased
Fire component released event.- Parameters:
element- underlying elementcomponent- released component
-
newComponentList
public <L extends List<T>,T> L newComponentList(Class<L> listClass, Class<T> componentClass, List<T> componentsList) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given component list.- Specified by:
newComponentListin interfaceComponentInstantiator- Type Parameters:
L- type of the listT- type of the component- Parameters:
listClass- type of the listcomponentClass- type of the componentcomponentsList- 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:ComponentInstantiatorCreate and register a new list of component from the given element iterable.- Specified by:
asComponentListin interfaceComponentInstantiator- Overrides:
asComponentListin classAbstractComponentInstantiator- Type Parameters:
L- type of the listT- type of the component- Parameters:
listClass- type of the listcomponentClass- type of the componentelementList- elements- Returns:
- new list of components
-
proxyElementSearch
public void proxyElementSearch(Object proxy, org.openqa.selenium.support.pagefactory.ElementLocator locator) Description copied from interface:ProxyElementListenerInvoked when proxy element search is starting.- Specified by:
proxyElementSearchin interfaceProxyElementListener- Parameters:
proxy- proxylocator- 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:ProxyElementListenerInvoked when proxy element search is over and elements were found.- Specified by:
proxyElementFoundin interfaceProxyElementListener- Parameters:
proxy- proxylocator- element locatorelements- found elements
-
release
public void release()Release this manager.
-