/*
   * (non-Javadoc)
   *
   * @see
   * org.ebayopensource.turmeric.policy.adminui.client.Controller#selectPresenter
   * (org.ebayopensource.turmeric.policy.adminui.client.model.HistoryToken)
   */
  public void selectPresenter(final HistoryToken token) {

    if (token != null) {
      String id = HistoryToken.getValue(token, HistoryToken.SUB);

      if (id != null) {
        Presenter p = getPresenter(id);
        if (p != null) {
          UserAction ua = presentersMap.get(p);
          this.view.setSelected(ua);
          p.go(this.view, token);
        }
      }
    }
  }
  private void initPresenters() {
    Presenter presenter = null;

    presenter =
        new SubjectGroupSummaryPresenter(eventBus, new SubjectGroupSummaryView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.SUBJECT_GROUP_SUMMARY, presenter);

    presenter = new SubjectGroupCreatePresenter(eventBus, new SubjectGroupCreateView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.SUBJECT_GROUP_CREATE, presenter);

    presenter = new SubjectGroupImportPresenter(eventBus, new SubjectGroupImportView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.SUBJECT_GROUP_IMPORT, presenter);

    presenter = new SubjectGroupEditPresenter(eventBus, new SubjectGroupEditView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.SUBJECT_GROUP_EDIT, presenter);

    presenter = new SubjectGroupViewPresenter(eventBus, new SubjectGroupViewView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.SUBJECT_GROUP_VIEW, presenter);

    presenter = new PolicySummaryPresenter(eventBus, new PolicySummaryView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.POLICY_SUMMARY, presenter);

    presenter = new PolicyImportPresenter(eventBus, new PolicyImportView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.POLICY_IMPORT, presenter);

    presenter = new AuthzPolicyCreatePresenter(eventBus, new AuthzPolicyCreateView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.AUTHZ_POLICY_CREATE, presenter);

    presenter = new RLPolicyCreatePresenter(eventBus, new RLPolicyCreateView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.RL_POLICY_CREATE, presenter);

    presenter = new BLPolicyCreatePresenter(eventBus, new BLPolicyCreateView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.BL_POLICY_CREATE, presenter);

    presenter = new WLPolicyCreatePresenter(eventBus, new WLPolicyCreateView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.WL_POLICY_CREATE, presenter);

    presenter =
        new HistoryChangeSummaryPresenter(eventBus, new HistoryChangeSummaryView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.CHANGE_HISTORY_SUMMARY, presenter);

    presenter = new BLPolicyEditPresenter(eventBus, new BLPolicyEditView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.BL_POLICY_EDIT, presenter);

    presenter = new WLPolicyEditPresenter(eventBus, new WLPolicyEditView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.WL_POLICY_EDIT, presenter);

    presenter = new AUTHZPolicyEditPresenter(eventBus, new AUTHZPolicyEditView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.AUTHZ_POLICY_EDIT, presenter);

    presenter = new RLPolicyEditPresenter(eventBus, new RLPolicyEditView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.RL_POLICY_EDIT, presenter);

    presenter = new PolicyViewPresenter(eventBus, new PolicyViewView(), serviceMap);
    addPresenter(presenter.getId(), presenter);
    addUserAction(UserAction.POLICY_VIEW, presenter);
  }