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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addComponentsListener
(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 void
fireComponentRegistered
(org.openqa.selenium.WebElement element, Object component) Fire component registered event.protected void
fireComponentReleased
(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.boolean
isComponentClass
(Class<?> componentClass) Check if this class is a component class.boolean
isComponentListClass
(Class<? extends List<?>> componentListClass) Check if this class is a component list class.<T> T
newComponent
(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.void
proxyElementFound
(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.void
proxyElementSearch
(Object proxy, org.openqa.selenium.support.pagefactory.ElementLocator locator) Invoked when proxy element search is starting.void
release()
Release this manager.boolean
removeComponentsListener
(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, newFluentList
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:ComponentsAccessor
Get the related components from the given element.- Specified by:
getComponents
in interfaceComponentsAccessor
- Parameters:
element
- selenium element- Returns:
- components wrapping the given selenium element
-
isComponentClass
Description copied from interface:ComponentInstantiator
Check if this class is a component class.- Specified by:
isComponentClass
in interfaceComponentInstantiator
- Parameters:
componentClass
- class to check- Returns:
- true if this class is a component class, false otherwise
-
isComponentListClass
Description copied from interface:ComponentInstantiator
Check if this class is a component list class.- Specified by:
isComponentListClass
in interfaceComponentInstantiator
- Parameters:
componentListClass
- class to check- Returns:
- true if this class is a component list class, false otherwise
-
newComponent
Description copied from interface:ComponentInstantiator
Create and register a new component of the provided type from the givenWebElement
.- Specified by:
newComponent
in 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:ComponentsAccessor
Add a component listener to be notified when a component is registered or unregistered.- Specified by:
addComponentsListener
in interfaceComponentsAccessor
- Parameters:
listener
- components listener- Returns:
- true if listener is added
-
removeComponentsListener
Description copied from interface:ComponentsAccessor
Remove a component listener.- Specified by:
removeComponentsListener
in 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:ComponentInstantiator
Create and register a new list of component from the given component list.- Specified by:
newComponentList
in 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:ComponentInstantiator
Create and register a new list of component from the given element iterable.- Specified by:
asComponentList
in interfaceComponentInstantiator
- Overrides:
asComponentList
in 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:ProxyElementListener
Invoked when proxy element search is starting.- Specified by:
proxyElementSearch
in 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:ProxyElementListener
Invoked when proxy element search is over and elements were found.- Specified by:
proxyElementFound
in interfaceProxyElementListener
- Parameters:
proxy
- proxylocator
- element locatorelements
- found elements
-
release
public void release()Release this manager.
-