public void showUserAsync(String pUserId) {
    try {
      fb.getUser(
          pUserId,
          new AsyncCallbackAdapter() {

            public void onComplete(
                com.blackberry.facebook.model.IObject[] objects, final java.lang.Object state) {
              user = (IUser) objects[0];
              UiApplication.getApplication()
                  .invokeLater(
                      new Runnable() {
                        public void run() {
                          setTitle(
                              new LabelField(
                                  "Hello " + user.getName() + " !",
                                  LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
                          vfm2.deleteAll();
                          vfm2.add(new LabelField("id = " + user.getId()));
                          vfm2.add(new LabelField("name = " + user.getName()));
                          vfm2.add(new LabelField("email = " + user.getEmail()));
                          vfm2.add(new LabelField("birthday = " + user.getBirthdayAsString()));
                          vfm2.add(
                              new LabelField("updated_time = " + user.getUpdatedTimeAsString()));
                        }
                      });
            }

            public void onException(final Exception e, final java.lang.Object state) {
              e.printStackTrace();
              UiApplication.getApplication()
                  .invokeLater(
                      new Runnable() {
                        public void run() {
                          setTitle(
                              new LabelField(
                                  "Error Encountered",
                                  LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
                          vfm2.deleteAll();
                          vfm2.add(new LabelField("Exception: " + e.getMessage()));
                        }
                      });
            }
          },
          null);

    } catch (FacebookException e) {
      e.printStackTrace();
    }

    setTitle(new LabelField("Retrieving...", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
    vfm2.deleteAll();
    vfm2.add(new LabelField("id = ..."));
    vfm2.add(new LabelField("name = ..."));
    vfm2.add(new LabelField("email = ..."));
    vfm2.add(new LabelField("birthday = ..."));
    vfm2.add(new LabelField("updated_time = ..."));
    add(vfm2);
  }
示例#2
0
 public void clearLog() {
   if (vfm != null) {
     vfm.deleteAll();
   }
   if (logEntries != null) {
     logEntries.removeAllElements();
   }
 }
示例#3
0
 public void refresh() {
   vfm.deleteAll();
   for (int i = 0; i < logEntries.size(); i++) {
     LogEntryField curr = (LogEntryField) logEntries.elementAt(i);
     if (Level.isGreaterOrEqual(curr.getLogLevel(), displayLevel)) {
       vfm.add(curr);
     }
   }
 }
  public void showUserSync(String pUserId) {
    try {
      user = fb.getUser(pUserId);
      setTitle(
          new LabelField(
              "Hello " + user.getName() + " !", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
      vfm2.deleteAll();
      vfm2.add(new LabelField("id = " + user.getId()));
      vfm2.add(new LabelField("name = " + user.getName()));
      vfm2.add(new LabelField("email = " + user.getEmail()));
      vfm2.add(new LabelField("birthday = " + user.getBirthdayAsString()));
      vfm2.add(new LabelField("updated_time = " + user.getUpdatedTimeAsString()));
      add(vfm2);

    } catch (Exception e) {
      e.printStackTrace();
      setTitle(new LabelField("Error Encountered", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
      vfm2.deleteAll();
      vfm2.add(new LabelField("Exception: " + e.getMessage()));
      add(vfm2);

    } finally {
    }
  }
示例#5
0
  public void callback(String data) {
    Util.Log("rooms" + data);
    setShowLoader(false);
    if (data.startsWith("Exception")) {
      Dialog.alert("Failed to connect to server.");
    } else if (data.startsWith("room:")) {
      String[] temps = Util.split(data.substring(5), "<room>");
      for (int n = 0; n < temps.length; n++) {
        String[] temp = Util.split(temps[n], "||");
        reloadActive(new RoomChat(temp[1], temp[0]));
      }
      // reloadActive();

      setShowLoader(true);
      if (DeviceInfo.isSimulator()) {
        callbackLBS(DBStor.get_setting().getLat(), DBStor.get_setting().getLon());
      } else {
        LBS.getLocation(this);
      }
    } else if (data.startsWith("empty")) {
      if (DeviceInfo.isSimulator()) {
        callbackLBS(DBStor.get_setting().getLat(), DBStor.get_setting().getLon());
      } else {
        LBS.getLocation(this);
      }
    } else if (data.startsWith("done:")) {
      ChatRoom.deleteAll();
      String temps[] = Util.split(data.substring(5), "<<>>");
      String temp[];
      for (int n = 0; n < temps.length; n++) {
        temp = Util.split(temps[n], "||");
        TombolRoomField tl =
            new TombolRoomField(new RoomChat(temp[1], temp[0]), temp[2], USE_ALL_WIDTH);
        tl.setChangeListener(this);
        ChatRoom.add(tl);
      }
    }
  }