Preventing selection event propagation

484 views
Skip to first unread message

ALB-PSP-DV1

unread,
Apr 27, 2012, 7:45:19 AM4/27/12
to Google Web Toolkit, cb...@indiatimes.com
Our application has two tabs. On selecting the tabs we have to display
a confirmation window(dialog box). Depending on whether user clicks
"Yes" or "No" button in the confirmation window, the tab selection
event should proceed or stop.

I know we have event.stopPropagation() method for click event. However
there is no such method for selection event.

Is there any work around to stop the propagation of the selection
event. Any help is much appreciated.

Thanks in advance.

Ashwin Desikan

unread,
Apr 27, 2012, 8:43:28 AM4/27/12
to google-we...@googlegroups.com
Do u use activities in your app? If yes do you have an activity mapped to each of your tabs? You have a mayStop method in activities which can be used to stop the user from navigating from current activity.

~Ashwin

Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>

Jens

unread,
Apr 27, 2012, 9:02:24 AM4/27/12
to google-we...@googlegroups.com, cb...@indiatimes.com
Tab(Layout)Panel's SelectionEvent is a GwtEvent and not a DomEvent, so its only a logical event fired by GWT and not a native event fired by the browser. Thats why you don't have a stopPropagation() / preventDefault() method.

But TabPanel and TabLayoutPanel have an addBeforeSelectionHandler() and the BeforeSelectionEvent contains a cancel() method which should cancel the upcoming selection. This should help you to solve your problem.

-- J.

ALB-PSP-DV1

unread,
Apr 29, 2012, 4:51:58 AM4/29/12
to Google Web Toolkit
Thank you for your suggestions. I tried the solution suggested by
Jens.

I have a confirmation window to be first displayed on tab selection,
and only on click of "No" button in the confirmation window the tab
selection should be cancelled.
Currently both BeforeSelectionEvent and SelectionEvent are invoked
since I can perform event cancel() on "No" button.
Message has been deleted
Message has been deleted

ALB-PSP-DV1

unread,
Apr 29, 2012, 6:51:23 AM4/29/12
to Google Web Toolkit
I have done a workaround in the BeforeSelectionEvent . I'm cancelling
the event at the start of the onBeforeSelection() and then reselecting
the same tab if
the user clicks "Yes" button in the confirmation window.

With this workaround everything seems to be working as expected.

Thanks Ashwin and Jens.


On Apr 29, 1:51 pm, ALB-PSP-DV1 <albpsp...@gmail.com> wrote:
> Thank you for your suggestions. I tried the solution suggested by
> Jens.
>
> I have a confirmation window to be first displayed on tabselection,
> and only on click of "No" button in the confirmation window the tabselectionshould be cancelled.
> Currently both BeforeSelectionEvent  and SelectionEvent are invoked
> since I can performeventcancel() on "No" button.
>
> On Apr 27, 6:02 pm, Jens <jens.nehlme...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Tab(Layout)Panel's SelectionEvent is a GwtEvent and not a DomEvent, so its
> > only a logicaleventfired by GWT and not a nativeeventfired by the
> > browser. Thats why you don't have a stopPropagation() / preventDefault()
> > method.
>
> > But TabPanel and TabLayoutPanel have an addBeforeSelectionHandler() and the
> > BeforeSelectionEvent contains a cancel() method which should cancel the
> > upcomingselection. This should help you to solve your problem.
>
> > -- J.
>
> > Am Freitag, 27. April 2012 13:45:19 UTC+2 schrieb ALB-PSP-DV1:
>
> > > Our application has two tabs. On selecting the tabs we have to display
> > > a confirmation window(dialog box). Depending on whether user clicks
> > > "Yes" or "No" button in the confirmation window, the tabselection
> > >eventshould proceed or stop.
>
> > > I know we haveevent.stopPropagation() method for clickevent. However
Reply all
Reply to author
Forward
0 new messages