@Override
  public void init(QuickNewJobPresenter p) {
    this.presenter = p;

    newParametersButton.setText(constants.Add_Parameter());
    createButton.setText(constants.Create());
    jobNameLabel.setText(constants.Name());
    jobDueLabel.setText(constants.Due_On());
    jobTypeLabel.setText(constants.Type());
    dataTriesLabel.setText(constants.Retries());

    myParametersGrid.setHeight("200px");

    // Set the message to display when the table is empty.
    myParametersGrid.setEmptyTableWidget(new Label(constants.No_Parameters_added_yet()));

    initGridColumns();

    long now = System.currentTimeMillis();
    jobDueDate.setEnabled(true);

    jobDueDate.setValue(now);

    jobDueDateTime.setValue(UTCDateBox.date2utc(new Date()));
  }
 @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()));
  }
  @Override
  public void init(TaskDetailsPresenter presenter) {
    this.presenter = presenter;

    // Commented out until we add the posibility of adding sub tasks
    // for (String strategy : subTaskStrategies) {
    // subTaskStrategyListBox.addItem(strategy);
    //
    // }

    for (int i = 0; i < priorities.length; i++) {
      final Option option = new Option();
      option.setText(priorities[i]);
      option.setValue(String.valueOf(i));
      taskPriorityListBox.add(option);
    }
    taskPriorityListBox.refresh();

    taskStatusLabel.setText(constants.Status());
    userLabel.setText(constants.User());
    dueDateLabel.setText(constants.Due_On());

    taskPriorityLabel.setText(constants.Priority());

    taskDescriptionLabel.setText(constants.Description());

    updateTaskButton.setText(constants.Update());

    dueDate.getDateBox().setContainer(this);
  }
  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);
    }
  }