mirror of
https://github.com/igniterealtime/Spark.git
synced 2026-02-04 14:05:26 +00:00
ContactGroup: make getOfflineContacts() to return sorted list
Make it similar to getContactItems() that returns a sorted copy. Remove ContactList.ContactItemComparator as it's the same as the ContactGroup.itemComparator. Remove sorting of the group.getOfflineContacts() results in the BroadcastDialog()
This commit is contained in:
committed by
Guus der Kinderen
parent
41bb9f6697
commit
058591ec38
@ -809,13 +809,15 @@ public class ContactGroup extends CollapsiblePane implements MouseListener {
|
||||
}
|
||||
|
||||
public Collection<ContactItem> getOfflineContacts() {
|
||||
return new ArrayList<>(offlineContacts);
|
||||
final List<ContactItem> list = new ArrayList<>(offlineContacts);
|
||||
list.sort(itemComparator);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts ContactItems.
|
||||
*/
|
||||
final protected Comparator<ContactItem> itemComparator = Comparator.comparing(item -> item.getDisplayName().toLowerCase());
|
||||
private final static Comparator<ContactItem> itemComparator = Comparator.comparing(item -> item.getDisplayName().toLowerCase());
|
||||
|
||||
/**
|
||||
* Returns true if this ContactGroup is the Offline Group.
|
||||
|
||||
@ -2517,11 +2517,6 @@ public class ContactList extends JPanel implements ActionListener,
|
||||
return unfiledGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts ContactItems.
|
||||
*/
|
||||
public final static Comparator<ContactItem> ContactItemComparator = Comparator.comparing(item -> item.getDisplayName().toLowerCase());
|
||||
|
||||
public void showAddContact(String contact) {
|
||||
addContactMenu.doClick();
|
||||
}
|
||||
|
||||
@ -123,10 +123,7 @@ public class BroadcastDialog extends JPanel {
|
||||
nodes.add(itemNode);
|
||||
}
|
||||
|
||||
final List<ContactItem> offlineContacts = new ArrayList<>( group.getOfflineContacts() );
|
||||
offlineContacts.sort(ContactList.ContactItemComparator);
|
||||
|
||||
for (ContactItem item : offlineContacts) {
|
||||
for (ContactItem item : group.getOfflineContacts()) {
|
||||
CheckNode itemNode = new CheckNode(item.getDisplayName(), false, item.getIcon());
|
||||
itemNode.setAssociatedObject(item.getJid().toString());
|
||||
groupNode.add(itemNode);
|
||||
|
||||
Reference in New Issue
Block a user