Ejemplo n.º 1
0
  @Override
  protected void onGo(final ComponentContainer container, final ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)) {

      InsideProjectNavigationMenu projectModuleMenu =
          (InsideProjectNavigationMenu)
              ((MobileNavigationManager) UI.getCurrent().getContent()).getNavigationMenu();
      projectModuleMenu.selectButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK));

      if (data.getParams() instanceof Integer) {
        ProjectTaskService taskService =
            ApplicationContextUtil.getSpringBean(ProjectTaskService.class);
        SimpleTask task =
            taskService.findById((Integer) data.getParams(), AppContext.getAccountId());

        if (task != null) {
          this.view.previewItem(task);
          super.onGo(container, data);

          AppContext.addFragment(
              ProjectLinkGenerator.generateTaskPreviewLink(
                  task.getTaskkey(), task.getProjectShortname()),
              task.getTaskname());
        } else {
          NotificationUtil.showRecordNotExistNotification();
          return;
        }
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {

    if (data instanceof ProjectScreenData.Edit) {
      // TODO: Handle edit project
    } else {
      if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.PROJECT)) {
        super.onGo(container, data);
        view.displayDashboard();
        AppContext.addFragment(
            ProjectLinkGenerator.generateProjectLink(CurrentProjectVariables.getProject().getId()),
            AppContext.getMessage(ProjectCommonI18nEnum.VIEW_DASHBOARD));
      } else {
        NotificationUtil.showMessagePermissionAlert();
      }
    }
  }