Issue #437 Bug fixes to user status
Change-Id: Idd46418cc6f40a1f8a4f247942f5b730b851444f Former-commit-id:3421463f53
[formerly74c98303d5
] [formerlyd45396d9f0
[formerly 140fa8efdba2cd5c6cf8b2a1c9696e08d1dc931a]] Former-commit-id:d45396d9f0
Former-commit-id:eec9b69d47
This commit is contained in:
parent
7d84449d7c
commit
b63954e4de
5 changed files with 83 additions and 87 deletions
|
@ -25,6 +25,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
|
@ -51,7 +52,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||
|
@ -59,6 +59,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginData;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginDialog;
|
||||
|
@ -211,11 +212,10 @@ public class CollaborationDataManager {
|
|||
loginData = null;
|
||||
loginData = (LoginData) dlg.open();
|
||||
dlg.close();
|
||||
if (loginData == null) {
|
||||
return;
|
||||
if (loginData != null) {
|
||||
sessionManager = dlg.getSessionManager();
|
||||
loginId = loginData.getAccount();
|
||||
}
|
||||
sessionManager = dlg.getSessionManager();
|
||||
loginId = loginData.getAccount();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -259,17 +259,6 @@ public class CollaborationDataManager {
|
|||
}
|
||||
};
|
||||
PlatformUI.getWorkbench().addWorkbenchListener(wbListener);
|
||||
// TODO this sleep needs to go away. It is a temporary fix to
|
||||
// allow the roster manager to get all its entries before we
|
||||
// use
|
||||
// it. Once we have needed eventhandlers for roster updating
|
||||
// this can go away.
|
||||
try {
|
||||
System.out.println("enter sleep...");
|
||||
Thread.sleep(5000L);
|
||||
System.out.println("Wake from sleep...");
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
IPresence presence = sessionManager.getPresence();
|
||||
if (sessionManager.getPresence() == null) {
|
||||
presence = new Presence();
|
||||
|
@ -304,15 +293,18 @@ public class CollaborationDataManager {
|
|||
* @return session - The venue session or null if none found
|
||||
*/
|
||||
public IVenueSession getSession(String sessionId) {
|
||||
IVenueSession session = null;
|
||||
if (sessionId == null) {
|
||||
if (sessionsMap.size() > 0) {
|
||||
session = sessionsMap.get(sessionsMap.keySet().toArray()[0]);
|
||||
}
|
||||
} else {
|
||||
session = sessionsMap.get(sessionId);
|
||||
}
|
||||
return session;
|
||||
Assert.isNotNull(sessionId,
|
||||
"getSession should never be passed a null sessionId");
|
||||
// IVenueSession session = null;
|
||||
// if (sessionId == null) {
|
||||
// if (sessionsMap.size() > 0) {
|
||||
// session = sessionsMap.get(sessionsMap.keySet().toArray()[0]);
|
||||
// }
|
||||
// } else {
|
||||
// session = sessionsMap.get(sessionId);
|
||||
// }
|
||||
// return session;
|
||||
return sessionsMap.get(sessionId);
|
||||
}
|
||||
|
||||
public Map<String, IVenueSession> getSessions() {
|
||||
|
@ -566,10 +558,7 @@ public class CollaborationDataManager {
|
|||
presence.setStatusMessage(loginData.getModeMessage());
|
||||
try {
|
||||
sessionManager.getAccountManager().sendPresence(presence);
|
||||
IRoster roster = sessionManager.getRosterManager().getRoster();
|
||||
// Generate a fake entry here to update the login user presence in
|
||||
// all registered views.
|
||||
IChatID id = roster.getUser();
|
||||
IChatID id = sessionManager.getUser();
|
||||
RosterEntry rosterEntry = new RosterEntry(id);
|
||||
rosterEntry.setPresence(presence);
|
||||
handleModifiedPresence(rosterEntry);
|
||||
|
@ -588,15 +577,16 @@ public class CollaborationDataManager {
|
|||
@Subscribe
|
||||
public void handleModifiedPresence(IRosterEntry entry) {
|
||||
final IRosterEntry rosterEntry = entry;
|
||||
System.out.println("CollaborationDataManager.handleModifiedPresence");
|
||||
System.out.println(" user " + rosterEntry.getUser().getFQName());
|
||||
System.out.println(" mode " + rosterEntry.getPresence().getMode());
|
||||
System.out.println(" type " + rosterEntry.getPresence().getType());
|
||||
System.out.println(" message"
|
||||
+ rosterEntry.getPresence().getStatusMessage());
|
||||
System.out.println(" groups " + rosterEntry.getGroups());
|
||||
String userId = rosterEntry.getUser().getFQName();
|
||||
System.out.println("CollaborationDataManager.handleModifiedPresence: "
|
||||
+ rosterEntry.getUser().getFQName() + " mode "
|
||||
+ rosterEntry.getPresence().getMode() + "/"
|
||||
+ rosterEntry.getPresence().getType() + ": \""
|
||||
+ rosterEntry.getPresence().getStatusMessage() + "\" groups "
|
||||
+ rosterEntry.getGroups());
|
||||
String userId = CollaborationUtils.makeUserId(rosterEntry);
|
||||
DataUser user = usersMap.get(userId);
|
||||
System.out.println("\tuserId: " + userId + " DataUser: " + user);
|
||||
System.out.println(usersMap.keySet());
|
||||
if (user != null) {
|
||||
user.mode = rosterEntry.getPresence().getMode();
|
||||
user.type = rosterEntry.getPresence().getType();
|
||||
|
@ -628,9 +618,6 @@ public class CollaborationDataManager {
|
|||
displaySession);
|
||||
pec.startup();
|
||||
roleEventControllersMap.put(sessionId, pec);
|
||||
// TODO test only delete
|
||||
// SharedEditor editor = EditorSetup.testLoadEditorData();
|
||||
// pec.initDataArrived(editor);
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
|
|
|
@ -100,7 +100,8 @@ import com.raytheon.uf.viz.collaboration.ui.session.SessionView;
|
|||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* This class is the main view to display the user's information and allow the
|
||||
* user to create sessions.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -234,7 +235,6 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
List<String> ids = new ArrayList<String>();
|
||||
|
||||
for (CollaborationUser user : getSelectedUsers()) {
|
||||
// TODO not add to list if user is already in the session.
|
||||
String id = user.getId();
|
||||
System.out.println("Add Selected User: " + id);
|
||||
ids.add(id);
|
||||
|
@ -1047,8 +1047,8 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
}
|
||||
|
||||
for (IRosterEntry e : rosterGroup.getEntries()) {
|
||||
CollaborationUser child = new CollaborationUser(e.getUser()
|
||||
.getFQName());
|
||||
String userId = CollaborationUtils.makeUserId(e);
|
||||
CollaborationUser child = new CollaborationUser(userId);
|
||||
IPresence presence = e.getPresence();
|
||||
child.setMode(presence.getMode());
|
||||
child.setType(presence.getType());
|
||||
|
@ -1198,11 +1198,10 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
CollaborationNode node = (CollaborationNode) selection
|
||||
.getFirstElement();
|
||||
if (node instanceof SessionGroup) {
|
||||
SessionGroup group = (SessionGroup) selection
|
||||
.getFirstElement();
|
||||
if (!group.isSessionRoot()) {
|
||||
createJoinCollaboration();
|
||||
}
|
||||
// SessionGroup group = (SessionGroup) node;
|
||||
// if (!group.isSessionRoot()) {
|
||||
// createJoinCollaboration();
|
||||
// }
|
||||
} else if (node instanceof CollaborationUser) {
|
||||
String loginUserId = CollaborationDataManager.getInstance()
|
||||
.getLoginId();
|
||||
|
@ -1318,7 +1317,8 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
public void handleModifiedPresence(IRosterEntry rosterEntry) {
|
||||
// Assumes the Data Manager has already update
|
||||
System.out.println("group view roster entry for:"
|
||||
+ rosterEntry.getUser().getFQName() + " "
|
||||
+ rosterEntry.getUser().getName() + "@"
|
||||
+ rosterEntry.getUser().getHost() + " "
|
||||
+ rosterEntry.getPresence().getMode() + "/"
|
||||
+ rosterEntry.getPresence().getType());
|
||||
usersTreeViewer.refresh(topLevel, true);
|
||||
|
|
|
@ -28,6 +28,10 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
|
||||
|
@ -83,6 +87,36 @@ public class CollaborationUtils {
|
|||
name).createImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make userId of the form username@site; using the information in the
|
||||
* Roster Entry.
|
||||
*
|
||||
* @param rosterEntry
|
||||
* @return userId
|
||||
*/
|
||||
public static String makeUserId(IRosterEntry rosterEntry) {
|
||||
IChatID chatId = rosterEntry.getUser();
|
||||
String userId = chatId.getName() + Tools.NAME_DELIM + chatId.getHost();
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make userId of the form username@site; using the information in the Venue
|
||||
* Participant.
|
||||
*
|
||||
* @param participant
|
||||
* @return userId
|
||||
*/
|
||||
public static String makeUserId(IVenueParticipant participant) {
|
||||
StringBuilder sb = new StringBuilder(participant.getName());
|
||||
sb.append(Tools.NAME_DELIM);
|
||||
int start = sb.length();
|
||||
// Assume participant's host is conference.site
|
||||
sb.append(participant.getHost());
|
||||
sb.replace(start, start + "conference.".length(), "");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void sendChatMessage(List<String> ids, String message) {
|
||||
// TODO transform Strings to IDS
|
||||
System.err.println("sendChatMessage: " + message);
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.eclipse.swt.graphics.Image;
|
|||
import org.osgi.framework.Bundle;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
|
@ -137,8 +136,8 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
|
||||
@Override
|
||||
public Color getForeground(Object element, int columnIndex) {
|
||||
CollaborationDataManager.getInstance().getUser(element.toString());
|
||||
System.out.println("getForeground");
|
||||
// CollaborationUser user = (CollaborationUser) element;
|
||||
// System.out.println("getForeground");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,10 +69,10 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
|
||||
/**
|
||||
|
@ -374,7 +374,7 @@ public class SessionView extends AbstractSessionView {
|
|||
for (IVenueParticipant participant : session.getVenue()
|
||||
.getParticipants()) {
|
||||
|
||||
String userId = getParticipantUserId(participant);
|
||||
String userId = CollaborationUtils.makeUserId(participant);
|
||||
CollaborationUser user = new CollaborationUser(userId,
|
||||
sessionId);
|
||||
if (user.getType() == Type.UNKNOWN) {
|
||||
|
@ -402,14 +402,6 @@ public class SessionView extends AbstractSessionView {
|
|||
((GridData) usersComp.getLayoutData()).exclude = true;
|
||||
}
|
||||
|
||||
private String getParticipantUserId(IVenueParticipant participant) {
|
||||
String pFQName = participant.getFQName();
|
||||
StringBuilder sb = new StringBuilder(pFQName.subSequence(0,
|
||||
pFQName.indexOf('@') + 1));
|
||||
sb.append(Tools.parseHost(pFQName).substring("conference.".length()));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// dispose of the images first
|
||||
|
@ -604,8 +596,7 @@ public class SessionView extends AbstractSessionView {
|
|||
participantDeparted(participant);
|
||||
break;
|
||||
case PRESENCE_UPDATED:
|
||||
// The mode for presence not set correctly do not update
|
||||
// participantPresenceUpdated(participant, presence);
|
||||
participantPresenceUpdated(participant, presence);
|
||||
break;
|
||||
case UPDATED:
|
||||
System.out.println("---- handle update here: "
|
||||
|
@ -624,7 +615,7 @@ public class SessionView extends AbstractSessionView {
|
|||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||
.getInput();
|
||||
String name = participant.getFQName();
|
||||
String userId = getParticipantUserId(participant);
|
||||
String userId = CollaborationUtils.makeUserId(participant);
|
||||
for (CollaborationUser user : users) {
|
||||
if (userId.equals(user.getId())) {
|
||||
return;
|
||||
|
@ -640,10 +631,9 @@ public class SessionView extends AbstractSessionView {
|
|||
private void participantDeparted(IVenueParticipant participant) {
|
||||
System.out.println("++++ handle departed here: "
|
||||
+ participant.getName() + ", " + participant.getFQName());
|
||||
String userId = getParticipantUserId(participant);
|
||||
String userId = CollaborationUtils.makeUserId(participant);
|
||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||
.getInput();
|
||||
// String name = participant.getFQName();
|
||||
for (int i = 0; i < users.size(); ++i) {
|
||||
if (userId.equals(users.get(i).getId())) {
|
||||
users.remove(i);
|
||||
|
@ -660,28 +650,14 @@ public class SessionView extends AbstractSessionView {
|
|||
@SuppressWarnings("unchecked")
|
||||
private void participantPresenceUpdated(IVenueParticipant participant,
|
||||
IPresence presence) {
|
||||
// TODO Do not use this to set the mode since it not the user's presence
|
||||
// mode.
|
||||
// Keep as a place holder for now since it may be need to set
|
||||
// Ignore the presence's mode/type. May not be the same as the user's.
|
||||
// TODO Keep as a place holder for now since it may be needed to set
|
||||
// leader/provider roles.
|
||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||
.getInput();
|
||||
System.out.println("++++ handle presence updated here: "
|
||||
+ presence.getMode() + "/" + presence.getType() + ": "
|
||||
+ participant.getName() + ", " + participant.getFQName());
|
||||
String name = participant.getFQName();
|
||||
String userId = getParticipantUserId(participant);
|
||||
for (CollaborationUser user : users) {
|
||||
if (userId.equals(user.getId())) {
|
||||
user.setMode(presence.getMode());
|
||||
user.setType(presence.getType());
|
||||
usersTable.refresh();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CollaborationUser user = new CollaborationUser(name);
|
||||
user.setMode(presence.getMode());
|
||||
user.setType(presence.getType());
|
||||
String userId = CollaborationUtils.makeUserId(participant);
|
||||
System.out.println("++++ handle presence's role updated here name: "
|
||||
+ name + ", userId: " + userId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue