[arquillian-issues] [JBoss JIRA] (ARQGRA-199) Provide a way to create Page Fragments dynamically
Lukáš Fryč (JIRA)
jira-events at lists.jboss.org
Mon Nov 5 09:08:18 EST 2012
[ https://issues.jboss.org/browse/ARQGRA-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12731272#comment-12731272 ]
Lukáš Fryč edited comment on ARQGRA-199 at 11/5/12 9:08 AM:
------------------------------------------------------------
{code:java}
public class Page {
// use ClassImposterizer.imposterise(MethodInterceptor);
@FindBy(...)
MyTabPanel tabPanel;
// user API
class MyTabPanel extends ContainerWrapperFor2<WebElement, TabPanel<Calendar>> {
@Dynamic // Tabs extends ContainerForAny
Tabs tabs;
public ContainerFor2<WebElement, TabPanel<Calendar>> tabs() {
return tabs;
}
}
@FindBy("")
class Tabs extends ContainerForAny {
WebElement getNth(WebElement root, int n);
}
class ContainerWrapperFor15<T1, T2, T3, ...> extends ContainerWrapperFor14<T1, T2, T3, ..., T15> {
}
class ContainerForAny<...> extends ContainerWrapperFor12<...> {
...
}
ContainerFor2<WebElement, TabPanel<Calendar>> tabs = tabPanel.tabs();
WebElement element = tabPanel.tabs().get(1);
WebElement element = tabPanel.tabs().first();
TabPanel<Calendar> innerTabPanel = tabPanel.tabs().second();
UserDetails details = tabPanel.tabs().get(UserDetails.class);
accordion.items().second();
// proxy of ContainerFor2 interface will be passed to TabPanelImpl
// and returned by TabPanel#tabs()
interface ContainerFor15<T1, T2> {
(X) X get(int i);
// returns first occurence of given type of container
X get(Class<X> class);
// proxy delegates to this.get(1)
@Order(1)
T1 first();
T1 get1();
// proxy delegates to this.get(2)
@Order(2)
T2 second();
...
@Order
T12 get12();
}
}
{code}
was (Author: lfryc):
{code:java}
public class Page {
// use ClassImposterizer.imposterise(MethodInterceptor);
@FindBy(...)
MyTabPanel tabPanel;
// user API
class MyTabPanel extends ContainerWrapperFor15<WebElement, TabPanel<Calendar>> {
@Dynamic
ContainerForAny container;
public ContainerFor15<WebElement, TabPanel<Calendar>> tabs() {
return container;
}
}
class TabPanel extends TabPanel15 {
}
class ContainerWrapperFor15<T1, T2, T3, ...> extends ContainerWrapperFor14<T1, T2, T3, ..., T15> {
}
class ContainerForAny<...> extends ContainerWrapperFor12<...> {
...
}
ContainerFor2<WebElement, TabPanel<Calendar>> tabs = tabPanel.tabs();
WebElement element = tabPanel.tabs().get(1);
WebElement element = tabPanel.tabs().first();
TabPanel<Calendar> innerTabPanel = tabPanel.tabs().second();
UserDetails details = tabPanel.tabs().get(UserDetails.class);
accordion.items().second();
// proxy of ContainerFor2 interface will be passed to TabPanelImpl
// and returned by TabPanel#tabs()
interface ContainerFor12<T1, T2> {
(X) X get(int i);
// returns first occurence of given type of container
X get(Class<X> class);
// proxy delegates to this.get(1)
@Order(1)
T1 first();
T1 get1();
// proxy delegates to this.get(2)
@Order(2)
T2 second();
...
@Order
T12 get12();
}
}
{code}
> Provide a way to create Page Fragments dynamically
> --------------------------------------------------
>
> Key: ARQGRA-199
> URL: https://issues.jboss.org/browse/ARQGRA-199
> Project: Arquillian Graphene
> Issue Type: Enhancement
> Components: api, unit-test
> Affects Versions: 2.0.0.Alpha2
> Reporter: Juraj Húska
> Assignee: Juraj Húska
> Fix For: 2.0.0.Alpha3
>
>
> The only way now to declare and initialize Page Fragment is to annotate the implementation class of that Page Fragment by {{@FindBy}} (or use static factory method).
> It will nice and vital addition to have way how to declare and create Page Fragments dynamically.
> It will be for example useful in the use case described in the [comment|https://issues.jboss.org/browse/ARQGRA-199?focusedCommentId=12731165&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12731165] below.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the arquillian-issues
mailing list