예제 #1
0
  public void update(User user) {
    this.hasFocus = true;
    if (user != currentUser) {
      updateHistoricMessages(revedereManager.getCurrentSession().getMessagesForUser(user));
    }

    this.currentUser = user;
    this.userNameLabel.setText(user.getName());
    addListenerOnShortMessageUpdateIfMissing();
  }
예제 #2
0
 private void addListenerOnShortMessageUpdateIfMissing() {
   final RevedereSession currentRevedereSession = revedereManager.getCurrentSession();
   if (currentRevedereSession != null && collectorListener == null) {
     collectorListener =
         new CollectorListener<ShortMessageUpdate>() {
           @Override
           public void onUpdate(
               Collector<ShortMessageUpdate> collector, ShortMessageUpdate update) {
             if (hasFocus) {
               updateHistoricMessages(currentRevedereSession.getMessagesForUser(currentUser));
             }
           }
         };
     currentRevedereSession.addListenerToShortMessageCollector(collectorListener);
   }
 }