Fixes an exception occurring while opening/closing contact list groups.

cusax-fix
Yana Stamcheva 17 years ago
parent 13e34744f2
commit 10fa41c855

@ -30,7 +30,6 @@
public class ContactListModel
extends AbstractListModel
{
private MetaContactListService contactList;
private MetaContactGroup rootGroup;
@ -391,9 +390,10 @@ private Object getElementAt(MetaContactGroup group, int currentIndex,
*/
public void closeGroup(MetaContactGroup group)
{
if (!isGroupClosed(group))
if (!isGroupClosed(group)
&& !isGroupEmpty(group))
{
if(showOffline || containsOnlineContacts(group))
if (showOffline || containsOnlineContacts(group))
{
contentRemoved(this.indexOf(group.getMetaContact(0)),
this.indexOf(group.getMetaContact(
@ -415,13 +415,16 @@ public void closeGroup(MetaContactGroup group)
*/
public void openGroup(MetaContactGroup group)
{
this.closedGroups.remove(group);
contentAdded(this.indexOf(group.getMetaContact(0)), this.indexOf(group
.getMetaContact(countContactsAndSubgroups(group) - 1)));
if (isGroupClosed(group))
{
this.closedGroups.remove(group);
contentAdded(this.indexOf(group.getMetaContact(0)), this.indexOf(group
.getMetaContact(countContactsAndSubgroups(group) - 1)));
ConfigurationManager.storeContactListGroupStatus(
group.getMetaUID(),
false);
ConfigurationManager.storeContactListGroupStatus(
group.getMetaUID(),
false);
}
}
/**
@ -438,6 +441,17 @@ public boolean isGroupClosed(MetaContactGroup group)
return false;
}
/**
* Checks whether the group is closed.
*
* @param group The group to check.
* @return True if the group is closed, false - otherwise.
*/
public boolean isGroupEmpty(MetaContactGroup group)
{
return !(group.countChildContacts() > 0 || group.countSubgroups() > 0);
}
/**
* Returns true if offline contacts should be shown, false otherwise.
*

Loading…
Cancel
Save