예제 #1
0
  private void displayTasks() {
    if (this.criteria == null) {
      final TaskSearchCriteria criteria = new TaskSearchCriteria();
      criteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId()));
      criteria.setTaskListId(new NumberSearchField(this.taskList.getId()));
      criteria.setStatuses(
          new SetSearchField<String>(SearchField.AND, new String[] {"Open", "Pending"}));
      this.criteria = criteria;
    }

    this.taskDisplay.setSearchCriteria(this.criteria);

    // Update tasklist progress and number of open task/all task
    if (this.taskNumberLbl != null) {
      this.taskNumberLbl.setValue(
          "("
              + (this.taskList.getNumOpenTasks() + 1)
              + "/"
              + (this.taskList.getNumAllTasks() + 1)
              + ")");
    }

    final int newAllTasks = this.taskList.getNumAllTasks() + 1;
    final double newProgressTask =
        (this.taskList.getPercentageComplete() * this.taskList.getNumAllTasks()) / newAllTasks;
    if (this.taskListProgress != null) {
      this.taskListProgress.setValue(newProgressTask + "");
    }
  }
  @Override
  protected void displayView() {
    constructUI();
    baseCriteria = new TaskSearchCriteria();
    baseCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId()));
    OptionValService optionValService =
        ApplicationContextUtil.getSpringBean(OptionValService.class);
    List<OptionVal> options =
        optionValService.findOptionValsExcludeClosed(
            ProjectTypeConstants.TASK,
            CurrentProjectVariables.getProjectId(),
            AppContext.getAccountId());

    SetSearchField<String> statuses = new SetSearchField<>();
    for (OptionVal option : options) {
      statuses.addValue(option.getTypeval());
    }
    baseCriteria.setStatuses(statuses);
    statisticSearchCriteria = BeanUtility.deepClone(baseCriteria);
    queryAndDisplayTasks();
    displayTaskStatistic();
  }