@EventHandler("createButton")
 public void createButton(ClickEvent e) {
   presenter.createJob(
       jobNameText.getText(),
       UTCDateBox.utc2date(jobDueDate.getValue() + jobDueDateTime.getValue()),
       jobTypeText.getText(),
       dataTriesNumber.getValue(),
       dataProvider.getList());
 }
  @EventHandler("updateTaskButton")
  public void updateTaskButton(ClickEvent e) {

    presenter.updateTask(
        taskDescriptionTextArea.getText(),
        userText.getText(),
        // subTaskStrategyListBox.getItemText(subTaskStrategyListBox.getSelectedIndex()),
        (dueDate.getValue() != null && dueDateTime.getValue() != null)
            ? UTCDateBox.utc2date(dueDate.getValue() + dueDateTime.getValue())
            : null,
        Integer.valueOf(taskPriorityListBox.getValue()));
  }
  public void addTask(
      final List<String> users,
      List<String> groups,
      final String taskName,
      int priority,
      boolean isAssignToMe,
      long dueDate,
      long dueDateTime) {
    Date due = UTCDateBox.utc2date(dueDate + dueDateTime);

    if (isAssignToMe
        && users != null
        && users.isEmpty()
        && groups != null
        && containsGroup(groups, identity.getRoles())) {
      // System.out.println(" FIRST OPTION -> Groups were I'm Included  and I want to be
      // autoassigned add/start/claim!!");
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(
                      taskId, taskName, "Task Created and Started (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), true, true);
    } else if (!isAssignToMe
        && users != null
        && users.isEmpty()
        && groups != null
        && containsGroup(groups, identity.getRoles())) {
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(
                      taskId, taskName, "Task Created and Started (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), false, false);
    }
    if (users != null && !users.isEmpty() && users.contains(identity.getName())) {
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(taskId, taskName, "Task Created (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), true, false);
    } else if (users != null && !users.isEmpty() && !users.contains(identity.getName())) {
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(taskId, taskName, "Task Created (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), false, false);
    } else if (groups != null && !groups.isEmpty() && !containsGroup(groups, identity.getRoles())) {
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(taskId, taskName, "Task Created (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), false, false);
    }
  }