event bus - How to unregister GWT eventbus handlers in a Popup/DialogBox? -
i have dialog box, contains button , tablayoutpanel. button outside tablayoutpanel. tab contents separate custom widgets.
the problem: want respond clicks on button performing action inside 1 of tab content widgets.
i tried using gwt eventbus way:
- fire event upon button click
- add handler event inside tab
but here's problem: if close/open tab multiple times, event handler registered again. , when button clicked, event handler start multiple times (for every handler registration/however many times tab opened).
since dialog box doesn't have activity/place, cannot use gwt's activity.start(... eventbus eventbus)
automatic activity deregistration.
a possible solution manually remember registered handlerregistration
(s) , .removehandler()
them when navigate away tab. rather ugly solution.
question: there way unregister events in dialog box without remembering them?
it's hard give concrete answer without code, i'd this:
- add clickhandler button when popup/dialog gets opened.
- if button clicked, check tab active 1 , call specific method on widget in tab.
getselectedindex()
,getwidget(index)
should methods on tablayoutpanel use determine widget active one. - unregister clickhandler after popup/dialog got closed.
this way, have 1 handler remove should normal way, e.g. onclose()
event of dialogbox.
Comments
Post a Comment