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#confirmblocking one, cannot use differentdelegate, using callbacks. not know why implemented in blocking manner because gwt guys user interactions should handled asynchronously. - the
maystopmethod called. ifactivitymanagerreturn 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
gotonot 1 needs checks inmaystop. in case is, if check before doinggoto(and transit statemaystopreturnnull), in case there activity unsaved changes, result in 2 confirmations being asked user.
it's possible listenplacechangerequestevents , 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 ofactivitymappers.
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)gotos , rely onmaystopask confirmation. (the activity disable buttons/links triggeringgotoin case there unsaved changes, navigation triggered other activities).
Comments
Post a Comment