while (cursor.moveToNext()) ContactGroup contactGroup = new ContactGroup(); contactGroup.setGroupId(cursor.getString(cursor.getColumnIndex(GROUP_ID))); contactGroup.setGroupName(cursor.getString(cursor.getColumnIndex(GROUP_NAME))); contactGroup.setIsDeleted(cursor.getInt(cursor.getColumnIndex(GROUP_IS_DELETED))); contactGroup.setUpdatedDate(cursor.getString(cursor.getColumnIndex(GROUP_UPDATE_DATE))); contactGroup.setIsSync(cursor.getInt(cursor.getColumnIndex(GROUP_IS_SYNC)));
/** * Adds a new ContactGroup to the ContactList. * * @param group the group to add. */ private void addContactGroup(ContactGroup group) { groupList.add(group); Collections.sort(groupList, GROUP_COMPARATOR); try { mainPanel.add(group, groupList.indexOf(group)); } catch (Exception e) { Log.error(e); } group.addContactGroupListener(this); fireContactGroupAdded(group); // Check state String prop = props.getProperty(group.getGroupName()); if (prop != null) { boolean isCollapsed = Boolean.valueOf(prop); group.setCollapsed(isCollapsed); } }
public void mouseReleased(MouseEvent e) { checkPopup(e); }
/** * Updates the presence of one individual based on their JID. * * @param presence the users presence. * @param entry the roster entry being updated. * @param bareJID the bare jid of the user. */ private void updateContactItemsPresence(Presence presence, RosterEntry entry, BareJid bareJID) { for (ContactGroup group : groupList) { ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { if (group == offlineGroup) { changeOfflineToOnline(bareJID, entry, presence); continue; } item.setPresence(presence); group.fireContactGroupUpdated(); } } }
newContactGroup.setGroupName(realGroupName); lastGroup.addContactGroup(newContactGroup); groupList.add(newContactGroup); rootGroup.addContactGroup(newContactGroup); groupList.add(newContactGroup); newContactGroup.addContactGroupListener(this); boolean isSharedGroup = sharedGroups.contains(newContactGroup.getGroupName()); newContactGroup.setSharedGroup(isSharedGroup); String prop = props.getProperty(newContactGroup.getGroupName()); if (prop != null) { boolean isCollapsed = Boolean.valueOf(prop); newContactGroup.setCollapsed(isCollapsed); if (null != getContactGroup(groupName) && !getContactGroup(groupName).hasAvailableContacts())
contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); ContactItem contactItem1 = UIComponentRegistry.createContactItem(rosterEntry.getName(), null, rosterEntry.getJid()); contactGroup.addContactItem( contactItem1 ); Presence presence = PresenceManager.getPresence(jid.asBareJid()); contactItem1.setPresence(presence); if (presence.isAvailable()) { contactGroup.setVisible(true); ContactItem item = offlineGroup.getContactItemByJID(jid.asBareJid()); if (item == null) { item = contactGroup.getContactItemByJID(jid.asBareJid()); item.setPresence(presence); if (presence.isAvailable()) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); offlineGroup.fireContactGroupUpdated(); contactGroup.setVisible(true); contactGroup.fireContactGroupUpdated(); ContactItem itemFound = group.getContactItemByJID(jid.asBareJid()); if (itemFound != null && !unfiled && group != getUnfiledGroup() && group != offlineGroup) { if (!userGroupSet.contains(group.getGroupName())) { if (group.getContactItems().isEmpty()) { removeContactGroup(group);
final ContactItem offlineItem = offlineGroup.getContactItemByJID(bareJID); offlineGroup.removeContactItem(offlineItem); if (contactGroup.getContactItemByJID(entry.getJid()) == null) { ContactItem offlineCurrentItem = contactGroup.getOfflineContactItemByJID(bareJID); contactGroup.removeContactItem(offlineCurrentItem); contactGroup.addContactItem(changeContactItem); changeContactItem.setAvailable(true); changeContactItem.setPresence(presence); toggleGroupVisibility(contactGroup.getGroupName(), true); staticContactGroup.addContactItem(changeContact); changeContact.setPresence(staticItemPrecense); changeContact.setAvailable(true); changeContact.setSpecialIcon(offlineItem.getSpecialImageLabel().getIcon()); changeContact.updatePresenceIcon(changeContact.getPresence()); toggleGroupVisibility(staticContactGroup.getGroupName(), true); staticContactGroup.fireContactGroupUpdated(); if (unfiledGroup.getContactItemByJID(entry.getJid()) == null) { unfiledGrp.addContactItem(contactItem); contactItem.setPresence(presence); contactItem.setAvailable(true);
setTitle(getGroupTitle(groupName)); this.setContentPane(listPanel); if (!isOfflineGroup()) { contactItemList.setDragEnabled(true); contactItemList.setTransferHandler(new ContactGroupTransferHandler()); getTitlePane().addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { checkPopup(e); addPopupWindow();
public boolean removeContactItem(ContactGroup contactGroup, ContactItem item) { if (contactGroup.isSharedGroup()) { return false; if (contactGroup.isUnfiledGroup()) { contactGroup.removeContactItem(item); contactGroup.fireContactGroupUpdated(); return true; if (group.getName().equals(contactGroup.getGroupName())) { try { rosterGroup = group; contactGroup.removeContactItem(item); contactGroup.fireContactGroupUpdated(); //Updating group title return true;
if (contactGroup.getContactItemByJID(item.getJid().asBareJid(), true) != null) { return; contactGroup.addOfflineContactItem(item.getAlias(), item.getNickname(), item.getJid(), null); groupHadAvailableContacts = contactGroup.hasAvailableContacts(); contactGroup.addContactItem(newContact); contactGroup.clearSelection(); contactGroup.fireContactGroupUpdated(); //Updating group title
contactGroup.addOfflineContactItem(item.getAlias(), item.getNickname(), item.getJid(), null); contactGroup.addContactItem(newContact); contactGroup.clearSelection(); contactGroup.fireContactGroupUpdated(); //Updating group title
@Override public void doRun() { // Check to see if the user is offline, if so, move them to the offline group. Presence userPresence = PresenceManager.getPresence(bareJID); if (userPresence.isAvailable()) { return; } item.setPresence(presence); // Check for ContactItemHandler. group.removeContactItem(item); checkGroup(group); if (offlineGroup.getContactItemByJID(item.getJid()) == null) { moveToOffline(item); offlineGroup.fireContactGroupUpdated(); } } }, timeToRun);
offlineGroup.addContactItem(contactItem); contactGroup.addOfflineContactItem(contactItem.getAlias(), contactItem.getNickname(), contactItem.getJid(), contactItem.getStatus()); getUnfiledGroup().addOfflineContactItem(contactItem.getAlias(), contactItem.getNickname(), contactItem.getJid(), contactItem.getStatus()); group.toggleOfflineVisibility(false);
&& entry.isSubscriptionPending()) { contactGroup.addContactItem(contactItem); contactGroup.setVisible(true); if (offlineGroup.getContactItemByJID(entry.getJid()) == null) { moveToOffline(contactItem);
contactGroup.clearSelection(); for (ContactItem contactItem : contactGroup.getContactItems()) { if (!contactMap.containsKey(contactItem.getJID())) { contacts.add(contactItem);
&& entry.isSubscriptionPending(); if (isPending) { contactGroup.setVisible(true); contactGroup.addContactItem(newContactItem);
for (ContactItem contactItem : contactGroup.getContactItems()) { Presence presence = contactItem.getPresence(); if (presence.isAvailable()) { if (transport != null) { handlePresence(contactItem, presence); contactGroup.fireContactGroupUpdated();
@Override public void doRun() { staticItem.updatePresenceIcon(staticItem.getPresence()); staticGroup.fireContactGroupUpdated(); } }, timeToRun);
private void clearSelectionList(ContactItem selectedItem) { // Check for null. In certain cases the event triggering the model might // not find the selected object. if (selectedItem == null) { return; } final ContactGroup owner = getContactGroup(selectedItem.getGroupName()); for (ContactGroup contactGroup : new ArrayList<>( groupList )) { if (owner != contactGroup) { contactGroup.clearSelection(); } } }
public boolean removeContactItem(ContactGroup contactGroup, ContactItem item) { if (contactGroup.isSharedGroup()) { return false; if (contactGroup.isUnfiledGroup()) { contactGroup.removeContactItem(item); contactGroup.fireContactGroupUpdated(); return true; if (group.getName().equals(contactGroup.getGroupName())) { try { rosterGroup = group; contactGroup.removeContactItem(item); contactGroup.fireContactGroupUpdated(); //Updating group title return true;