implement back and logout handlers in DevelopmentPage2

Refactored state change callbacks in CodeStateManager so that
the trigger can be an arbitrary predicate function.