Package org.onesocialweb.gwt.client.task

Examples of org.onesocialweb.gwt.client.task.DefaultTaskInfo


              uiText.PleaseUseUserAtDomain(),
              uiText.OopsCannotSearch());
    } else {

      // Check if JID exists
      final DefaultTaskInfo task = new DefaultTaskInfo(
          uiText.FetchingProfile(), false);
      TaskMonitor.getInstance().addTask(task);
      OswServiceFactory.getService().getProfile(input.getText(),
          new RequestCallback<Profile>() {
View Full Code Here


    // we got everything we need -> clean up UI
    reset();

    // Prepare a task to monitor status
    final DefaultTaskInfo task = new DefaultTaskInfo(
        uiText.UpdatingStatus(), false);
    TaskMonitor.getInstance().addTask(task);
    service.post(entry, new RequestCallback<ActivityEntry>() {

      @Override
      public void onFailure() {
        task.complete(uiText.UpdateFailure(), Status.failure);
      }

      @Override
      public void onSuccess(ActivityEntry result) {
        task.complete(uiText.UpdateSuccess(), Status.succes);
      }

    });
  }
View Full Code Here

    // clear existing labels
    labels.clear();

    // show task
    final DefaultTaskInfo task = new DefaultTaskInfo(
        "Updating your relations with this person", false);
    TaskMonitor.getInstance().addTask(task);

    // get the relations
    OswService service = OswServiceFactory.getService();
    service.getRelations(jid, new RequestCallback<List<Relation>>() {

      @Override
      public void onFailure() {
        task.complete("What a shame, failed to get the relations.",
            Status.failure);
      }

      @Override
      public void onSuccess(List<Relation> result) {

        task.complete("", Status.succes);

        Iterator<Relation> iterator = result.iterator();
        while (iterator.hasNext()) {

          // get the info from the relation
View Full Code Here

          rosterItem.setGroups(listed);
          // disable during processing
          checkbox.setEnabled(false);

          // show task
          final DefaultTaskInfo task = new DefaultTaskInfo(
              "Adding person to the list", false);
          TaskMonitor.getInstance().addTask(task);

          // save new state
          rosterItem.save(new RequestCallback<RosterItem>() {

            @Override
            public void onFailure() {
              // return to original state and notify user
              checkbox.setEnabled(true);
              checkbox.setValue(true);
              task.complete("Could not add person to list.",
                  Status.failure);
            }

            @Override
            public void onSuccess(RosterItem result) {
              // enable the checkbox again
              checkbox.setEnabled(true);
              task.complete("", Status.succes);
            }

          });
        } else if (event.getValue() == false
            && listed.contains(checkbox.getText())) {
          // set the values
          listed.remove(checkbox.getText());
          rosterItem.setGroups(listed);
          // disable during processing
          checkbox.setEnabled(false);

          // show task
          final DefaultTaskInfo task = new DefaultTaskInfo(
              "Removing person from the list", false);
          TaskMonitor.getInstance().addTask(task);

          // save new state
          rosterItem.save(new RequestCallback<RosterItem>() {

            @Override
            public void onFailure() {
              // return to original state and notify user
              checkbox.setEnabled(true);
              checkbox.setValue(true);
              task.complete(
                  "Could not remove person from the list.",
                  Status.failure);
            }

            @Override
            public void onSuccess(RosterItem result) {
              // enable the checkbox again
              checkbox.setEnabled(true);
              task.complete("", Status.succes);
            }

          });
        }
      }
View Full Code Here

        task.complete("", Status.succes);
      }

    } else {
      if (task == null) {
        task = new DefaultTaskInfo(uiText.FetchingActivities(), false);
        TaskMonitor.getInstance().addTask(task);
      }
    }
  }
View Full Code Here

      @Override
      public void onClick(ClickEvent event) {
       
        // Add message in task bar
        final DefaultTaskInfo task = new DefaultTaskInfo(
            "Deleting activity", false);
        TaskMonitor.getInstance().addTask(task);
       
        // set the item to updating and disable the buttons
        disable();
       
        OswService service = OswServiceFactory.getService();
       
        if (activityId.length() > 0) {
          service.delete(activityId, new RequestCallback<Object>() {

            @Override
            public void onFailure() {
              task.complete("", Status.failure);
              enable();
              AlertDialog.getInstance().showDialog("Could not delete the item.", "Oops");
            }

            @Override
            public void onSuccess(Object result) {
              task.complete("", Status.succes);
              enable();
              panel.repaint();
              setVisible(false);
            }
          });
View Full Code Here

    // get a handle to the jid
    jid = OswServiceFactory.getService().getUserBareJID();

    // Fetch the new profile
    final DefaultTaskInfo task = new DefaultTaskInfo(
        uiText.FetchingProfile(), false);
    TaskMonitor.getInstance().addTask(task);

    OswServiceFactory.getService().getProfile(jid,
        new RequestCallback<Profile>() {

          @Override
          public void onFailure() {
            // no profile available
            task.complete("", Status.succes);
            model = null;
            composeProfile();
          }

          @Override
          public void onSuccess(Profile result) {
            task.complete("", Status.succes);
            model = result;
            composeProfile();
          }

        });
View Full Code Here

    // keep track if this is a profile for the signed in user
    if (jid.equals(OswServiceFactory.getService().getUserBareJID()))
      isSignedinUser = true;

    // Fetch the new profile
    final DefaultTaskInfo task = new DefaultTaskInfo(
        uiText.FetchingProfile(), false);
    TaskMonitor.getInstance().addTask(task);
    OswServiceFactory.getService().getProfile(jid,
        new RequestCallback<Profile>() {

          @Override
          public void onFailure() {

            // TODO: add behaviours for different errors like server
            // not available, etc.

            task.complete("", Status.failure);
            model = null;
            AlertDialog.getInstance().showDialog(
                    uiText.AccountUnavailable(),
                    uiText.Oops());
            composeWindow();
            hasProfile = false;
          }

          @Override
          public void onSuccess(Profile result) {
            task.complete("", Status.succes);
            model = result;
            composeWindow();
            hasProfile = true;
          }
View Full Code Here

      profileInstruction.setVisible(true);

    }

    // get the followers of this person
    final DefaultTaskInfo task1 = new DefaultTaskInfo(
        uiText.FetchingFollowers(), false);
    TaskMonitor.getInstance().addTask(task1);

    OswServiceFactory.getService().getSubscribers(jid,
        new RequestCallback<List<String>>() {

          @Override
          public void onFailure() {
            // TODO Auto-generated method stub
            task1.complete("", Status.failure);
          }

          @Override
          public void onSuccess(List<String> result) {

            task1.complete("", Status.succes);

            // see if there are any results
            if (result.size() > 0) {
              // sort the list alphabetically
              Collections.sort(result, new Comparator<String>() {

                @Override
                public int compare(String o1, String o2) {
                  return o1.compareToIgnoreCase(o2);
                }

              });

              // add all the jids to the list
              for (final String jid : result) {

                Label follower = new Label(jid);
                follower.addStyleName("link");
                follower.setTitle(uiText.ViewProfileOf() + " " + jid);
                followersPanel.add(follower);
                follower.addClickHandler(new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent event) {

                    // get the app instance from the session
                    // manager
                    AbstractApplication app = OswClient
                        .getInstance()
                        .getCurrentApplication();
                    ProfileWindow profileWindow = (ProfileWindow) app
                        .addWindow(ProfileWindow.class
                            .toString(), 1);
                    profileWindow.setJID(jid);
                    profileWindow.show();
                  }

                });
              }
            } else {
              // give a message if there are no followers
              followersInstruction
                  .setText(uiText.NoFollowers());
            }

          }

        });

    // get the people who are being followed by this person
    final DefaultTaskInfo task2 = new DefaultTaskInfo(
        uiText.FetchingFollowing(), false);
    TaskMonitor.getInstance().addTask(task2);

    OswServiceFactory.getService().getSubscriptions(jid,
        new RequestCallback<List<String>>() {

          @Override
          public void onFailure() {
            // TODO Auto-generated method stub
            task2.complete("", Status.failure);
          }

          @Override
          public void onSuccess(List<String> result) {

            task2.complete("", Status.succes);

            // see if there are any results
            if (result.size() > 0) {
              // sort the list alphabetically
              Collections.sort(result, new Comparator<String>() {
View Full Code Here

TOP

Related Classes of org.onesocialweb.gwt.client.task.DefaultTaskInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.