gwt - How meaningfull is Activity.mayStop()? -
i wondering if there non trivial use case com.google.gwt.activity.shared.activity#maystop
method.
- the
com.google.gwt.place.shared.placecontroller.delegate#confirm
blocking one, cannot use differentdelegate
, using callbacks. not know why implemented in blocking manner because gwt guys user interactions should handled asynchronously. - the
maystop
method called. ifactivitymanager
return sameactivity
, ui not change. activity has check instance if user has unsaved changes , if place change whould result in discarding unsaved data. think check done more before callingplacecontroller.goto(new place())
.
what think?
see http://code.google.com/p/google-web-toolkit/issues/detail?id=6228#c1 tl;dr: asynchronous handling opens door many edge cases, bugs, confusion, , differing needs/wishes how should work.
the activity
goto
not 1 needs checks inmaystop
. in case is, if check before doinggoto
(and transit statemaystop
returnnull
), in case there activity unsaved changes, result in 2 confirmations being asked user.
it's possible listenplacechangerequestevent
s , conditionally callsetwarning
, instead of doing check inmaystop
. way have access place you're navigating to; couples activity places , mapping activities (e.g. list activity might displayed on details place on desktop, not on mobile); that's responsibility ofactivitymapper
s.
also, don't forget navigation can triggered browser (user navigating in browser's history). thing is: on web, user in control.
in all, it's better (and simpler)goto
s , rely onmaystop
ask confirmation. (the activity disable buttons/links triggeringgoto
in case there unsaved changes, navigation triggered other activities).
Comments
Post a Comment