Merge "Issue #2632 - Don't execute notifier on null presence, fix bug with group in UI when deleting last user in group, property change to handle String and Boolean." into development

Former-commit-id: 82778ad21b [formerly 82778ad21b [formerly b723095f6d5d59b67370c7292f88f339d349993a]]
Former-commit-id: f8180587d4
Former-commit-id: 34c5d1de25
This commit is contained in:
Nate Jensen 2014-03-12 16:05:19 -05:00 committed by Gerrit Code Review
commit 2c0d7d2d3e
3 changed files with 37 additions and 7 deletions

View file

@ -84,6 +84,7 @@ import org.osgi.framework.Bundle;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.RosterChangeType;
import com.raytheon.uf.viz.collaboration.comm.provider.event.ServerDisconnectEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserPresenceChangedEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
@ -147,6 +148,7 @@ import com.raytheon.viz.ui.views.CaveFloatingView;
* Feb 24, 2014 2632 mpduff Add Notifier actions.
* Mar 05, 2014 2837 bclement separate rename action for groups, added more icons
* Mar 05, 2014 2798 mpduff Add getter for displayFeedAction.
* Mar 12, 2014 2632 mpduff Force group deletes from UI if last user is removed.
*
* </pre>
*
@ -877,11 +879,25 @@ public class CollaborationGroupView extends CaveFloatingView implements
@Subscribe
public void handleRosterChangeEvent(IRosterChangeEvent rosterChangeEvent) {
/*
* If a user is deleted and that user is the only user in a group the
* group does not get removed from the UI even though the group was
* deleted within XMPP. Force the delete here.
*/
if (rosterChangeEvent.getType() == RosterChangeType.DELETE) {
ContactsManager contacts = CollaborationConnection.getConnection()
.getContactsManager();
for (RosterGroup group : contacts.getGroups()) {
if (group.getEntryCount() == 0) {
groupDeleted(group);
}
}
}
// Refresh the whole tree since there can be instances of the same user
// elsewhere that might not .equals this one.
refreshUsersTreeViewerAsync(usersTreeViewer.getInput());
NotifierTools.processNotifiers(rosterChangeEvent.getPresence());
}
@Subscribe

View file

@ -62,6 +62,7 @@ import com.raytheon.uf.viz.core.sounds.SoundUtil;
* ------------ ---------- ----------- --------------------------
* Feb 24, 2014 2632 mpduff Initial creation.
* Mar 05, 2014 2632 mpduff Removed unused field.
* Mar 12, 2014 2632 mpduff Don't process the notifier if the presence is null.
*
* </pre>
*
@ -92,6 +93,10 @@ public class NotifierTools {
* The updated Presence
*/
public static void processNotifiers(Presence presence) {
if (presence == null) {
return;
}
UserId userId = IDConverter.convertFrom(presence.getFrom());
NotifierTask task = NotifierTools.getNotifierTask(userId.getName());
if (task != null && task.getUserName().equals(userId.getName())) {

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.VizApp;
* Jan 24, 2014 2700 bclement Initial creation
* Feb 3, 2014 2699 bclement fixed assumption that username search was exact
* Feb 13, 2014 2755 bclement added user input for which group to add contact to
* Mar 12, 2014 2632 mpduff Property change to handle String and Boolean
*
* </pre>
*
@ -114,7 +115,15 @@ public class AutoSubscribePropertyListener implements IPropertyChangeListener {
if (event.getProperty().equals(
CollabPrefConstants.AUTO_ACCEPT_SUBSCRIBE)
&& accountManager != null) {
updateManager((Boolean) event.getNewValue());
// The HierarchicalPreferenceStore store sometimes returns a string
Object valueObject = event.getNewValue();
if (valueObject instanceof Boolean) {
updateManager((Boolean) valueObject);
} else {
updateManager(Boolean.valueOf(valueObject.toString()));
}
}
}
@ -170,7 +179,7 @@ public class AutoSubscribePropertyListener implements IPropertyChangeListener {
String displayName = getDisplayName(fromID);
StringBuilder builder = new StringBuilder();
builder.append(fromID.getFQName());
if ( displayName != null){
if (displayName != null) {
builder.append(" (").append(displayName).append(")");
}
builder.append(" wants to add you to his or her contacts list.");