private void confirmTaskClosing(final EventHandler eventHandler) {
    BpmTask task;
    final ProcessToolContext processToolContextFromThread =
        ProcessToolContext.Util.getThreadProcessToolContext();
    if (viewController.getCurrentViewId() != null
        && viewController.getCurrentViewId().equals(ProcessDataViewComponent.class.getName())
        && (task = (BpmTask) viewController.getCurrentViewData().get("task")) != null
        && getBpmSession()
            .isProcessRunning(
                task.getProcessInstance().getInternalId(), processToolContextFromThread)) {
      final ProcessDataPane pdp =
          pdvc != null && pdvc.getProcessDataPane() != null ? pdvc.getProcessDataPane() : null;

      VaadinUtility.displayConfirmationWindow(
          application,
          getI18NSource(),
          i18NSource.getMessage("activity.close.process.confirmation.title"),
          i18NSource.getMessage("activity.close.process.confirmation.question"),
          new String[] {
            "activity.close.process.confirmation.ok",
            pdp != null && pdp.canSaveProcessData()
                ? "activity.close.process.confirmation.save"
                : null,
            "activity.close.process.confirmation.cancel"
          },
          new EventHandler[] {
            eventHandler,
            pdp != null && pdp.canSaveProcessData()
                ? new EventHandler() {
                  @Override
                  public void onEvent() {
                    if (pdp.saveProcessDataButtonAction()) {
                      eventHandler.onEvent();
                    }
                  }
                }
                : null,
            null,
          },
          null);
    } else {
      eventHandler.onEvent();
    }
  }
 public void displayTaskById(String taskId) {
   BpmTask task =
       bpmSession.getTaskData(taskId, ProcessToolContext.Util.getThreadProcessToolContext());
   if (task != null) {
     displayProcessData(task);
   } else {
     application
         .getMainWindow()
         .showNotification(
             i18NSource.getMessage("process.data.task-notfound").replaceFirst("%s", taskId));
   }
 }
  private void initViewController() {
    viewController =
        new BasicViewController(
            new ComponentPaneRenderer<MyProcessesListPane>(
                new MyProcessesListPane(this, i18NSource.getMessage("activity.assigned.tasks"))) {
              @Override
              public Component render(Map<String, ?> viewData) {
                ProcessInstanceFilter filter = (ProcessInstanceFilter) viewData.get("filter");
                if (filter != null) {
                  pane.setTitle(filter.getName());
                  pane.setFilter(filter);
                }
                if (leftPanelTrigger != null) leftPanelTrigger.show();
                return pane.init();
              }
            });

    viewController.addView(
        new ComponentPaneRenderer<ProcessDataViewComponent>(
            new ProcessDataViewComponent(application, i18NSource, viewController)) {
          @Override
          public String getViewId() {
            return ProcessDataViewComponent.class.getName();
          }

          @Override
          public Component render(Map<String, ?> viewData) {
            ProcessToolBpmSession bpmSession = (ProcessToolBpmSession) viewData.get("bpmSession");
            BpmTask task = (BpmTask) viewData.get("task");
            pane.attachProcessDataPane(task, bpmSession);
            ActivityMainPane.this.pdvc = pane;
            return pane;
          }
        });

    viewController.addView(
        new ComponentPaneRenderer<OtherUserProcessesListPane>(
            new OtherUserProcessesListPane(this, i18NSource.getMessage("activity.user.tasks"))) {
          @Override
          public Component render(Map<String, ?> viewData) {
            ProcessInstanceFilter filter = (ProcessInstanceFilter) viewData.get("filter");
            if (filter != null) {
              pane.setTitle(filter.getName());
            }
            pane.setFilter(filter);
            if (filter != null) {
              pane.setUserData(filter.getFilterOwner());
            }
            leftPanelTrigger.show();
            return pane.init();
          }
        });

    viewController.addView(
        new ComponentPaneRenderer<QueueListPane>(new QueueListPane(this)) {
          @Override
          public Component render(Map<String, ?> viewData) {
            ProcessQueue q = (ProcessQueue) viewData.get("queue");
            ProcessInstanceFilter filter = (ProcessInstanceFilter) viewData.get("filter");
            pane.setFilter(filter);
            pane.setQueue(q);
            leftPanelTrigger.show();
            return pane.init();
          }
        });

    viewController.addView(
        new ComponentPaneRenderer<OtherUserQueueListPane>(new OtherUserQueueListPane(this)) {
          @Override
          public Component render(Map<String, ?> viewData) {
            ProcessQueue queue = (ProcessQueue) viewData.get("queue");
            UserData user = (UserData) viewData.get("user");
            ProcessInstanceFilter filter = (ProcessInstanceFilter) viewData.get("filter");
            pane.setFilter(filter);
            pane.setUserData(user);
            pane.setQueue(queue);
            leftPanelTrigger.show();
            return pane.init();
          }
        });

    viewController.addView(
        new ComponentPaneRenderer<RecentProcessesListPane>(
            new RecentProcessesListPane(this, i18NSource.getMessage("activity.recent.tasks"))) {
          @Override
          public Component render(Map<String, ?> viewData) {
            Calendar minDate = (Calendar) viewData.get("minDate");
            pane.setMinDate(minDate);
            leftPanelTrigger.show();
            return pane.init();
          }
        });

    // to remove "strange" views, depending on external addons. Such
    // approach also gives us much greater flexibility
    ViewRegistry registeredService =
        ProcessToolContext.Util.getThreadProcessToolContext()
            .getRegistry()
            .getRegisteredService(ViewRegistry.class);
    if (registeredService != null) {
      for (final ViewRenderer viewRenderer : registeredService.getViews()) {
        viewRenderer.setBpmSession(getBpmSession());
        viewRenderer.setUp(application);
        viewRenderer.setViewCallback(this);
        viewController.addView(viewRenderer);
        activityQueuesPane.addButton(
            viewRenderer.getTitle(),
            new Runnable() {
              @Override
              public void run() {
                viewRenderer.handleDisplayAction();
                viewController.displayView(viewRenderer.getViewId(), null);
              }
            });
      }
    }
  }