行为和忙碌指标

时间:2012-04-18 14:51:36

标签: java wicket

我的Java代码中有这样的东西:

//...omitted some not revelant code
AjaxIndicatorAppender indicator = new AjaxIndicatorAppender();
final RequiredTextField<String> nickField = new RequiredTextField<String>( "nick", new PropertyModel<String>( this, "nickValue" ) );
formContainer.add( nickField );
indicator.bind(nickField);
nickField.add( new MyValidatingBehaviour( (Form) formContainer, "onkeyup", Duration.ONE_SECOND, indicator ) );

//...

private class MyValidatingBehaviour extends AjaxFormValidatingBehavior implements IAjaxIndicatorAware
{
    AjaxIndicatorAppender indicator;

    private MyValidatingBehaviour( Form<?> form, String event, final Duration throttleDelay, AjaxIndicatorAppender indicator )
    {
        super( form, event );
        this.setThrottleDelay( throttleDelay );
        this.indicator = indicator;
    }

    @Override
    public String getAjaxIndicatorMarkupId()
    {
        return indicator.getMarkupId();
    }
}

但没有任何反应,没有任何指标,我做错了什么?无法为我的案例找到任何例子

1 个答案:

答案 0 :(得分:0)

而不是

indicator.bind(nickField);

应该是

nickField.add(indicator);

它有效:)