Merge "Issue #2751 fixed blocked icon for roster entries" into development

Former-commit-id: e70f0d21ab [formerly e70f0d21ab [formerly 4f02e79ed2211fa9e406e3bc2c633256c6e85faf]]
Former-commit-id: aa7413fd4c
Former-commit-id: f1b7bf1c2a
This commit is contained in:
Nate Jensen 2014-02-18 08:48:00 -06:00 committed by Gerrit Code Review
commit a08dea4b08
2 changed files with 34 additions and 6 deletions

View file

@ -36,7 +36,6 @@ import org.jivesoftware.smack.packet.RosterPacket.ItemType;
import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
@ -52,6 +51,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Jan 27, 2014 2700 bclement added roster entry support
* Feb 13, 2014 2751 bclement made generic for IUsers
* Feb 13, 2014 2751 njensen Extracted getImageName() to allow overrides
* Feb 17, 2014 2751 bclement moved block image logic to roster specific code
*
* </pre>
*
@ -214,11 +214,6 @@ public abstract class AbstractUserLabelProvider<T extends IUser> extends
} else {
key = "contact_disabled";
}
if (user instanceof RosterEntry) {
if (ContactsManager.isBlocked((RosterEntry) user)) {
key = "blocked";
}
}
return key;
}

View file

@ -39,6 +39,7 @@ import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.SharedGroup;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
@ -60,6 +61,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
* Jan 27, 2014 2700 bclement pass roster entries directly to userLabelProvider
* Jan 28, 2014 2698 bclement removed venue info
* Feb 13, 2014 2751 bclement made AbstractUsersLabelProvider generic
* Feb 17, 2014 2751 bclement added block image logic to userLabelProvider
*
* </pre>
*
@ -95,6 +97,37 @@ public class UsersTreeLabelProvider extends ColumnLabelProvider {
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider#
* getImageName
* (com.raytheon.uf.viz.collaboration.comm.identity.user.IUser)
*/
@Override
protected String getImageName(UserId user) {
return isBlocked(user) ? "blocked" : super.getImageName(user);
}
/**
* @param user
* @return true if we are blocked from seeing updates from user
*/
private boolean isBlocked(UserId user) {
boolean rval = false;
CollaborationConnection conn = CollaborationConnection
.getConnection();
UserId account = conn.getUser();
if (!account.isSameUser(user)) {
ContactsManager cm = conn.getContactsManager();
RosterEntry entry = cm.getRosterEntry(user);
if (ContactsManager.isBlocked(entry)) {
rval = true;
}
}
return rval;
}
};
private List<ILabelProviderListener> listeners;