Exposed -onInit so it can be overridden.
Moved setting of viewMode to -setState.