Tnx. But I am verry happy with my new beanz design ;)

**
Martin

2009/5/11 Krzysztof Jelski <kjel...@gmail.com>:
> Hi Martin!
>
> I also found using paths to identify components really cumbersome in
> test-driving wicket. I took a look at jdave-wicket and really liked its
> approach. However, I didn't want to use jdave libs with my current project.
> Inspired with this lib, I wrote this little snippet of code, which i find
> really helpful:
>
>  @SuppressWarnings("unchecked")
>  public static <T extends WebMarkupContainer> T findComponent(WicketTester
> tester, Class<T> componentClass,
>      final String id) {
>    return (T) tester.getLastRenderedPage().visitChildren(componentClass,
> new IVisitor<T>() {
>
>      @Override
>      public Object component(T component) {
>        if (component.getId().equals(id)) {
>          return component;
>        }
>        return CONTINUE_TRAVERSAL;
>      }
>    });
>  }
>
> I also created similar method without the id parameter - useful when you
> have only one component of a class on the tested page. Only difference in
> the method body is that there's just a single "return component" statement,
> no if.
>
> Hope it helps.
>
> Chris
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to