On Thu, 29 May 2008, Daniele Dellafiore wrote:
> umm, but in example above, what column and row number are grabbed?
> 
> there is a way to show the complete graph of a wicket page hierarchy?

Yes there is, WicketTester.debugComponentTrees() and I 
think some other way as well.

However, to get to your checkboxes inside the repeater, I 
recommend using a visitor

    wicketTester.getLastRenderedPage().visitChildren(CheckBox.class, new
    IVisitor() {
        ...
    });

instead of relying on the component path, which is very
fragile. (Direct component path changes when the component
hierarchy changes, for example if you need to make some div
of the hierarchy a Wicket component. Repeaters might have
different number of items, the sorting may change etc.)

jdave-wicket has the visitor stuff built-in, and you can
also select the component based on its model object

CheckBox windShieldSelection = 
selectFirst(CheckBox.class).which(is(windShield)).from(context);
wicketTester.executeAjaxEvent(windShieldSelection, "onclick");

or 

List<CheckBox> allCheckBoxes = selectAll(CheckBox.class).from(context);

Also note that repeaters create their child items recently in 
onBeforeRender. WicketTester calls beforeRender() in 
startComponent to achieve this, but if your component changes 
state during the test so that the children should be re-created,
you must call beforeRender explicitly on your repeater.

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to