コード例 #1
0
  public void loadData(GPClientProject project) {
    super.init();
    this.reset();
    this.project = project;
    LayerRemote.Util.getInstance()
        .getOrganizationUsersToShareProject(
            project.getId(),
            new AsyncCallback<ArrayList<GPSimpleUser>>() {
              @Override
              public void onFailure(Throwable caught) {
                System.out.println(
                    "Failled to load Organization Users to Share Project: " + caught);
              }

              @Override
              public void onSuccess(ArrayList<GPSimpleUser> result) {
                fromStore.add(result);
              }
            });
    LayerRemote.Util.getInstance()
        .getAccountsFromSharedProject(
            project.getId(),
            new AsyncCallback<ArrayList<GPSimpleUser>>() {
              @Override
              public void onFailure(Throwable caught) {
                System.out.println("Failled to load Share Project's Accounts: " + caught);
              }

              @Override
              public void onSuccess(ArrayList<GPSimpleUser> result) {
                toStore.add(result);
              }
            });
    boolean enableMenu = false;
    IGPAccountDetail accountInSession =
        Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
    if (project.getOwner() == null || project.getOwner().getId().equals(accountInSession.getId())) {
      enableMenu = true;
    }
    saveButton.setEnabled(enableMenu);
    this.updateLabels();
  }
コード例 #2
0
 @Override
 public void changeSelection(SelectionChangedEvent<GPClientProject> se) {
   GPClientProject clientProject = se.getSelectedItem();
   if (clientProject != null) {
     super.selectButton.enable();
     IGPAccountDetail accountInSession =
         Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
     if (clientProject.getOwner() == null
         || clientProject.getOwner().getId().equals(accountInSession.getId())) {
       deleteButton.enable();
       this.editButton.enable();
       this.shareButton.enable();
     } else {
       this.shareButton.disable();
       this.editButton.disable();
       deleteButton.disable();
     }
   } else {
     selectButton.disable();
     deleteButton.disable();
     editButton.disable();
     this.shareButton.disable();
   }
 }