コード例 #1
0
    @Override
    public void load(
        final Filter f,
        final long start,
        final long end,
        final DataLoadHandler<ListGridEntry<ProjectMember>> lh) {

      if (_mode.equals(FormEditMode.CREATE)) {
        if (_o.members() == null) {
          lh.loaded(0, 0, 0, null, null);
        } else {
          doLoad(f, start, end, _o.members(), lh);
        }
      } else {
        new ProjectMemberList(_o)
            .send(
                new ObjectMessageResponse<List<ProjectMember>>() {

                  @Override
                  public void responded(List<ProjectMember> pms) {

                    if (pms != null) {
                      if (!pms.isEmpty()) {
                        doLoad(f, start, end, pms, lh);
                        return;
                      }
                    }
                    lh.loaded(0, 0, 0, null, null);
                  }
                });
      }
    }
コード例 #2
0
  @Override
  public Validity valid() {

    if (_mode.equals(FormEditMode.READ_ONLY)) {
      return IsValid.INSTANCE;
    }

    if (!_o.hasMembersOrRoleMembers()) {
      return new Validity() {

        @Override
        public boolean valid() {

          return false;
        }

        @Override
        public String reasonForIssue() {

          return "No member or role members are set.";
        }
      };
    }
    if (!_o.hasAdminMember()) {
      return new Validity() {

        @Override
        public boolean valid() {

          return false;
        }

        @Override
        public String reasonForIssue() {

          return "No project-administrator member or role member is set.";
        }
      };
    }
    return IsValid.INSTANCE;
  }
コード例 #3
0
  private void commitChanges(final Action postAction) {

    if (_mode.equals(FormEditMode.UPDATE)) {
      _o.commitMembers(
          new ObjectMessageResponse<Boolean>() {

            @Override
            public void responded(Boolean r) {

              if (r) {
                _changed = true;
                ProjectMemberGrid.this.notifyOfChangeInState();
                postAction.execute();
              }
            }
          });
    } else {
      notifyOfChangeInState();
      if (postAction != null) {
        postAction.execute();
      }
    }
  }