Ejemplo n.º 1
0
 private void updateLabels() {
   IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
   this.projectNameLabel.setText(PROJECT_NAME_LABEL + this.project.getName());
   if (project.getOwner() != null) {
     this.ownerLabel.setText(OWNER_LABEL + project.getOwner().getName());
   } else {
     this.ownerLabel.setText(OWNER_LABEL + accountDetail.getName());
   }
   this.organizationLabel.setText(ORGANIZATION_LABEL + accountDetail.getOrganization());
 }
  @Override
  public boolean isEnabled() {
    IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
    // Application has neither an authority nor a trusted level
    GPTrustedLevel accountTrustedLevel = accountDetail.getTrustedLevel();

    return (accountTrustedLevel == null)
        ? false
        : accountTrustedLevel.ordinal() >= this.trustedLevel.ordinal();
  }
Ejemplo n.º 3
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();
  }
  @Override
  public void componentSelected(ButtonEvent e) {
    //        RootLayoutPanel.get().add(new BinderDeckLayout());
    //        this.binderDeckLayout.setVisible(Boolean.TRUE);
    //        notificationPopupPanel.setStyleName(style.notifypopup());
    notificationPopupPanel.setPopupPosition(
        e.getTarget().getAbsoluteLeft() - (170), e.getTarget().getAbsoluteTop() + (20));
    notificationPopupPanel.show();
    IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
    List<IGPClientMessage> messageList = accountDetail.getUnreadMessages();
    if (messageList != null && !messageList.isEmpty()) {
      NotificationRemote.Util.getInstance()
          .markMessagesAsRead(
              new AsyncCallback<Boolean>() {
                @Override
                public void onFailure(Throwable caught) {
                  if (caught.getCause() instanceof GPSessionTimeout) {
                    GPHandlerManager.fireEvent(new GPLoginEvent(null));
                  } else {
                    GeoPlatformMessage.errorMessage(
                        "Error Saving the read messages",
                        "An error occurred while making the requested connection.\n"
                            + "Verify network connections and try again."
                            + "\nIf the problem persists contact your system administrator.");
                    LayoutManager.getInstance()
                        .getStatusMap()
                        .setStatus(
                            "Error Saving the read messages",
                            SearchStatus.EnumSearchStatus.STATUS_NO_SEARCH.toString());
                    System.out.println(
                        "Error Saving the read messages: "
                            + caught.toString()
                            + " data: "
                            + caught.getMessage());
                  }
                }

                @Override
                public void onSuccess(Boolean result) {}
              });
    }
  }
 @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();
   }
 }