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:

  1. fire event upon button click
  2. 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:

  1. add clickhandler button when popup/dialog gets opened.
  2. 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.
  3. unregister clickhandler after popup/dialog got closed.

this way, have 1 handler remove should normal way, e.g. onclose() event of dialogbox.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -