Examples of RosterGroup


Examples of com.calclab.emite.im.roster.RosterGroup

  private RosterGroup group;

  @Before
  public void setup() {
    eventBus = new SimpleEventBus();
    group = new RosterGroup(eventBus, "myGroup");
    group.add(RosterItemHelper.createItem("test3@test", "test3", false, "myGroup"));
    group.add(RosterItemHelper.createItem("test2@test", "test2", true, "myGroup"));
    group.add(RosterItemHelper.createItem("test1@test", "test1", false, "myGroup"));
  }
View Full Code Here

Examples of com.calclab.emite.im.roster.RosterGroup

  }

  @SuppressWarnings("unchecked")
  @Test
  public void shouldOrderAvailabiltyAndGroupAndName() {
    final RosterGroup myGroup = new RosterGroup(eventBus, "myGroup");
    myGroup.add(RosterItemHelper.createItem("test2@test", "test2", true, "myGroup"));
    myGroup.add(RosterItemHelper.createItem("test1@test", "test1", false, "other"));
    myGroup.add(RosterItemHelper.createItem("test3@test", "test3", true));
    final Comparator<RosterItem> order = RosterItemsOrder.order(RosterItemsOrder.byAvailability, RosterItemsOrder.groupedFirst, RosterItemsOrder.byName);
    final ArrayList<RosterItem> list = myGroup.getItemList(order);
    // available and grouped
    assertEquals("test2", list.get(0).getName());
    // available
    assertEquals("test3", list.get(1).getName());
    // not available
View Full Code Here

Examples of com.calclab.emite.im.roster.RosterGroup

  }

  @Test
  public void shouldOrderByGroupedFirst() {
    final RosterGroup myGroup = new RosterGroup(eventBus, "myGroup");
    myGroup.add(RosterItemHelper.createItem("test2@test", "test2", false));
    myGroup.add(RosterItemHelper.createItem("test1@test", "test1", false, "other"));
    myGroup.add(RosterItemHelper.createItem("test3@test", "test3", false, "myGroup"));
    final RosterItem firstItemNotSorted = myGroup.getItemList(null).get(0);
    assertFalse("test3".equals(firstItemNotSorted.getName()));
    final RosterItem firstItemSorted = myGroup.getItemList(RosterItemsOrder.groupedFirst).get(0);
    assertEquals("test3", firstItemSorted.getName());
  }
View Full Code Here

Examples of com.calclab.emite.im.roster.RosterGroup

  @Test
  public void shouldFireChangedItemEventsInGroups() {
    final RosterItem item = newItem("other@domain");
    item.addToGroup("simple");
    setRosterItems(session, item);
    final RosterGroup group = roster.getRosterGroup("simple");
    final RosterItemChangedTestHandler handler = new RosterItemChangedTestHandler();
    group.addRosterItemChangedHandler(handler);
    assertNotNull(group);
    session.receives("<presence from='other@domain'>" + "<show>dnd</show><status>message</status><priority>3</priority></presence>");
    assertTrue(handler.hasEvent());
  }
View Full Code Here

Examples of org.jivesoftware.smack.RosterGroup

        groupMessageWindow.getSubjectField().grabFocus();

    }

    private void renameHandler() {
        RosterGroup g = ConnectorThread.getInstance().getRoster()
                .getGroup(group.getGroupName());
        if (g == null) {
            Standard.warningMessage(
                    BuddyList.getInstance().getContainerFrame(), resources
                            .getString("renameGroup"), resources
View Full Code Here

Examples of org.jivesoftware.smack.RosterGroup

        }

        public void run() {
            if (!BuddyList.getInstance().checkConnection())
                return;
            RosterGroup g = ConnectorThread.getInstance().getRoster()
                    .getGroup(group.getGroupName());
            if (g == null)
                return;

            String error = null;
            try {
                g.setName(newName);
            } catch (Exception ex) {
                error = ex.getMessage();
            }

            final String er = error;
View Full Code Here

Examples of org.jivesoftware.smack.RosterGroup

        String currentGroup = "";

        Iterator iterator = entry.getGroups();
        while (iterator.hasNext()) {
            RosterGroup group = (RosterGroup) iterator.next();
            currentGroup = group.getName();
        }

        if (!currentGroup.equals("")) {
            this.currentGroup = currentGroup;
        }
View Full Code Here

Examples of org.jivesoftware.smack.RosterGroup

        rosterGroups[i++] = resources.getString("none");
        rosterGroups[i++] = resources.getString("newGroup");

        Iterator iterator = roster.getGroups();
        while (iterator.hasNext()) {
            RosterGroup rosterGroup = (RosterGroup) iterator.next();
            if ((currentGroup.equals(""))
                     || (!rosterGroup.getName().equals(currentGroup))) {
                rosterGroups[i] = rosterGroup.getName();
                i++;
            }
        }

        return rosterGroups;
View Full Code Here

Examples of org.jivesoftware.smack.RosterGroup

                    RosterEntry entry = buddy.getRosterEntry();
                    entry.setName(buddyAlias);
                    int c = 0;
                    Iterator groups = entry.getGroups();
                    while (groups.hasNext()) {
                        RosterGroup g = (RosterGroup) groups.next();
                        if(!g.contains(entry)) continue;
                        g.removeEntry(entry);
                        c++;
                    }

                    buddy.setTempGroup(groupName);
                    SwingUtilities.invokeLater(new Runnable()
                    {
                        public void run()
                        {
                            dialog.setVisible(false);
                            buddy.setRemoved(false);

                            NMOptionDialog.createMessageDialog(null, resources.getString("addBuddyDialogTitle"), resources.getString("buddyAdded"));

                            BuddyList.getInstance().getBuddyListTree().addBuddy(
                                    buddy);
                        }
                    });

                    if (groupName != null && !groupName.equals("")) {
                        RosterGroup newGroup = null;
                        newGroup = roster.getGroup(groupName);
                        if (newGroup == null) {
                            com.valhalla.Logger.debug("had to create new group" + groupName);
                            newGroup = roster.createGroup(groupName);
                        } else {
                            com.valhalla.Logger.debug("found group " + newGroup.getName());
                        }

                        if (c != 0) {
                            com.valhalla.Logger.debug("Moving buddy to " + newGroup.getName());
                            newGroup.addEntry(entry);
                        } else {
                            roster.createEntry(buddyId, buddyAlias,
                                    new String[]{groupName});

                        }
View Full Code Here

Examples of org.jivesoftware.smack.RosterGroup

   * @param groupname
   * @return a String representing the online buddies out of the number of total
   *         buddies for a single group like (3/5)
   */
  protected String buddyCountOnlineForGroup(String groupname) {
      RosterGroup rosterGroup = connection.getRoster().getGroup(groupname);
      int buddyEntries = rosterGroup.getEntryCount();
      int allBuddies = buddyEntries;
      for (Iterator I = rosterGroup.getEntries().iterator(); I.hasNext();) {
        RosterEntry entry = (RosterEntry) I.next();
        Presence presence = connection.getRoster().getPresence(entry.getUser());
        if (presence.getType() == Presence.Type.unavailable) buddyEntries--;
      }
      // final string looks like e.g. "(3/5)"
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.