コード例 #1
0
  @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);
  }
  private Widget createValuePairItem(
      final Annotation annotation,
      final AnnotationValuePairDefinition valuePairDefinition,
      final AnnotationSource annotationSource) {
    final Row valuePairRow = new Row();
    final FormGroup formGroup = new FormGroup();
    valuePairRow.add(formGroup);

    final FormLabel formLabel = new FormLabel();
    formLabel.addStyleName(ColumnSize.MD_3.getCssName());
    formLabel.setText(valuePairDefinition.getName());
    formGroup.add(formLabel);

    final Column column = new Column(ColumnSize.MD_9);
    formGroup.add(column);
    final TextBox content = new TextBox();
    column.add(content);
    final String valuePairString =
        getValuePairStringValue(annotation, valuePairDefinition, annotationSource);
    content.setText(valuePairString);
    content.setReadOnly(true);
    content.setTitle(valuePairString);

    final Button editButton =
        new Button(
            Constants.INSTANCE.advanced_domain_annotation_list_editor_action_edit(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.onEditValuePair(annotation, valuePairDefinition.getName());
              }
            });
    editButton.setEnabled(!readonly);
    editButton.setIcon(IconType.EDIT);

    final Button clearButton =
        new Button(
            Constants.INSTANCE.advanced_domain_annotation_list_editor_action_clear(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.onClearValuePair(annotation, valuePairDefinition.getName());
              }
            });
    clearButton.setEnabled(!readonly);
    clearButton.setIcon(IconType.ERASER);

    final FormGroup formGroupButton = new FormGroup();
    formGroupButton.add(editButton);
    formGroupButton.add(clearButton);
    final Column columnButton = new Column(ColumnSize.MD_9);
    columnButton.setOffset(ColumnOffset.MD_3);
    columnButton.add(formGroupButton);
    valuePairRow.add(columnButton);

    return valuePairRow;
  }