protected void trackRoom(final Room room, final PingPongDisplay display) {
    room.addOccupantChangedHandler(
        new OccupantChangedHandler() {
          @Override
          public void onOccupantChanged(OccupantChangedEvent event) {
            display.print(
                "ROOM OCCUPANT "
                    + event.getOccupant().getNick()
                    + " changed: "
                    + event.getChangeType(),
                Style.event);
            String occupants = "";
            for (Occupant occupant : room.getOccupants()) {
              occupants += occupant.getOccupantUri().getResource() + " ";
            }
            display.print(
                "ROOM OCCUPANTS (" + room.getOccupantsCount() + "): " + occupants, Style.event);
          }
        });

    room.addPresenceReceivedHandler(
        new PresenceHandler() {
          @Override
          public void onPresence(PresenceEvent event) {
            display.print("ROOM PRESENCE : " + event.getPresence(), Style.event);
          }
        });
  }
Пример #2
0
  public RoomPanel createRoomPanel(final RoomManager roomManager, final Room room) {

    final RoomPanel panel = new RoomPanel();
    new RoomControl(roomManager, room, panel);
    return (RoomPanel) addChat(room.getURI().toString(), room.getID(), panel);
  }