@Override
 public void onSuccess(final Entity result) {
   try {
     notifyEntityModifiedListener(new GxtModel(result), Action.create);
   } catch (NimbitsException e) {
     FeedbackHelper.showError(e);
   }
 }
 @Override
 public void handleEvent(BaseEvent be) {
   try {
     notifyActionListener(action);
   } catch (NimbitsException e) {
     FeedbackHelper.showError(e);
   }
 }
      @Override
      public void onSuccess(Void result) {

        connectionCount += -1;

        connectionRequest.setText("Requests(" + connectionCount + ')');
        try {
          notifyEntityModifiedListener(null, Action.refresh);
        } catch (NimbitsException e) {
          FeedbackHelper.showError(e);
        }
      }
    @Override
    public void handleEvent(final MessageBoxEvent be) {

      final Button btn = be.getButtonClicked();
      try {
        if (btn.getText().equals("Yes")) {
          acceptConnection(r, true);
          scrollMenu.remove(m);
        } else if (btn.getText().equals("No")) {
          scrollMenu.remove(m);
          acceptConnection(r, false);
        }
      } catch (NimbitsException ex) {
        FeedbackHelper.showError(ex);
      }
    }
    @Override
    public void handleEvent(MessageBoxEvent be) {
      final String email = be.getValue();
      if (email != null) {
        if (!email.isEmpty()) {
          UserServiceAsync userService = GWT.create(UserService.class);
          try {
            EmailAddress emailAddress =
                CommonFactoryLocator.getInstance().createEmailAddress(email);

            userService.sendConnectionRequest(emailAddress, new ConnectionRequestAsyncCallback());
          } catch (NimbitsException e) {
            FeedbackHelper.showError(e);
          }
        }
      }
    }
    @Override
    public void handleEvent(final MessageBoxEvent be) {
      final String newEntityName = be.getValue();
      if (!Utils.isEmptyString(newEntityName)) {
        final EntityName categoryName;
        try {
          categoryName =
              CommonFactoryLocator.getInstance().createName(newEntityName, EntityType.category);
        } catch (NimbitsException e) {
          FeedbackHelper.showError(e);
          return;
        }

        final EntityServiceAsync service = GWT.create(EntityService.class);
        Entity entity = EntityModelFactory.createEntity(categoryName, EntityType.category);

        service.addUpdateEntity(entity, new AddUpdateEntityAsyncCallback());
      }
    }
    @Override
    public void handleEvent(MessageBoxEvent be) {
      newEntityName = be.getValue();
      if (!Utils.isEmptyString(newEntityName)) {
        final MessageBox box =
            MessageBox.wait(
                "Progress",
                "Creating your data point channel into the cloud",
                "Creating: " + newEntityName);
        box.show();
        EntityServiceAsync service = GWT.create(EntityService.class);

        try {
          Point p = EntityHelper.createPointWithName(newEntityName);

          service.addUpdateEntity(p, new NewPointEntityAsyncCallback(box));
        } catch (NimbitsException caught) {
          FeedbackHelper.showError(caught);
        }
      }
    }
    @Override
    public void handleEvent(final BaseEvent be) {
      //	final Dialog simple = new Dialog();
      // simple.setHeading(");
      try {
        final MessageBox box = new MessageBox();
        box.setButtons(MessageBox.YESNOCANCEL);
        box.setIcon(MessageBox.QUESTION);
        box.setTitle("Connection request approval");
        box.addCallback(
            new ApproveConnectionMessageBoxEventListener(r, scrollMenu, m, connectionRequest));

        box.setMessage(
            "The owner of the email address: '"
                + r.getRequestorEmail().getValue()
                + "' would like to connect with you. You will have read only access to each others data points. Is that OK?");

        box.show();
      } catch (NimbitsException e) {
        FeedbackHelper.showError(e);
      }
    }
    @Override
    public void onSuccess(final List<ConnectionRequest> result) {

      try {
        if (result.isEmpty()) {
          connectionRequest.setVisible(false);
        } else {
          final Menu scrollMenu = new Menu();
          scrollMenu.setMaxHeight(MAX_HEIGHT);
          for (final ConnectionRequest r : result) {
            MenuItem m = acceptConnectionMenuItem(scrollMenu, r);
            scrollMenu.add(m);
          }

          connectionRequest.setMenu(scrollMenu);
          connectionCount = result.size();

          connectionRequest.setText("Requests(" + connectionCount + ')');
        }
      } catch (NimbitsException ex) {
        FeedbackHelper.showError(ex);
      }
    }
Example #10
0
 @Override
 public void onFailure(Throwable caught) {
   FeedbackHelper.showError(caught);
 }