开发者

GWT handle events of UIBinder

i built an UIBinder that has selectBox and table. the t开发者_JS百科able is filled with data from db. when i change the selection of the selectBox i should go and run a query to get the new data. i use the Widget in a screen view, and start it at the presenter. at the UIBinder i fired event when my selectBox is changed, but i can't catch it on the presenter. how i can do that successfully. my event at the widget:

@Override
public void onChange(ChangeEvent event)
{
    KPIOptionChangedEvent e = new KPIOptionChangedEvent();
    fireEvent(e);
}

catching the event at the presenter:

eventBus.addHandler(KPIEvents.KPIOptionChangedEvent.TYPE,
    new KPIHandlers.KPIOptionChangedHandler()
    {
        @Override
        public void execute(KPIOptionChangedEvent event)
        {
            Window.alert(event.getKPI().getName());
        }
    });

thanks


fireEvent(e) is defined on Widget and is used to fire events on a widget instance.

If you want to send an event through EventBus then call:

eventBus.fire(e);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜