Package userManagement

Examples of userManagement.Friend


  }

  @Test
  public void addChatters() {
    Chat.getSingleton().addChat("Chat1");
    Chat.getSingleton().addChatter("Chat1", new Friend("Tester1", "Testerken1", null));
    Chat.getSingleton().addChatter("Chat1", new Friend("Tester2", "Testerken2", null));

    Assert.assertEquals(Chat.getSingleton().getChatTabbedModel().getTeamIdChatMap().get("Chat1").getModel().getChatters().size(), 3);
  }
View Full Code Here


    Assert.assertEquals(Chat.getSingleton().getChatTabbedModel().getTeamIdChatMap().get("Chat1").getModel().getChatters().size(), 3);
  }

  @Test
  public void removeChatters() {
    Friend friend1 = new Friend("Tester1", "Testerken1", null);
    Friend friend2 = new Friend("Tester2", "Testerken2", null);

    Chat.getSingleton().addChat("Chat2");
   
    Chat.getSingleton().addChatter("Chat2", friend1);
    Chat.getSingleton().addChatter("Chat2", friend2);
View Full Code Here

    Assert.assertEquals(Chat.getSingleton().getChatTabbedModel().getTeamIdChatMap().get("Chat2").getModel().getChatters().size(), 2);
  }
 
  @Test
  public void addChattersToDifferentRooms() {
    Friend friend1 = new Friend("Tester1", "Testerken1", null);
    Friend friend2 = new Friend("Tester2", "Testerken2", null);

    Chat.getSingleton().addChat("Chat7");
    Chat.getSingleton().addChat("Chat8");
   
    Chat.getSingleton().addChatter("Chat7", friend1);
View Full Code Here

    Assert.assertEquals(Chat.getSingleton().getChatTabbedModel().getTeamIdChatMap().get("Chat8").getModel().getChatters().size(), 2);
 
 
  @Test
  public void addAndRemoveChattersToDifferentRooms() {
    Friend friend1 = new Friend("Tester1", "Testerken1", null);
    Friend friend2 = new Friend("Tester2", "Testerken2", null);

    Chat.getSingleton().addChat("Chat9");
    Chat.getSingleton().addChat("Chat10");
   
    Chat.getSingleton().addChatter("Chat9", friend1);
View Full Code Here

  @Override
  public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
      int index = locationToIndex(e.getPoint());
      Friend friend = (Friend) getModel().getElementAt(index);
      ensureIndexIsVisible(index);

      Chat.getSingleton().addChat(friend.getAlias());
      Chat.getSingleton().addChatter(friend.getAlias(), friend);
    }
  }
View Full Code Here

           || naarId.startsWith(GameHubModel.GAMEHUB_NAME))) {

          if (naarId.equals(currentUser.getAlias()) && !vanUser.equals(getCurrentUser().getAlias())) {
            Chat.getSingleton().addChat(vanUser);
            try {
              Chat.getSingleton().addChatter(vanUser, new Friend(fromName, vanUser, InetAddress.getByName(fromIp)));
            } catch (UnknownHostException ex) {
              Logger.getLogger(AbstractLoungeModel.class.getName()).log(Level.SEVERE, null, ex);
            }
            Chat.getSingleton().addChatMessage(vanUser, vanUser, text);
          }

        } else if (naarId.equals(GameHubModel.GAMEHUB_NAME + ":")) {

          String[] invoer = networkInput.split(" ");
          int toTeam = Integer.parseInt(invoer[3]);
          String fromUser = invoer[4];

          String message = input[5];

          for (int i = 6; i < input.length; i++) {
            message += " " + input[i];
          }

          Chat.getSingleton().addChatMessage(GameHubModel.GAMEHUB_NAME + ": Team " + toTeam, fromUser, message);

        } else {

          Chat.getSingleton().addChatMessage(naarId, vanUser, text);

        }

      } else if (networkInput.startsWith(GameLoungeModel.STATUS_CHANGE_TOKEN)) {

        String[] input = networkInput.split(" ");
        String status = input[1];

        for (Friend friend : getCurrentUser().getFriends()) {
          if (friend.getName().equals(fromName)) {
            friend.setStatus(FriendStatus.valueOf(status));
          }
        }

        fireStateChanged();

      } else if (networkInput.startsWith("JOINED: ")) {

        Iterator<Friend> iterator = currentUser.getFriends().iterator();

        while (iterator.hasNext()) {
          Friend friend = iterator.next();

          if (friend.getName().equals(fromName)) {

            if (friend.getStatus() == FriendStatus.OFFLINE) {
              NetworkAdapter.getSingleton().sendMessage("JOINED: " + fromIp, fromIp, fromName);
              Chat.getSingleton().addChatter(GatheringLoungeModel.GATHERINGLOUNGE_NAME, friend);


              friend.setStatus(FriendStatus.IN_GATHERINGLOUNGE);

              fireStateChanged();
            }
          }
        }

      } else if (networkInput.startsWith("LEFT:")) {

        Iterator<Friend> iterator = currentUser.getFriends().iterator();
        while (iterator.hasNext()) {
          Friend friend = iterator.next();

          String ip = networkInput.split(" ")[1];

          if (friend.getName().equals(fromName)) {
            NetworkAdapter.getSingleton().closeConnection(ip, friend.getName());

            friend.setStatus(FriendStatus.OFFLINE);
            fireStateChanged();
          }
        }

      } else if (networkInput.startsWith(GatheringLoungeModel.REQUEST_PROFILE_TOKEN)) {
View Full Code Here

  @Override
  public Component getListCellRendererComponent(JList list, Object value,
     int index, boolean isSelected, boolean cellHasFocus) {

    Friend friend = (Friend) value;

    if (isSelected) {
      setBackground(list.getSelectionBackground());
      setForeground(list.getSelectionForeground());
    } else {
      setBackground(list.getBackground());
      setForeground(list.getForeground());
    }

    SquareIcon icon = new SquareIcon(friend.getStatus().getColor(), 10, getHorizontalAlignment(), 10, 10);
    setOpaque(true);
   
    setText(friend.getAlias());
   
    setIcon(icon);
    setIconTextGap(15);

    return this;
View Full Code Here

     
      abstractLoungeModel.setCurrentUser(user);
      Chat.getSingleton().getChatTabbedModel().editChatter(user);
     
      for (Iterator<Friend> it = abstractLoungeModel.getCurrentUser().getFriends().iterator(); it.hasNext();) {
        Friend friend = it.next();
        NetworkAdapter.getSingleton().sendMessage(AbstractLoungeModel.NAME_CHANGE_TOKEN + " " +
           alias, friend.getIp().getHostAddress(), friend.getName());
      }

    }
  }
View Full Code Here

  @Override
  public Component getListCellRendererComponent(JList list, Object value,
     int index, boolean isSelected, boolean cellHasFocus) {

    Friend friend = (Friend) value;

    if (isSelected) {
      setBackground(list.getSelectionBackground());
      setForeground(list.getSelectionForeground());
    } else {
      setBackground(list.getBackground());
      setForeground(list.getForeground());
    }
   
    setText(friend.getAlias());
    setOpaque(true);
   
    return this;

  }
View Full Code Here

    invitedPlayerList = new ArrayList<Player>();

    Iterator<Friend> iterator = currentUser.getFriends().iterator();
    while (iterator.hasNext()) {
      final Friend friend = iterator.next();
      executor.execute(new Runnable() {

        @Override
        public void run() {
          NetworkAdapter.getSingleton().openConnection(friend.getIp().getHostAddress(), friend.getName());
        }
      });
    }

    NetworkAdapter.getSingleton().setNetworkListener(this);
View Full Code Here

TOP

Related Classes of userManagement.Friend

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.