Issue #429 major refactor of UserId, make CollaborationGroupView use actual objects instead of wrappers
Former-commit-id: 68f7aaecfe8c78db56a70e8d33a9d990bf5fa467
This commit is contained in:
parent
a4b0addeee
commit
0241e8857f
33 changed files with 639 additions and 1481 deletions
|
@ -60,6 +60,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenue
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
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.roster.IRosterEntry;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||||
|
@ -67,7 +68,6 @@ 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.roster.RosterEntry;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
|
||||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
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.LoginData;
|
||||||
|
@ -104,7 +104,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
*/
|
*/
|
||||||
private CollaborationConnection sessionManager;
|
private CollaborationConnection sessionManager;
|
||||||
|
|
||||||
String loginId;
|
private UserId loginId;
|
||||||
|
|
||||||
private LoginData loginData;
|
private LoginData loginData;
|
||||||
|
|
||||||
|
@ -119,9 +119,9 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
/**
|
/**
|
||||||
* User information such as sessions and groups user is in.
|
* User information such as sessions and groups user is in.
|
||||||
*/
|
*/
|
||||||
Map<String, DataUser> usersMap;
|
Map<UserId, IRosterEntry> usersMap;
|
||||||
|
|
||||||
Set<DataGroup> groupsSet;
|
Set<IRosterGroup> groups;
|
||||||
|
|
||||||
private boolean linkCollaboration;
|
private boolean linkCollaboration;
|
||||||
|
|
||||||
|
@ -159,36 +159,25 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
*/
|
*/
|
||||||
private CollaborationDataManager() {
|
private CollaborationDataManager() {
|
||||||
linkCollaboration = false;
|
linkCollaboration = false;
|
||||||
groupsSet = new HashSet<DataGroup>();
|
groups = new HashSet<IRosterGroup>();
|
||||||
usersMap = new HashMap<String, DataUser>();
|
usersMap = new HashMap<UserId, IRosterEntry>();
|
||||||
sessionsMap = new HashMap<String, IVenueSession>();
|
sessionsMap = new HashMap<String, IVenueSession>();
|
||||||
eventBus = new EventBus();
|
eventBus = new EventBus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateGroups() {
|
private void populateGroups() {
|
||||||
IRoster roster = sessionManager.getRosterManager().getRoster();
|
IRoster roster = sessionManager.getRosterManager().getRoster();
|
||||||
System.out.println("rosterManager Name " + roster.getUser().getName()
|
|
||||||
+ ": group size " + roster.getGroups().size() + ": entry size "
|
|
||||||
+ roster.getEntries().size());
|
|
||||||
|
|
||||||
groupsSet.clear();
|
|
||||||
|
|
||||||
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
||||||
String groupName = rosterGroup.getName();
|
groups.add(rosterGroup);
|
||||||
DataGroup group = new DataGroup(groupName);
|
|
||||||
groupsSet.add(group);
|
|
||||||
for (IRosterEntry rosterEntry : rosterGroup.getEntries()) {
|
for (IRosterEntry rosterEntry : rosterGroup.getEntries()) {
|
||||||
DataUser user = getUser(CollaborationUtils
|
usersMap.put(rosterEntry.getUser(), rosterEntry);
|
||||||
.makeUserId(rosterEntry));
|
|
||||||
user.addGroup(groupName);
|
|
||||||
user.setPresence(rosterEntry.getPresence());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Orphan users not in any group.
|
// Orphan users not in any group.
|
||||||
for (IRosterEntry rosterEntry : roster.getEntries()) {
|
for (IRosterEntry rosterEntry : roster.getEntries()) {
|
||||||
DataUser user = getUser(CollaborationUtils.makeUserId(rosterEntry));
|
usersMap.put(rosterEntry.getUser(), rosterEntry);
|
||||||
user.setPresence(rosterEntry.getPresence());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,29 +189,23 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
* display.
|
* display.
|
||||||
* @return groups
|
* @return groups
|
||||||
*/
|
*/
|
||||||
public List<String> getGroups(boolean allGroups) {
|
public List<IRosterItem> getGroups(boolean allGroups) {
|
||||||
List<String> result = new ArrayList<String>();
|
List<IRosterItem> result = new ArrayList<IRosterItem>();
|
||||||
if (allGroups) {
|
if (allGroups) {
|
||||||
for (DataGroup dataGroup : groupsSet) {
|
for (IRosterGroup dataGroup : groups) {
|
||||||
result.add(dataGroup.getId());
|
result.add(dataGroup);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (DataGroup dataGroup : groupsSet) {
|
|
||||||
if (dataGroup.isDisplay()) {
|
|
||||||
result.add(dataGroup.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getUsersInGroup(String groupId) {
|
public List<IRosterEntry> getUsersInGroup(IRosterItem groupId) {
|
||||||
List<String> userList = new ArrayList<String>();
|
List<IRosterEntry> userList = new ArrayList<IRosterEntry>();
|
||||||
for (String userId : usersMap.keySet()) {
|
for (UserId userId : usersMap.keySet()) {
|
||||||
DataUser user = usersMap.get(userId);
|
IRosterEntry user = usersMap.get(userId);
|
||||||
for (String group : user.groups) {
|
for (IRosterGroup group : user.getGroups()) {
|
||||||
if (groupId.equals(group)) {
|
if (groupId.equals(group)) {
|
||||||
userList.add(userId);
|
userList.add(user);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,39 +215,14 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
|
|
||||||
public boolean displayGroup(String groupId) {
|
public boolean displayGroup(String groupId) {
|
||||||
boolean display = true;
|
boolean display = true;
|
||||||
for (DataGroup group : groupsSet) {
|
// TODO maybe need to make this displayGroup function do something
|
||||||
if (groupId.equals(group.getId())) {
|
|
||||||
display = group.isDisplay();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getOrphanUsers() {
|
public UserId getLoginId() {
|
||||||
List<String> orphanList = new ArrayList<String>();
|
|
||||||
for (String userId : usersMap.keySet()) {
|
|
||||||
DataUser user = usersMap.get(userId);
|
|
||||||
if (user.groups.size() == 0 && userId.equals(loginId) == false) {
|
|
||||||
orphanList.add(userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return orphanList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLoginId() {
|
|
||||||
return loginId;
|
return loginId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataUser getUser(String id) {
|
|
||||||
DataUser user = usersMap.get(id);
|
|
||||||
if (user == null) {
|
|
||||||
user = new DataUser(id);
|
|
||||||
usersMap.put(id, user);
|
|
||||||
}
|
|
||||||
return usersMap.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLinkCollaboration(boolean state) {
|
public void setLinkCollaboration(boolean state) {
|
||||||
this.linkCollaboration = state;
|
this.linkCollaboration = state;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +245,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
*
|
*
|
||||||
* @return sessionManager or null if unable to get connection.
|
* @return sessionManager or null if unable to get connection.
|
||||||
*/
|
*/
|
||||||
synchronized public CollaborationConnection getSessionManager() {
|
synchronized public CollaborationConnection getCollaborationConnection() {
|
||||||
// Get user's server account information and make connection.
|
// Get user's server account information and make connection.
|
||||||
if (isConnected() == false) {
|
if (isConnected() == false) {
|
||||||
VizApp.runSync(new Runnable() {
|
VizApp.runSync(new Runnable() {
|
||||||
|
@ -495,7 +453,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
*/
|
*/
|
||||||
public String createCollaborationSession(String venue, String subject)
|
public String createCollaborationSession(String venue, String subject)
|
||||||
throws CollaborationException {
|
throws CollaborationException {
|
||||||
CollaborationConnection sessionManager = getSessionManager();
|
CollaborationConnection sessionManager = getCollaborationConnection();
|
||||||
IVenueSession session = null;
|
IVenueSession session = null;
|
||||||
String sessionId = null;
|
String sessionId = null;
|
||||||
// try {
|
// try {
|
||||||
|
@ -517,7 +475,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
|
|
||||||
public String createTextOnlySession(String venueName, String subject)
|
public String createTextOnlySession(String venueName, String subject)
|
||||||
throws CollaborationException {
|
throws CollaborationException {
|
||||||
CollaborationConnection sessionManager = getSessionManager();
|
CollaborationConnection sessionManager = getCollaborationConnection();
|
||||||
IVenueSession session = null;
|
IVenueSession session = null;
|
||||||
String sessionId = null;
|
String sessionId = null;
|
||||||
session = sessionManager.createTextOnlyVenue(venueName, subject);
|
session = sessionManager.createTextOnlyVenue(venueName, subject);
|
||||||
|
@ -683,10 +641,8 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void handleModifiedPresence(IRosterEntry entry) {
|
public void handleModifiedPresence(IRosterEntry entry) {
|
||||||
final IRosterEntry rosterEntry = entry;
|
final IRosterEntry rosterEntry = entry;
|
||||||
String userId = CollaborationUtils.makeUserId(rosterEntry);
|
IRosterEntry user = usersMap.get(entry.getUser());
|
||||||
DataUser user = usersMap.get(userId);
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
user.setPresence(rosterEntry.getPresence());
|
|
||||||
// Assumes only UI updates will be registered.
|
// Assumes only UI updates will be registered.
|
||||||
VizApp.runAsync(new Runnable() {
|
VizApp.runAsync(new Runnable() {
|
||||||
|
|
||||||
|
@ -709,10 +665,6 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
final IRosterChangeEvent rosterChangeEvent = event;
|
final IRosterChangeEvent rosterChangeEvent = event;
|
||||||
// TODO update the event's user groups here for the desired type
|
// TODO update the event's user groups here for the desired type
|
||||||
IRosterEntry rosterEntry = rosterChangeEvent.getEntry();
|
IRosterEntry rosterEntry = rosterChangeEvent.getEntry();
|
||||||
String userId = CollaborationUtils.makeUserId(rosterEntry);
|
|
||||||
DataUser user = getUser(userId);
|
|
||||||
System.out.println("=== RosterChangeEvent<" + event.getType() + ">: "
|
|
||||||
+ userId);
|
|
||||||
IPresence presence = rosterChangeEvent.getEntry().getPresence();
|
IPresence presence = rosterChangeEvent.getEntry().getPresence();
|
||||||
if (presence != null) {
|
if (presence != null) {
|
||||||
System.out.println("\t" + presence.getMode() + "/"
|
System.out.println("\t" + presence.getMode() + "/"
|
||||||
|
@ -722,39 +674,39 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
Collection<IRosterGroup> userGroups = rosterEntry.getGroups();
|
Collection<IRosterGroup> userGroups = rosterEntry.getGroups();
|
||||||
switch (rosterChangeEvent.getType()) {
|
switch (rosterChangeEvent.getType()) {
|
||||||
case ADD:
|
case ADD:
|
||||||
user.clearGroups();
|
|
||||||
for (IRosterGroup group : userGroups) {
|
for (IRosterGroup group : userGroups) {
|
||||||
String groupName = group.getName();
|
boolean matched = false;
|
||||||
user.addGroup(groupName);
|
for (IRosterGroup dGroup : groups) {
|
||||||
DataGroup dataGroup = null;
|
if (dGroup.getName().equals(group.getName())) {
|
||||||
for (DataGroup dGroup : groupsSet) {
|
dGroup = group;
|
||||||
if (groupName.equals(dGroup.getId())) {
|
matched = true;
|
||||||
dataGroup = dGroup;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dataGroup == null) {
|
if (!matched) {
|
||||||
groupsSet.add(new DataGroup(groupName));
|
groups.add(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DELETE:
|
case DELETE:
|
||||||
// Assume user no longer exists and remove.
|
// Assume user no longer exists and remove.
|
||||||
usersMap.remove(user);
|
usersMap.remove(rosterEntry);
|
||||||
break;
|
break;
|
||||||
case MODIFY:
|
case MODIFY:
|
||||||
// Assume only the presence needs to be updated.
|
// Assume only the presence needs to be updated.
|
||||||
IPresence precsence = rosterEntry.getPresence();
|
if (presence == null) {
|
||||||
if (precsence == null) {
|
|
||||||
// Nothing to do don't bother doing eventBus post.
|
// Nothing to do don't bother doing eventBus post.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
user.setPresence(precsence);
|
for (UserId id : usersMap.keySet()) {
|
||||||
|
if (rosterEntry.getUser().equals(id)) {
|
||||||
|
usersMap.put(id, rosterEntry);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PRESENCE:
|
||||||
break;
|
break;
|
||||||
// case PRESENCE:
|
|
||||||
// System.out.println("\tIgnore assume only presence change");
|
|
||||||
// return;
|
|
||||||
// break;
|
|
||||||
default:
|
default:
|
||||||
statusHandler.handle(Priority.PROBLEM, "Unhandled type: "
|
statusHandler.handle(Priority.PROBLEM, "Unhandled type: "
|
||||||
+ rosterChangeEvent.getType());
|
+ rosterChangeEvent.getType());
|
||||||
|
@ -771,6 +723,13 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the usersMap
|
||||||
|
*/
|
||||||
|
public Map<UserId, IRosterEntry> getUsersMap() {
|
||||||
|
return usersMap;
|
||||||
|
}
|
||||||
|
|
||||||
public void registerEventHandler(Object handler) {
|
public void registerEventHandler(Object handler) {
|
||||||
eventBus.register(handler);
|
eventBus.register(handler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
package com.raytheon.uf.viz.collaboration.data;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Feb 22, 2012 mnash Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author mnash
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class CollaborationGroup extends CollaborationNode {
|
|
||||||
protected boolean modifiable;
|
|
||||||
|
|
||||||
protected List<CollaborationNode> children;
|
|
||||||
|
|
||||||
public CollaborationGroup(String id) {
|
|
||||||
super(id);
|
|
||||||
children = new ArrayList<CollaborationNode>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param modifiable
|
|
||||||
* the modifiable to set
|
|
||||||
*/
|
|
||||||
public void setModifiable(boolean modifiable) {
|
|
||||||
this.modifiable = modifiable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getModifiable() {
|
|
||||||
return modifiable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addChild(CollaborationNode child) {
|
|
||||||
children.add(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the users
|
|
||||||
*/
|
|
||||||
public List<CollaborationNode> getChildren() {
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeChild(CollaborationNode child) {
|
|
||||||
if (children.contains(child)) {
|
|
||||||
if (child instanceof CollaborationGroup) {
|
|
||||||
CollaborationGroup groupNode = (CollaborationGroup) child;
|
|
||||||
groupNode.removeChildren();
|
|
||||||
}
|
|
||||||
children.remove(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeChildren() {
|
|
||||||
for (CollaborationNode child : children) {
|
|
||||||
if (child instanceof CollaborationGroup) {
|
|
||||||
CollaborationGroup groupNode = (CollaborationGroup) child;
|
|
||||||
groupNode.removeChildren();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
children.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.raytheon.uf.viz.collaboration.data.CollaborationNode#getImageKey()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getImageKey() {
|
|
||||||
return "group";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -19,6 +19,9 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.collaboration.data;
|
package com.raytheon.uf.viz.collaboration.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
|
@ -28,42 +31,48 @@ package com.raytheon.uf.viz.collaboration.data;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 6, 2012 rferrel Initial creation
|
* Apr 23, 2012 mnash Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author rferrel
|
* @author mnash
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class SessionGroup extends CollaborationGroup {
|
public class CollaborationGroupContainer {
|
||||||
boolean sessionRoot;
|
private List<Object> objects;
|
||||||
|
|
||||||
public SessionGroup(String id) {
|
/**
|
||||||
super(id);
|
|
||||||
this.sessionRoot = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSessionRoot() {
|
|
||||||
return sessionRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSessionRoot(boolean sessionRoot) {
|
|
||||||
this.sessionRoot = sessionRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
*
|
||||||
* @see
|
|
||||||
* com.raytheon.uf.viz.collaboration.data.CollaborationNode#getImageKey()
|
|
||||||
*/
|
*/
|
||||||
@Override
|
public CollaborationGroupContainer() {
|
||||||
public String getImageKey() {
|
objects = new ArrayList<Object>();
|
||||||
return "session_group";
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param objects
|
||||||
|
* the objects to set
|
||||||
|
*/
|
||||||
|
public void setObjects(List<Object> objects) {
|
||||||
|
this.objects = objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the objects
|
||||||
|
*/
|
||||||
|
public List<Object> getObjects() {
|
||||||
|
return objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addObject(Object o) {
|
||||||
|
objects.add(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeObject(Object o) {
|
||||||
|
objects.remove(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
objects.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,99 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
package com.raytheon.uf.viz.collaboration.data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Feb 22, 2012 mnash Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author mnash
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class CollaborationNode implements Comparable<CollaborationNode> {
|
|
||||||
|
|
||||||
private String text;
|
|
||||||
|
|
||||||
private boolean local;
|
|
||||||
|
|
||||||
String id;
|
|
||||||
|
|
||||||
public CollaborationNode(String id) {
|
|
||||||
super();
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImageKey() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the name
|
|
||||||
*/
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
* the name to set
|
|
||||||
*/
|
|
||||||
public void setText(String text) {
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the buddy
|
|
||||||
*/
|
|
||||||
public boolean isLocal() {
|
|
||||||
return local;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param buddy
|
|
||||||
* the buddy to set
|
|
||||||
*/
|
|
||||||
public void setLocal(boolean local) {
|
|
||||||
this.local = local;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int compareTo(CollaborationNode o) {
|
|
||||||
return id.compareTo(o.id);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,118 +0,0 @@
|
||||||
package com.raytheon.uf.viz.collaboration.data;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 1, 2012 rferrel Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author rferrel
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public class CollaborationUser extends CollaborationNode {
|
|
||||||
|
|
||||||
String session;
|
|
||||||
|
|
||||||
UserId iChatID;
|
|
||||||
|
|
||||||
public CollaborationUser(String id) {
|
|
||||||
super(id);
|
|
||||||
this.session = null;
|
|
||||||
// this.roles = new ArrayList<DataUser.RoleType>();
|
|
||||||
// this.status = DataUser.StatusType.NOT_ON_LINE;
|
|
||||||
// this.statusMessage = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public CollaborationUser(String id, String session) {
|
|
||||||
super(id);
|
|
||||||
this.session = session;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.raytheon.uf.viz.collaboration.data.CollaborationNode#getImageKey()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getImageKey() {
|
|
||||||
if (getType() == Type.AVAILABLE) {
|
|
||||||
return getMode().toString();
|
|
||||||
}
|
|
||||||
return "contact_disabled";
|
|
||||||
}
|
|
||||||
|
|
||||||
public IPresence.Mode getMode() {
|
|
||||||
return CollaborationDataManager.getInstance().getUser(id).mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IPresence.Type getType() {
|
|
||||||
return CollaborationDataManager.getInstance().getUser(id).type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPresence(IPresence presence) {
|
|
||||||
CollaborationDataManager.getInstance().getUser(id)
|
|
||||||
.setPresence(presence);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void setMode(IPresence.Mode mode) {
|
|
||||||
// CollaborationDataManager.getInstance().getUser(id).mode = mode;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setType(IPresence.Type type) {
|
|
||||||
// CollaborationDataManager.getInstance().getUser(id).type = type;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public void setStatus(IPresence.Mode mode) {
|
|
||||||
// if (mode.getMode().equals(Mode.AWAY)) {
|
|
||||||
// CollaborationDataManager.getInstance().getUser(id).mode =
|
|
||||||
// StatusType.AWAY;
|
|
||||||
// } else if (mode.getMode().equals(Mode.DND)) {
|
|
||||||
// CollaborationDataManager.getInstance().getUser(id).mode =
|
|
||||||
// StatusType.DO_NOT_DISTURB;
|
|
||||||
// } else if (mode.getMode().equals(Mode.AVAILABLE)) {
|
|
||||||
// CollaborationDataManager.getInstance().getUser(id).mode =
|
|
||||||
// StatusType.AVAILABLE;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public String getStatusMessage() {
|
|
||||||
return CollaborationDataManager.getInstance().getUser(id).statusMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void setStatusMessage(String statusMessage) {
|
|
||||||
// CollaborationDataManager.getInstance().getUser(id).statusMessage =
|
|
||||||
// statusMessage;
|
|
||||||
// }
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
package com.raytheon.uf.viz.collaboration.data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 1, 2012 rferrel Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author rferrel
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public class DataGroup {
|
|
||||||
/**
|
|
||||||
* The fully qualified group name. When a subgroup the name should contain
|
|
||||||
* all the groups ancestors. For example if "C" is a subgroup of "B" which
|
|
||||||
* is a subgroup of "A" then C's id would be "A.B.C".
|
|
||||||
*/
|
|
||||||
String id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the user wants to display the groups information.
|
|
||||||
*/
|
|
||||||
boolean display;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only allow classes in the package to use the constructor.
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
DataGroup(String id) {
|
|
||||||
this.id = id;
|
|
||||||
this.display = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return display
|
|
||||||
*/
|
|
||||||
public boolean isDisplay() {
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDisplay(boolean display) {
|
|
||||||
this.display = display;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,136 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
package com.raytheon.uf.viz.collaboration.data;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
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.IPresence.Type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Data class that contains all the user information needed for the current
|
|
||||||
* instance of CAVE.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 1, 2012 rferrel Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author rferrel
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class DataUser {
|
|
||||||
private static final Map<String, IPresence.Mode> modeMap = new HashMap<String, IPresence.Mode>();
|
|
||||||
static {
|
|
||||||
for (Mode mode : Mode.values()) {
|
|
||||||
modeMap.put(mode.name(), mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IPresence.Mode mode;
|
|
||||||
|
|
||||||
IPresence.Type type;
|
|
||||||
|
|
||||||
String statusMessage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The groups being tracked that user belongs to.
|
|
||||||
*/
|
|
||||||
Set<String> groups;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The active sessions the user is in.
|
|
||||||
*/
|
|
||||||
private Map<String, String> sessionsMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only allow classes in the package to use the constructor.
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
DataUser(String id) {
|
|
||||||
groups = new HashSet<String>();
|
|
||||||
sessionsMap = new HashMap<String, String>();
|
|
||||||
mode = Mode.EXTENDED_AWAY;
|
|
||||||
type = Type.UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addGroup(String group) {
|
|
||||||
groups.add(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getGroups() {
|
|
||||||
return groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearGroups() {
|
|
||||||
groups.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSessString(String key) {
|
|
||||||
return sessionsMap.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPresence(IPresence presence) {
|
|
||||||
type = presence.getType();
|
|
||||||
mode = presence.getMode();
|
|
||||||
statusMessage = presence.getStatusMessage();
|
|
||||||
if (statusMessage == null) {
|
|
||||||
statusMessage = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @param mode
|
|
||||||
// * the mode to set
|
|
||||||
// */
|
|
||||||
// public void setMode(Mode status) {
|
|
||||||
// this.mode = status;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setMode(String name) {
|
|
||||||
// this.mode = modeMap.get(name);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the mode
|
|
||||||
*/
|
|
||||||
public Mode getMode() {
|
|
||||||
return mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void setType(Type type) {
|
|
||||||
// this.type = type;
|
|
||||||
// }
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
package com.raytheon.uf.viz.collaboration.data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A special group to places users not in any group.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Apr 11, 2012 rferrel Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author rferrel
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class OrphanGroup extends CollaborationGroup {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
public OrphanGroup(String id) {
|
|
||||||
super(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -36,8 +36,6 @@ package com.raytheon.uf.viz.collaboration.data;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class LoginUser extends CollaborationUser {
|
public class SessionGroupContainer extends CollaborationGroupContainer {
|
||||||
public LoginUser(String id) {
|
|
||||||
super(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -37,6 +37,7 @@ import org.eclipse.swt.widgets.MessageBox;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ public class ChangePasswordDialog extends CaveSWTDialog {
|
||||||
private Control createDialogArea(Composite parent) {
|
private Control createDialogArea(Composite parent) {
|
||||||
CollaborationDataManager manager = CollaborationDataManager
|
CollaborationDataManager manager = CollaborationDataManager
|
||||||
.getInstance();
|
.getInstance();
|
||||||
String user = manager.getLoginId();
|
UserId user = manager.getLoginId();
|
||||||
Composite body = new Composite(parent, SWT.NONE);
|
Composite body = new Composite(parent, SWT.NONE);
|
||||||
body.setLayout(new GridLayout(2, false));
|
body.setLayout(new GridLayout(2, false));
|
||||||
// body.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
|
// body.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
|
||||||
|
@ -83,7 +84,7 @@ public class ChangePasswordDialog extends CaveSWTDialog {
|
||||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
userLabel.setLayoutData(gd);
|
userLabel.setLayoutData(gd);
|
||||||
userLabel.setText(user);
|
userLabel.setText(user.getFQName());
|
||||||
|
|
||||||
label = new Label(body, SWT.NONE);
|
label = new Label(body, SWT.NONE);
|
||||||
label.setText("New Password: ");
|
label.setText("New Password: ");
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,10 +28,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
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;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
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.provider.Tools;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
|
||||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,44 +78,9 @@ public class CollaborationUtils {
|
||||||
* @param node
|
* @param node
|
||||||
* @return image
|
* @return image
|
||||||
*/
|
*/
|
||||||
public static Image getNodeImage(CollaborationNode node) {
|
public static Image getNodeImage(String name) {
|
||||||
String name = node.getImageKey().toLowerCase() + ".gif";
|
|
||||||
return IconUtil.getImageDescriptor(Activator.getDefault().getBundle(),
|
return IconUtil.getImageDescriptor(Activator.getDefault().getBundle(),
|
||||||
name).createImage();
|
name.toLowerCase() + ".gif").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) {
|
|
||||||
UserId 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(UserId participant) {
|
|
||||||
StringBuilder sb = new StringBuilder(participant.getName());
|
|
||||||
sb.append(Tools.NAME_DELIM);
|
|
||||||
int start = sb.length();
|
|
||||||
|
|
||||||
String host = participant.getHost();
|
|
||||||
|
|
||||||
sb.append(host);
|
|
||||||
if (host.startsWith(PREFIX_CONFERENCE)) {
|
|
||||||
sb.replace(start, start + PREFIX_CONFERENCE.length(), "");
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendChatMessage(List<String> ids, String message) {
|
public static void sendChatMessage(List<String> ids, String message) {
|
||||||
|
|
|
@ -325,7 +325,7 @@ public class CreateSessionDialog extends CaveSWTDialog {
|
||||||
err = "Name contains invalid characters.";
|
err = "Name contains invalid characters.";
|
||||||
} else {
|
} else {
|
||||||
Collection<IVenueInfo> info = CollaborationDataManager
|
Collection<IVenueInfo> info = CollaborationDataManager
|
||||||
.getInstance().getSessionManager().getVenueInfo();
|
.getInstance().getCollaborationConnection().getVenueInfo();
|
||||||
for (IVenueInfo i : info) {
|
for (IVenueInfo i : info) {
|
||||||
if (name.equals(i.getVenueName())) {
|
if (name.equals(i.getVenueName())) {
|
||||||
err = "Session already exists. Pick a different name.";
|
err = "Session already exists. Pick a different name.";
|
||||||
|
|
|
@ -23,7 +23,9 @@ package com.raytheon.uf.viz.collaboration.ui;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||||
|
import com.raytheon.uf.viz.collaboration.data.CollaborationGroupContainer;
|
||||||
|
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
@ -42,12 +44,6 @@ import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class UsersTreeContentProvider implements ITreeContentProvider {
|
public class UsersTreeContentProvider implements ITreeContentProvider {
|
||||||
// UsersTree rootNode;
|
|
||||||
//
|
|
||||||
// public UsersTreeContentProvider(UsersTree rootNode) {
|
|
||||||
// this.rootNode = rootNode;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -80,19 +76,22 @@ public class UsersTreeContentProvider implements ITreeContentProvider {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
// if (rootNode != null) {
|
if (inputElement instanceof IRosterGroup) {
|
||||||
// if (rootNode.getChildren() != null) {
|
IRosterGroup group = (IRosterGroup) inputElement;
|
||||||
// return rootNode.getChildren().toArray();
|
if (group.getEntries() != null) {
|
||||||
// }
|
return group.getEntries().toArray();
|
||||||
// }
|
} else {
|
||||||
// return new Object[0];
|
return new Object[0];
|
||||||
CollaborationGroup group = (CollaborationGroup) inputElement;
|
}
|
||||||
if (group.getChildren() != null) {
|
} else if (inputElement instanceof SessionGroupContainer) {
|
||||||
return group.getChildren().toArray();
|
SessionGroupContainer group = (SessionGroupContainer) inputElement;
|
||||||
|
return group.getObjects().toArray();
|
||||||
|
} else if (inputElement instanceof CollaborationGroupContainer) {
|
||||||
|
CollaborationGroupContainer cont = (CollaborationGroupContainer) inputElement;
|
||||||
|
return cont.getObjects().toArray();
|
||||||
} else {
|
} else {
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -104,18 +103,16 @@ public class UsersTreeContentProvider implements ITreeContentProvider {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object[] getChildren(Object parentElement) {
|
public Object[] getChildren(Object parentElement) {
|
||||||
// if (parentElement instanceof UsersTree) {
|
// the only things that can have children are the sessions item or the
|
||||||
// UsersTree parent = (UsersTree) parentElement;
|
// groups items
|
||||||
// List<UsersTree> children = parent.getChildren();
|
if (parentElement instanceof SessionGroupContainer) {
|
||||||
// if (children != null) {
|
SessionGroupContainer cont = (SessionGroupContainer) parentElement;
|
||||||
// return children.toArray();
|
return cont.getObjects().toArray();
|
||||||
// } else {
|
} else if (parentElement instanceof IRosterGroup) {
|
||||||
// return new Object[0];
|
IRosterGroup group = (IRosterGroup) parentElement;
|
||||||
// }
|
return group.getEntries().toArray();
|
||||||
// }
|
}
|
||||||
// return null;
|
return null;
|
||||||
CollaborationGroup group = (CollaborationGroup) parentElement;
|
|
||||||
return group.getChildren().toArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -140,25 +137,22 @@ public class UsersTreeContentProvider implements ITreeContentProvider {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
// if (element instanceof UsersTree) {
|
if (element instanceof IRosterGroup) {
|
||||||
// UsersTree elem = (UsersTree) element;
|
IRosterGroup group = (IRosterGroup) element;
|
||||||
// return elem.hasChildren();
|
if (group.getEntries().size() <= 0) {
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
if (element instanceof CollaborationGroup) {
|
|
||||||
CollaborationGroup group = (CollaborationGroup) element;
|
|
||||||
if (group.getChildren().size() <= 0) {
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else if (element instanceof SessionGroupContainer) {
|
||||||
|
SessionGroupContainer cont = (SessionGroupContainer) element;
|
||||||
|
if (cont.getObjects() != null && cont.getObjects().size() > 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Object findItem(String text) {
|
|
||||||
// UsersTree item = rootNode.findChildByText(text);
|
|
||||||
// return item;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,13 @@ import org.eclipse.swt.graphics.Font;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||||
import com.raytheon.uf.viz.collaboration.data.SessionGroup;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
|
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||||
|
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
@ -78,11 +82,13 @@ public class UsersTreeLabelProvider implements ITableLabelProvider,
|
||||||
for (String key : imageMap.keySet()) {
|
for (String key : imageMap.keySet()) {
|
||||||
imageMap.get(key).dispose();
|
imageMap.get(key).dispose();
|
||||||
}
|
}
|
||||||
|
if (boldFont != null && !boldFont.isDisposed()) {
|
||||||
|
boldFont.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLabelProperty(Object element, String property) {
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,30 +102,55 @@ public class UsersTreeLabelProvider implements ITableLabelProvider,
|
||||||
if (Activator.getDefault() == null) {
|
if (Activator.getDefault() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Image image = null;
|
String key = "";
|
||||||
if (element instanceof CollaborationNode) {
|
if (element instanceof UserId) {
|
||||||
CollaborationNode node = (CollaborationNode) element;
|
String mode = CollaborationDataManager.getInstance()
|
||||||
String key = node.getImageKey();
|
.getCollaborationConnection().getPresence().getMode()
|
||||||
if (key != null) {
|
.toString();
|
||||||
image = imageMap.get(key);
|
key = mode;
|
||||||
if (image == null) {
|
} else if (element instanceof IRosterEntry) {
|
||||||
image = CollaborationUtils.getNodeImage(node);
|
IRosterEntry entry = (IRosterEntry) element;
|
||||||
if (image != null) {
|
if (entry.getPresence().getType() == Type.AVAILABLE) {
|
||||||
imageMap.put(key, image);
|
key = entry.getPresence().getMode().toString();
|
||||||
}
|
} else {
|
||||||
}
|
key = "contact_disabled";
|
||||||
}
|
}
|
||||||
|
} else if (element instanceof IRosterGroup) {
|
||||||
|
key = "group";
|
||||||
|
} else if (element instanceof IVenueSession) {
|
||||||
|
// key = "session_group";
|
||||||
|
} else if (element instanceof SessionGroupContainer) {
|
||||||
|
key = "session_group";
|
||||||
}
|
}
|
||||||
return image;
|
|
||||||
|
if (imageMap.get(key) == null && !key.equals("")) {
|
||||||
|
imageMap.put(key, CollaborationUtils.getNodeImage(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
return imageMap.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColumnText(Object element, int index) {
|
public String getColumnText(Object element, int index) {
|
||||||
CollaborationNode elem = (CollaborationNode) element;
|
if (element instanceof IRosterEntry) {
|
||||||
if (elem.getText() == null) {
|
IRosterEntry entry = (IRosterEntry) element;
|
||||||
return elem.getId();
|
if (entry.getUser().getAlias() == null) {
|
||||||
|
return entry.getUser().getName();
|
||||||
|
} else {
|
||||||
|
return entry.getUser().getAlias();
|
||||||
|
}
|
||||||
|
} else if (element instanceof IRosterGroup) {
|
||||||
|
return ((IRosterGroup) element).getName();
|
||||||
|
} else if (element instanceof SessionGroupContainer) {
|
||||||
|
return "Active Sessions";
|
||||||
|
} else if (element instanceof UserId) {
|
||||||
|
return ((UserId) element).getName() + " - "
|
||||||
|
+ ((UserId) element).getHost();
|
||||||
|
} else if (element instanceof IVenueSession) {
|
||||||
|
return ((IVenueSession) element).getVenue().getInfo()
|
||||||
|
.getVenueDescription();
|
||||||
}
|
}
|
||||||
return elem.getText();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -157,20 +188,16 @@ public class UsersTreeLabelProvider implements ITableLabelProvider,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Font getFont(Object element, int columnIndex) {
|
public Font getFont(Object element, int columnIndex) {
|
||||||
if (element instanceof CollaborationGroup) {
|
if (element instanceof IRosterGroup
|
||||||
if (element instanceof SessionGroup
|
|| element instanceof SessionGroupContainer) {
|
||||||
&& !((SessionGroup) element).isSessionRoot()) {
|
// for this case do nothing, as it is not the top level of
|
||||||
// for this case do nothing, as it is not the top level of
|
// session groups
|
||||||
// session groups
|
if (boldFont == null) {
|
||||||
} else {
|
Font currFont = Display.getCurrent().getSystemFont();
|
||||||
if (boldFont == null) {
|
boldFont = new Font(Display.getCurrent(), currFont.toString(),
|
||||||
Font currFont = Display.getCurrent().getSystemFont();
|
currFont.getFontData()[0].getHeight(), SWT.BOLD);
|
||||||
boldFont = new Font(Display.getCurrent(),
|
|
||||||
currFont.toString(),
|
|
||||||
currFont.getFontData()[0].getHeight(), SWT.BOLD);
|
|
||||||
}
|
|
||||||
return boldFont;
|
|
||||||
}
|
}
|
||||||
|
return boldFont;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,10 @@ package com.raytheon.uf.viz.collaboration.ui;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.jface.viewers.ViewerSorter;
|
import org.eclipse.jface.viewers.ViewerSorter;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
|
||||||
import com.raytheon.uf.viz.collaboration.data.LoginUser;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
import com.raytheon.uf.viz.collaboration.data.OrphanGroup;
|
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||||
import com.raytheon.uf.viz.collaboration.data.SessionGroup;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
@ -54,40 +53,34 @@ public class UsersTreeViewerSorter extends ViewerSorter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make login user top node
|
// Make login user top node
|
||||||
if (e1 instanceof LoginUser) {
|
if (e1 instanceof UserId) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (e2 instanceof LoginUser) {
|
|
||||||
|
if (e2 instanceof UserId) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// session group before all other types but login user.
|
// session group before all other types but login user.
|
||||||
if (e1 instanceof SessionGroup) {
|
if (e1 instanceof SessionGroupContainer) {
|
||||||
if ((e2 instanceof SessionGroup) == false) {
|
if ((e2 instanceof SessionGroupContainer) == false) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (e2 instanceof SessionGroup) {
|
} else if (e2 instanceof SessionGroupContainer) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OrpahGroup always at the bottom
|
|
||||||
if (e1 instanceof OrphanGroup) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (e2 instanceof OrphanGroup) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Groups before users.
|
// Groups before users.
|
||||||
if (e1 instanceof CollaborationGroup) {
|
if (e1 instanceof IRosterGroup) {
|
||||||
if (!(e2 instanceof CollaborationGroup)) {
|
if (!(e2 instanceof IRosterGroup)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (e1 instanceof CollaborationGroup) {
|
} else if (e1 instanceof IRosterGroup) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Either both are groups or both are users.
|
// Either both are groups or both are users.
|
||||||
return ((CollaborationNode) e1).compareTo((CollaborationNode) e2);
|
return ((IRosterItem) e1).getName().compareTo(
|
||||||
|
((IRosterItem) e2).getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class ChangeStatusDialog extends CaveSWTDialog {
|
||||||
super.preOpened();
|
super.preOpened();
|
||||||
LoginData loginData = CollaborationDataManager.getInstance()
|
LoginData loginData = CollaborationDataManager.getInstance()
|
||||||
.getLoginData();
|
.getLoginData();
|
||||||
userLabel.setText(loginData.getAccount());
|
userLabel.setText(loginData.getAccount().getFQName());
|
||||||
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||||
.getMode()));
|
.getMode()));
|
||||||
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||||
|
|
|
@ -7,6 +7,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
@ -94,8 +95,8 @@ public class LoginData implements ISerializableObject {
|
||||||
return modeMessage;
|
return modeMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccount() {
|
public UserId getAccount() {
|
||||||
return user + "@" + server;
|
return new UserId(user, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUser(String user) {
|
public void setUser(String user) {
|
||||||
|
|
|
@ -56,8 +56,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterEventSubscriber;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterEventSubscriber;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
|
||||||
import com.raytheon.uf.viz.collaboration.data.DataUser;
|
|
||||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
@ -378,18 +376,12 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
// .getSelectionIndex()], messageTF
|
// .getSelectionIndex()], messageTF
|
||||||
// .getText().trim());
|
// .getText().trim());
|
||||||
try {
|
try {
|
||||||
sessionManager = new CollaborationConnection(loginData
|
sessionManager = new CollaborationConnection(
|
||||||
.getAccount(), loginData.getPassword(),
|
loginData.getAccount(), loginData
|
||||||
|
.getPassword(),
|
||||||
rosterEventSubscriber);
|
rosterEventSubscriber);
|
||||||
DataUser dUser = CollaborationDataManager
|
|
||||||
.getInstance().getUser(
|
|
||||||
loginData.getAccount());
|
|
||||||
// // TODO set mode and message here.
|
|
||||||
// dUser.setMode(loginData.getMode());
|
|
||||||
// dUser.type = Type.AVAILABLE;
|
|
||||||
// dUser.statusMessage = loginData.getModeMessage();
|
|
||||||
setReturnValue(loginData);
|
setReturnValue(loginData);
|
||||||
LoginDialog.this.getShell().dispose();
|
close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (focusField == null) {
|
if (focusField == null) {
|
||||||
focusField = passwordTF;
|
focusField = passwordTF;
|
||||||
|
|
|
@ -85,14 +85,10 @@ public abstract class AbstractSessionView extends ViewPart implements
|
||||||
|
|
||||||
private StyledText composeText;
|
private StyledText composeText;
|
||||||
|
|
||||||
// protected Action chatAction;
|
|
||||||
|
|
||||||
protected abstract String getSessionImageName();
|
protected abstract String getSessionImageName();
|
||||||
|
|
||||||
protected abstract String getSessionName();
|
protected abstract String getSessionName();
|
||||||
|
|
||||||
// protected abstract void populateSashForm(SashForm sashForm);
|
|
||||||
|
|
||||||
public abstract void sendMessage();
|
public abstract void sendMessage();
|
||||||
|
|
||||||
protected abstract void setMessageLabel(Composite comp);
|
protected abstract void setMessageLabel(Composite comp);
|
||||||
|
@ -142,7 +138,6 @@ public abstract class AbstractSessionView extends ViewPart implements
|
||||||
Composite messagesComp = new Composite(parent, SWT.NONE);
|
Composite messagesComp = new Composite(parent, SWT.NONE);
|
||||||
GridLayout layout = new GridLayout(1, false);
|
GridLayout layout = new GridLayout(1, false);
|
||||||
messagesComp.setLayout(layout);
|
messagesComp.setLayout(layout);
|
||||||
// TODO, wrap label in view
|
|
||||||
setMessageLabel(messagesComp);
|
setMessageLabel(messagesComp);
|
||||||
messagesText = new StyledText(messagesComp, SWT.MULTI | SWT.WRAP
|
messagesText = new StyledText(messagesComp, SWT.MULTI | SWT.WRAP
|
||||||
| SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
|
| SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
|
||||||
|
@ -216,23 +211,21 @@ public abstract class AbstractSessionView extends ViewPart implements
|
||||||
*/
|
*/
|
||||||
public void appendMessage(IMessage message) {
|
public void appendMessage(IMessage message) {
|
||||||
UserId userId = (UserId) message.getFrom();
|
UserId userId = (UserId) message.getFrom();
|
||||||
String name = message.getFrom().getName();
|
|
||||||
long timestamp = message.getTimeStamp();
|
long timestamp = message.getTimeStamp();
|
||||||
String body = message.getBody();
|
String body = message.getBody();
|
||||||
appendMessage(userId, name, timestamp, body);
|
appendMessage(userId, timestamp, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void appendMessage(UserId userId, String name, long timestamp,
|
public void appendMessage(UserId userId, long timestamp, String body) {
|
||||||
String body) {
|
|
||||||
IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) getSite()
|
IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) getSite()
|
||||||
.getAdapter(IWorkbenchSiteProgressService.class);
|
.getAdapter(IWorkbenchSiteProgressService.class);
|
||||||
service.warnOfContentChange();
|
service.warnOfContentChange();
|
||||||
|
|
||||||
// String fqName = message.getFrom().getFQName();
|
String name = null;
|
||||||
// String name = message.getFrom().getName();
|
if (userId.getAlias() == null || userId.getAlias().isEmpty()) {
|
||||||
if (name == null) {
|
name = userId.getName();
|
||||||
name = userId.getFQName().substring(0,
|
} else {
|
||||||
userId.getFQName().indexOf("@"));
|
name = userId.getAlias();
|
||||||
}
|
}
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.setTimeInMillis(timestamp);
|
cal.setTimeInMillis(timestamp);
|
||||||
|
|
|
@ -41,12 +41,11 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
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.IVenueSession;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
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.SharedDisplayRole;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
@ -98,9 +97,9 @@ public class CollaborationSessionView extends SessionView {
|
||||||
public void run() {
|
public void run() {
|
||||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||||
.getSelection();
|
.getSelection();
|
||||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
IRosterEntry selectedUser = (IRosterEntry) selection
|
||||||
.getFirstElement();
|
.getFirstElement();
|
||||||
switchLeader(selectedUser.getId());
|
switchLeader(selectedUser.getUser());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ActionContributionItem leaderItem = new ActionContributionItem(
|
ActionContributionItem leaderItem = new ActionContributionItem(
|
||||||
|
@ -113,9 +112,9 @@ public class CollaborationSessionView extends SessionView {
|
||||||
public void run() {
|
public void run() {
|
||||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||||
.getSelection();
|
.getSelection();
|
||||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
IRosterEntry selectedUser = (IRosterEntry) selection
|
||||||
.getFirstElement();
|
.getFirstElement();
|
||||||
switchDataProvider(selectedUser.getId());
|
switchDataProvider(selectedUser.getUser());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ActionContributionItem dataProviderItem = new ActionContributionItem(
|
ActionContributionItem dataProviderItem = new ActionContributionItem(
|
||||||
|
@ -138,20 +137,20 @@ public class CollaborationSessionView extends SessionView {
|
||||||
switchToAction.setMenuCreator(creator);
|
switchToAction.setMenuCreator(creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchDataProvider(String fqname) {
|
private void switchDataProvider(UserId userId) {
|
||||||
System.out.println("Send switchDataProvider request. " + fqname);
|
System.out.println("Send switchDataProvider request. "
|
||||||
|
+ userId.getFQName());
|
||||||
// TODO need to send invite/request for transfer, and then if successful
|
// TODO need to send invite/request for transfer, and then if successful
|
||||||
// deactivate the local ones since we won't receive the message
|
// deactivate the local ones since we won't receive the message
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchLeader(String fqname) {
|
private void switchLeader(UserId userId) {
|
||||||
System.out.println("Send switchLeader request. " + fqname);
|
System.out.println("Send switchLeader request. " + userId.getFQName());
|
||||||
// TODO need to send invite/request for transfer, and then if successful
|
// TODO need to send invite/request for transfer, and then if successful
|
||||||
// deactivate the local ones since we won't receive the message
|
// deactivate the local ones since we won't receive the message
|
||||||
TransferRoleCommand trc = new TransferRoleCommand();
|
TransferRoleCommand trc = new TransferRoleCommand();
|
||||||
UserId vp = new UserId(Tools.parseName(fqname), Tools.parseHost(fqname));
|
trc.setUser(userId);
|
||||||
trc.setUser(vp);
|
session.setCurrentSessionLeader(userId);
|
||||||
session.setCurrentSessionLeader(vp);
|
|
||||||
trc.setRole(SharedDisplayRole.SESSION_LEADER);
|
trc.setRole(SharedDisplayRole.SESSION_LEADER);
|
||||||
try {
|
try {
|
||||||
session.sendObjectToVenue(trc);
|
session.sendObjectToVenue(trc);
|
||||||
|
@ -167,14 +166,14 @@ public class CollaborationSessionView extends SessionView {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String buildParticipantTooltip(CollaborationUser user) {
|
protected String buildParticipantTooltip(IRosterEntry user) {
|
||||||
StringBuilder builder = new StringBuilder(
|
StringBuilder builder = new StringBuilder(
|
||||||
super.buildParticipantTooltip(user));
|
super.buildParticipantTooltip(user));
|
||||||
// TODO these should be smarter ifs
|
// TODO these should be smarter ifs
|
||||||
boolean isSessionLeader = Tools.parseName(user.getId()).equals(
|
boolean isSessionLeader = user.getUser().equals(
|
||||||
session.getCurrentSessionLeader().getName());
|
session.getCurrentSessionLeader());
|
||||||
boolean isDataProvider = Tools.parseName(user.getId()).equals(
|
boolean isDataProvider = user.getUser().equals(
|
||||||
session.getCurrentDataProvider().getName());
|
session.getCurrentDataProvider());
|
||||||
if (isSessionLeader || isDataProvider) {
|
if (isSessionLeader || isDataProvider) {
|
||||||
builder.append("\n-- Roles --");
|
builder.append("\n-- Roles --");
|
||||||
if (isSessionLeader) {
|
if (isSessionLeader) {
|
||||||
|
@ -219,9 +218,8 @@ public class CollaborationSessionView extends SessionView {
|
||||||
try {
|
try {
|
||||||
((IVenueSession) session).sendChatMessage(message);
|
((IVenueSession) session).sendChatMessage(message);
|
||||||
} catch (CollaborationException e) {
|
} catch (CollaborationException e) {
|
||||||
// TODO Auto-generated catch block. Please revise as
|
statusHandler.handle(Priority.ERROR,
|
||||||
// appropriate.
|
"Unable to send chat message", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,10 +238,9 @@ public class CollaborationSessionView extends SessionView {
|
||||||
|| session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
|| session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
||||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||||
.getSelection();
|
.getSelection();
|
||||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
IRosterEntry selectedUser = (IRosterEntry) selection
|
||||||
.getFirstElement();
|
.getFirstElement();
|
||||||
String selectedUserName = Tools.parseName(selectedUser.getId());
|
if (!selectedUser.getUser().equals(session.getUserID())) {
|
||||||
if (!selectedUserName.equals(session.getUserID().getName())) {
|
|
||||||
manager.add(switchToAction);
|
manager.add(switchToAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,9 @@ import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
|
||||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||||
|
|
||||||
|
@ -111,13 +111,13 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CollaborationUser user = (CollaborationUser) element;
|
IRosterEntry user = (IRosterEntry) element;
|
||||||
Image image = null;
|
Image image = null;
|
||||||
String key = user.getImageKey();
|
String key = user.getPresence().getMode().toString();
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
image = imageMap.get(key);
|
image = imageMap.get(key);
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
image = CollaborationUtils.getNodeImage(user);
|
image = CollaborationUtils.getNodeImage(key);
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
imageMap.put(key, image);
|
imageMap.put(key, image);
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,8 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColumnText(Object element, int columnIndex) {
|
public String getColumnText(Object element, int columnIndex) {
|
||||||
CollaborationUser user = (CollaborationUser) element;
|
IRosterEntry user = (IRosterEntry) element;
|
||||||
return user.getText();
|
return user.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -143,20 +143,9 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
||||||
if (colors == null) {
|
if (colors == null) {
|
||||||
colors = new HashMap<UserId, Color>();
|
colors = new HashMap<UserId, Color>();
|
||||||
}
|
}
|
||||||
// String host = ((CollaborationUser) element).
|
UserId userId = ((IRosterEntry) element).getUser();
|
||||||
String id = ((CollaborationUser) element).getId();
|
|
||||||
String[] uid = null;
|
|
||||||
if (id != null) {
|
|
||||||
uid = ((CollaborationUser) element).getId().split("@");
|
|
||||||
}
|
|
||||||
UserId userId = new UserId(uid[0], uid[1]);
|
|
||||||
RGB color = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
RGB color = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||||
.getColorManager().getColors().get(userId);
|
.getColorManager().getColors().get(userId);
|
||||||
if (color == null) {
|
|
||||||
userId.setHost("conference." + uid[1]);
|
|
||||||
color = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
|
||||||
.getColorManager().getColors().get(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add to map so we can dispose
|
// add to map so we can dispose
|
||||||
if (color == null) {
|
if (color == null) {
|
||||||
|
|
|
@ -22,7 +22,6 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.SashForm;
|
import org.eclipse.swt.custom.SashForm;
|
||||||
import org.eclipse.swt.custom.StyleRange;
|
import org.eclipse.swt.custom.StyleRange;
|
||||||
|
@ -89,71 +88,6 @@ public class PeerToPeerView extends AbstractSessionView {
|
||||||
sashForm.setWeights(new int[] { 20, 5 });
|
sashForm.setWeights(new int[] { 20, 5 });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createActions() {
|
|
||||||
// TODO create peer-to-peer chat action here
|
|
||||||
// chatAction = new Action("Chat") {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// try {
|
|
||||||
// CollaborationDataManager dataManager = CollaborationDataManager
|
|
||||||
// .getInstance();
|
|
||||||
// CollaborationUser user = (CollaborationUser) ((IStructuredSelection)
|
|
||||||
// usersTable
|
|
||||||
// .getSelection()).getFirstElement();
|
|
||||||
// String session = dataManager.createCollaborationSession(
|
|
||||||
// user.getId(), "Chatting...");
|
|
||||||
// PlatformUI
|
|
||||||
// .getWorkbench()
|
|
||||||
// .getActiveWorkbenchWindow()
|
|
||||||
// .getActivePage()
|
|
||||||
// .showView(CollaborationSessionView.ID, session,
|
|
||||||
// IWorkbenchPage.VIEW_ACTIVATE);
|
|
||||||
// // }
|
|
||||||
// } catch (PartInitException e) {
|
|
||||||
// statusHandler.handle(Priority.PROBLEM,
|
|
||||||
// "Unable to open chat", e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
// private void createContextMenu() {
|
|
||||||
// MenuManager menuManager = new MenuManager();
|
|
||||||
// menuManager.setRemoveAllWhenShown(true);
|
|
||||||
// menuManager.addMenuListener(new IMenuListener() {
|
|
||||||
// /*
|
|
||||||
// * (non-Javadoc)
|
|
||||||
// *
|
|
||||||
// * @see
|
|
||||||
// * org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse
|
|
||||||
// * .jface.action.IMenuManager)
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// public void menuAboutToShow(IMenuManager manager) {
|
|
||||||
// fillContextMenu(manager);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// // Menu menu = menuManager.createContextMenu(usersTable.getControl());
|
|
||||||
// // usersTable.getControl().setMenu(menu);
|
|
||||||
// // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
|
|
||||||
// // .getActivePart().getSite()
|
|
||||||
// // .registerContextMenu(menuManager, usersTable);
|
|
||||||
// // usersTable.getTable().setMenu(menu);
|
|
||||||
// }
|
|
||||||
|
|
||||||
protected void fillContextMenu(IMenuManager manager) {
|
|
||||||
// IStructuredSelection selection = (IStructuredSelection) usersTable
|
|
||||||
// .getSelection();
|
|
||||||
// do something here!
|
|
||||||
// Object ob = selection.getFirstElement();
|
|
||||||
// System.out.println(ob.toString());
|
|
||||||
// manager.add(chatAction);
|
|
||||||
// manager.add(new Separator());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -178,16 +112,14 @@ public class PeerToPeerView extends AbstractSessionView {
|
||||||
try {
|
try {
|
||||||
CollaborationDataManager manager = CollaborationDataManager
|
CollaborationDataManager manager = CollaborationDataManager
|
||||||
.getInstance();
|
.getInstance();
|
||||||
IPeerToPeer p2p = (IPeerToPeer) manager.getSessionManager()
|
IPeerToPeer p2p = (IPeerToPeer) manager
|
||||||
.getPeerToPeerSession();
|
.getCollaborationConnection().getPeerToPeerSession();
|
||||||
p2p.sendPeerToPeer(peer, message);
|
p2p.sendPeerToPeer(peer, message);
|
||||||
appendMessage((UserId) peer, manager.getLoginId(),
|
appendMessage(manager.getLoginId(), System.currentTimeMillis(),
|
||||||
System.currentTimeMillis(), message);
|
message);
|
||||||
} catch (CollaborationException e) {
|
} catch (CollaborationException e) {
|
||||||
// TODO Auto-generated catch block. Please revise as
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
// appropriate.
|
"Unable to send message to " + peer.getName(), e);
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
|
||||||
e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,11 +127,10 @@ public class PeerToPeerView extends AbstractSessionView {
|
||||||
protected void styleAndAppendText(StringBuilder sb, int offset,
|
protected void styleAndAppendText(StringBuilder sb, int offset,
|
||||||
String name, UserId userId, List<StyleRange> ranges) {
|
String name, UserId userId, List<StyleRange> ranges) {
|
||||||
Color color = null;
|
Color color = null;
|
||||||
if (!userId.getFQName().equals(
|
if (!userId.equals(CollaborationDataManager.getInstance().getLoginId())) {
|
||||||
CollaborationDataManager.getInstance().getLoginId())) {
|
|
||||||
color = userColor;
|
|
||||||
} else {
|
|
||||||
color = chatterColor;
|
color = chatterColor;
|
||||||
|
} else {
|
||||||
|
color = userColor;
|
||||||
}
|
}
|
||||||
StyleRange range = new StyleRange(messagesText.getCharCount(), offset,
|
StyleRange range = new StyleRange(messagesText.getCharCount(), offset,
|
||||||
color, null, SWT.NORMAL);
|
color, null, SWT.NORMAL);
|
||||||
|
|
|
@ -64,21 +64,16 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
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.IPresence.Type;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
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.roster.IRosterEntry;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
|
||||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
|
||||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
|
|
||||||
|
@ -156,7 +151,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
CollaborationConnection sessionManager = CollaborationDataManager
|
CollaborationConnection sessionManager = CollaborationDataManager
|
||||||
.getInstance().getSessionManager();
|
.getInstance().getCollaborationConnection();
|
||||||
ISession session = sessionManager.getPeerToPeerSession();
|
ISession session = sessionManager.getPeerToPeerSession();
|
||||||
// TODO this doesn't seem right to use the session's
|
// TODO this doesn't seem right to use the session's
|
||||||
// sessionId
|
// sessionId
|
||||||
|
@ -346,9 +341,10 @@ public class SessionView extends AbstractSessionView {
|
||||||
usersTable.setLabelProvider(labelProvider);
|
usersTable.setLabelProvider(labelProvider);
|
||||||
usersTable.setSorter(new ViewerSorter() {
|
usersTable.setSorter(new ViewerSorter() {
|
||||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||||
CollaborationUser c1 = (CollaborationUser) e1;
|
IRosterEntry c1 = (IRosterEntry) e1;
|
||||||
CollaborationUser c2 = (CollaborationUser) e1;
|
IRosterEntry c2 = (IRosterEntry) e1;
|
||||||
return c1.compareTo(c2);
|
return c1.getUser().getFQName()
|
||||||
|
.compareTo(c2.getUser().getFQName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -358,7 +354,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
TableItem item = usersTable.getTable().getItem(
|
TableItem item = usersTable.getTable().getItem(
|
||||||
new Point(e.x, e.y));
|
new Point(e.x, e.y));
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
CollaborationUser user = (CollaborationUser) item.getData();
|
IRosterEntry user = (IRosterEntry) item.getData();
|
||||||
usersTable.getTable().setToolTipText(
|
usersTable.getTable().setToolTipText(
|
||||||
buildParticipantTooltip(user));
|
buildParticipantTooltip(user));
|
||||||
} else {
|
} else {
|
||||||
|
@ -367,21 +363,15 @@ public class SessionView extends AbstractSessionView {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
List<CollaborationUser> users = new ArrayList<CollaborationUser>();
|
List<IRosterEntry> users = new ArrayList<IRosterEntry>();
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
for (UserId participant : session.getVenue().getParticipants()) {
|
for (UserId participant : session.getVenue().getParticipants()) {
|
||||||
|
CollaborationDataManager manager = CollaborationDataManager
|
||||||
String userId = CollaborationUtils.makeUserId(participant);
|
.getInstance();
|
||||||
CollaborationUser user = new CollaborationUser(userId,
|
IRosterEntry entry = manager.getUsersMap().get(participant);
|
||||||
sessionId);
|
if (entry != null) {
|
||||||
if (user.getType() == Type.UNKNOWN) {
|
users.add(manager.getUsersMap().get(participant));
|
||||||
// Unknown user assume mode/type
|
|
||||||
user.setPresence(new Presence(Mode.AVAILABLE,
|
|
||||||
Type.AVAILABLE, ""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
user.setText(participant.getFQName());
|
|
||||||
users.add(user);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
participantsLabel.setEnabled(false);
|
participantsLabel.setEnabled(false);
|
||||||
|
@ -393,11 +383,12 @@ public class SessionView extends AbstractSessionView {
|
||||||
((GridData) usersComp.getLayoutData()).exclude = true;
|
((GridData) usersComp.getLayoutData()).exclude = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String buildParticipantTooltip(CollaborationUser user) {
|
protected String buildParticipantTooltip(IRosterEntry user) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("Status : ").append(user.getMode().getMode())
|
builder.append("Status : ")
|
||||||
.append("\n");
|
.append(user.getPresence().getMode().getMode()).append("\n");
|
||||||
builder.append("Message : \"").append(user.getStatusMessage());
|
builder.append("Message : \"").append(
|
||||||
|
user.getPresence().getStatusMessage());
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,28 +631,20 @@ public class SessionView extends AbstractSessionView {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void participantArrived(UserId participant) {
|
private void participantArrived(UserId participant) {
|
||||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||||
.getInput();
|
IRosterEntry user = CollaborationDataManager.getInstance()
|
||||||
String name = participant.getFQName();
|
.getUsersMap().get(participant);
|
||||||
String userId = CollaborationUtils.makeUserId(participant);
|
|
||||||
for (CollaborationUser user : users) {
|
|
||||||
if (userId.equals(user.getId())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CollaborationUser user = new CollaborationUser(userId, sessionId);
|
|
||||||
user.setText(name);
|
|
||||||
users.add(user);
|
users.add(user);
|
||||||
usersTable.refresh();
|
usersTable.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void participantDeparted(UserId participant) {
|
private void participantDeparted(UserId participant) {
|
||||||
String userId = CollaborationUtils.makeUserId(participant);
|
System.out.println("++++ handle departed here: "
|
||||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
+ participant.getName() + ", " + participant.getFQName());
|
||||||
.getInput();
|
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||||
for (int i = 0; i < users.size(); ++i) {
|
for (int i = 0; i < users.size(); ++i) {
|
||||||
if (userId.equals(users.get(i).getId())) {
|
if (participant.equals(users.get(i).getUser())) {
|
||||||
users.remove(i);
|
users.remove(i);
|
||||||
usersTable.refresh();
|
usersTable.refresh();
|
||||||
break;
|
break;
|
||||||
|
@ -679,9 +662,6 @@ public class SessionView extends AbstractSessionView {
|
||||||
// Ignore the presence's mode/type. May not be the same as the user's.
|
// 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
|
// TODO Keep as a place holder for now since it may be needed to set
|
||||||
// leader/provider roles.
|
// leader/provider roles.
|
||||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||||
.getInput();
|
|
||||||
String name = participant.getFQName();
|
|
||||||
String userId = CollaborationUtils.makeUserId(participant);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,9 @@ import java.util.List;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||||
|
|
||||||
|
@ -56,12 +57,10 @@ public class SharedDisplayParticipantsLabelProvider extends
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
ISharedDisplaySession sdSession = SharedDisplaySessionMgr
|
ISharedDisplaySession sdSession = SharedDisplaySessionMgr
|
||||||
.getSessionContainer(sessionId).getSession();
|
.getSessionContainer(sessionId).getSession();
|
||||||
CollaborationUser user = (CollaborationUser) element;
|
IRosterEntry user = (IRosterEntry) element;
|
||||||
String userId = user.getId();
|
UserId userId = user.getUser();
|
||||||
String sessionLeaderId = CollaborationUtils.makeUserId(sdSession
|
UserId sessionLeaderId = sdSession.getCurrentSessionLeader();
|
||||||
.getCurrentSessionLeader());
|
UserId dataProviderId = sdSession.getCurrentDataProvider();
|
||||||
String dataProviderId = CollaborationUtils.makeUserId(sdSession
|
|
||||||
.getCurrentDataProvider());
|
|
||||||
List<SharedDisplayRole> roleList = new ArrayList<SharedDisplayRole>();
|
List<SharedDisplayRole> roleList = new ArrayList<SharedDisplayRole>();
|
||||||
if (userId.equals(sessionLeaderId)) {
|
if (userId.equals(sessionLeaderId)) {
|
||||||
roleList.add(SharedDisplayRole.SESSION_LEADER);
|
roleList.add(SharedDisplayRole.SESSION_LEADER);
|
||||||
|
@ -86,24 +85,25 @@ public class SharedDisplayParticipantsLabelProvider extends
|
||||||
* -
|
* -
|
||||||
* @return image - modified with indicator(s)
|
* @return image - modified with indicator(s)
|
||||||
*/
|
*/
|
||||||
private Image getModifier(List<SharedDisplayRole> roles,
|
private Image getModifier(List<SharedDisplayRole> roles, IRosterEntry user) {
|
||||||
CollaborationUser user) {
|
// String key = user.getImageKey();
|
||||||
String key = user.getImageKey();
|
String key = "";
|
||||||
StringBuilder modKey = new StringBuilder(key);
|
StringBuilder modKey = new StringBuilder(key);
|
||||||
int roleCnt = 0;
|
int roleCnt = 0;
|
||||||
if (roles.contains(SharedDisplayRole.SESSION_LEADER)) {
|
if (roles.contains(SharedDisplayRole.SESSION_LEADER)) {
|
||||||
++roleCnt;
|
++roleCnt;
|
||||||
modKey.append(":")
|
modKey.append(":").append(
|
||||||
.append(SharedDisplayRole.SESSION_LEADER.toString());
|
SharedDisplayRole.SESSION_LEADER.toString());
|
||||||
}
|
}
|
||||||
if (roles.contains(SharedDisplayRole.DATA_PROVIDER)) {
|
if (roles.contains(SharedDisplayRole.DATA_PROVIDER)) {
|
||||||
++roleCnt;
|
++roleCnt;
|
||||||
modKey.append(":").append(SharedDisplayRole.DATA_PROVIDER.toString());
|
modKey.append(":").append(
|
||||||
|
SharedDisplayRole.DATA_PROVIDER.toString());
|
||||||
}
|
}
|
||||||
Image image = imageMap.get(modKey.toString());
|
Image image = imageMap.get(modKey.toString());
|
||||||
|
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
image = CollaborationUtils.getNodeImage(user);
|
image = CollaborationUtils.getNodeImage(key);
|
||||||
// original image is 16x16
|
// original image is 16x16
|
||||||
image.getImageData();
|
image.getImageData();
|
||||||
imageMap.put(modKey.toString(), image);
|
imageMap.put(modKey.toString(), image);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
|
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
|
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -81,7 +82,7 @@ public interface IVenueSession extends ISession {
|
||||||
* The intended subject of the venue conversation.
|
* The intended subject of the venue conversation.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void sendInvitation(String id, VenueInvite invite)
|
public void sendInvitation(UserId id, VenueInvite invite)
|
||||||
throws CollaborationException;
|
throws CollaborationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,7 +94,7 @@ public interface IVenueSession extends ISession {
|
||||||
* Any text that the user may wish to include.
|
* Any text that the user may wish to include.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void sendInvitation(List<String> ids, VenueInvite invite)
|
public void sendInvitation(List<UserId> ids, VenueInvite invite)
|
||||||
throws CollaborationException;
|
throws CollaborationException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ public interface IRoster {
|
||||||
* @param nickName
|
* @param nickName
|
||||||
* @param groups
|
* @param groups
|
||||||
*/
|
*/
|
||||||
void sendRosterAdd(String account, String nickName, String[] groups)
|
void sendRosterAdd(UserId account, String[] groups)
|
||||||
throws CollaborationException;
|
throws CollaborationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -81,7 +81,7 @@ public interface IRosterManager {
|
||||||
* @param nickName
|
* @param nickName
|
||||||
* @param groups
|
* @param groups
|
||||||
*/
|
*/
|
||||||
void sendRosterAdd(String account, String nickName, String[] groups)
|
void sendRosterAdd(UserId account, String[] groups)
|
||||||
throws CollaborationException;
|
throws CollaborationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -231,7 +231,6 @@ public class Roster extends RosterItem implements IRoster {
|
||||||
// so update with the presence.
|
// so update with the presence.
|
||||||
RosterEntry ret = (RosterEntry) re;
|
RosterEntry ret = (RosterEntry) re;
|
||||||
ret.setPresence(entry.getPresence());
|
ret.setPresence(entry.getPresence());
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// nothing to do. And this shouldn't happen!
|
// nothing to do. And this shouldn't happen!
|
||||||
|
@ -257,9 +256,9 @@ public class Roster extends RosterItem implements IRoster {
|
||||||
* @param groups
|
* @param groups
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendRosterAdd(String account, String nickName, String[] groups)
|
public void sendRosterAdd(UserId account, String[] groups)
|
||||||
throws CollaborationException {
|
throws CollaborationException {
|
||||||
rosterManager.sendRosterAdd(account, nickName, groups);
|
rosterManager.sendRosterAdd(account, groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -340,5 +339,4 @@ public class Roster extends RosterItem implements IRoster {
|
||||||
System.out
|
System.out
|
||||||
.println("##########################################################################");
|
.println("##########################################################################");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.collaboration.comm.provider.roster;
|
package com.raytheon.uf.viz.collaboration.comm.provider.roster;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.ecf.core.identity.ID;
|
import org.eclipse.ecf.core.identity.ID;
|
||||||
import org.eclipse.ecf.core.util.ECFException;
|
import org.eclipse.ecf.core.util.ECFException;
|
||||||
|
@ -31,6 +33,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener;
|
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
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.roster.IRosterEntry;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||||
|
@ -127,7 +130,7 @@ public class RosterManager implements IRosterManager {
|
||||||
* @param groups
|
* @param groups
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendRosterAdd(String account, String nickName, String[] groups)
|
public void sendRosterAdd(UserId account, String[] groups)
|
||||||
throws CollaborationException {
|
throws CollaborationException {
|
||||||
org.eclipse.ecf.presence.roster.IRosterManager manager = baseRoster
|
org.eclipse.ecf.presence.roster.IRosterManager manager = baseRoster
|
||||||
.getPresenceContainerAdapter().getRosterManager();
|
.getPresenceContainerAdapter().getRosterManager();
|
||||||
|
@ -136,7 +139,8 @@ public class RosterManager implements IRosterManager {
|
||||||
.getRosterSubscriptionSender();
|
.getRosterSubscriptionSender();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sender.sendRosterAdd(account, nickName, groups);
|
sender.sendRosterAdd(account.getFQName(), account.getAlias(),
|
||||||
|
groups);
|
||||||
} catch (ECFException e) {
|
} catch (ECFException e) {
|
||||||
throw new CollaborationException();
|
throw new CollaborationException();
|
||||||
}
|
}
|
||||||
|
@ -157,7 +161,7 @@ public class RosterManager implements IRosterManager {
|
||||||
IRosterSubscriptionSender sender = manager
|
IRosterSubscriptionSender sender = manager
|
||||||
.getRosterSubscriptionSender();
|
.getRosterSubscriptionSender();
|
||||||
|
|
||||||
ID id = sessionManager.createID(userId.getFQName());
|
ID id = sessionManager.createID(userId);
|
||||||
try {
|
try {
|
||||||
sender.sendRosterRemove(id);
|
sender.sendRosterRemove(id);
|
||||||
} catch (ECFException e) {
|
} catch (ECFException e) {
|
||||||
|
@ -189,6 +193,22 @@ public class RosterManager implements IRosterManager {
|
||||||
*/
|
*/
|
||||||
public void updateEntry(IRosterEntry entry) {
|
public void updateEntry(IRosterEntry entry) {
|
||||||
IRosterEntry modified = roster.modifyRosterEntry(entry);
|
IRosterEntry modified = roster.modifyRosterEntry(entry);
|
||||||
|
IPresenceContainerAdapter adapter = baseRoster
|
||||||
|
.getPresenceContainerAdapter();
|
||||||
|
org.eclipse.ecf.presence.roster.IRosterManager manager = adapter
|
||||||
|
.getRosterManager();
|
||||||
|
List<String> groups = new ArrayList<String>();
|
||||||
|
for (IRosterGroup grp : entry.getGroups()) {
|
||||||
|
groups.add(grp.getName());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
manager.getRosterSubscriptionSender().sendRosterAdd(
|
||||||
|
entry.getUser().getFQName(), entry.getUser().getAlias(),
|
||||||
|
groups.toArray(new String[0]));
|
||||||
|
} catch (ECFException e) {
|
||||||
|
// TODO handle better
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if (modified != null) {
|
if (modified != null) {
|
||||||
sessionManager.getEventPublisher().post(entry);
|
sessionManager.getEventPublisher().post(entry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class CollaborationConnection implements IEventPublisher {
|
||||||
|
|
||||||
private Map<String, ISession> sessions;
|
private Map<String, ISession> sessions;
|
||||||
|
|
||||||
private String account;
|
private UserId account;
|
||||||
|
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ public class CollaborationConnection implements IEventPublisher {
|
||||||
* @throws ContainerCreateException
|
* @throws ContainerCreateException
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public CollaborationConnection(String account, String password)
|
public CollaborationConnection(UserId account, String password)
|
||||||
throws CollaborationException {
|
throws CollaborationException {
|
||||||
this(account, password, (IRosterEventSubscriber) null);
|
this(account, password, (IRosterEventSubscriber) null);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ public class CollaborationConnection implements IEventPublisher {
|
||||||
* @throws ContainerCreateException
|
* @throws ContainerCreateException
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public CollaborationConnection(String account, String password,
|
public CollaborationConnection(UserId account, String password,
|
||||||
IPresence initialPresence) throws Exception {
|
IPresence initialPresence) throws Exception {
|
||||||
this(account, password, (IRosterEventSubscriber) null);
|
this(account, password, (IRosterEventSubscriber) null);
|
||||||
if (accountManager != null) {
|
if (accountManager != null) {
|
||||||
|
@ -194,7 +194,7 @@ public class CollaborationConnection implements IEventPublisher {
|
||||||
* A roster event subscriber.
|
* A roster event subscriber.
|
||||||
* @throws CollaborationException
|
* @throws CollaborationException
|
||||||
*/
|
*/
|
||||||
public CollaborationConnection(String account, String password,
|
public CollaborationConnection(UserId account, String password,
|
||||||
IRosterEventSubscriber rosterEventSubscriber)
|
IRosterEventSubscriber rosterEventSubscriber)
|
||||||
throws CollaborationException {
|
throws CollaborationException {
|
||||||
eventBus = new EventBus();
|
eventBus = new EventBus();
|
||||||
|
@ -315,7 +315,7 @@ public class CollaborationConnection implements IEventPublisher {
|
||||||
*
|
*
|
||||||
* @return The account string.
|
* @return The account string.
|
||||||
*/
|
*/
|
||||||
public String getAccount() {
|
public UserId getAccount() {
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,10 +422,7 @@ public class CollaborationConnection implements IEventPublisher {
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
session.joinVenue(venueName);
|
session.joinVenue(venueName);
|
||||||
|
|
||||||
String name = Tools.parseName(account);
|
session.setUserId(account);
|
||||||
String host = Tools.parseHost(account);
|
|
||||||
UserId me = new UserId(name, host);
|
|
||||||
session.setUserId(me);
|
|
||||||
if (invitation.getInvite() instanceof SharedDisplayVenueInvite) {
|
if (invitation.getInvite() instanceof SharedDisplayVenueInvite) {
|
||||||
SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation
|
SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation
|
||||||
.getInvite();
|
.getInvite();
|
||||||
|
@ -455,14 +452,9 @@ public class CollaborationConnection implements IEventPublisher {
|
||||||
session = new SharedDisplaySession(container, eventBus, this);
|
session = new SharedDisplaySession(container, eventBus, this);
|
||||||
|
|
||||||
session.createVenue(venueName, subject);
|
session.createVenue(venueName, subject);
|
||||||
String name = Tools.parseName(account);
|
session.setCurrentSessionLeader(account);
|
||||||
String host = Tools.parseHost(account);
|
session.setCurrentDataProvider(account);
|
||||||
|
session.setUserId(account);
|
||||||
UserId me = new UserId(name, host);
|
|
||||||
|
|
||||||
session.setCurrentSessionLeader(me);
|
|
||||||
session.setCurrentDataProvider(me);
|
|
||||||
session.setUserId(me);
|
|
||||||
|
|
||||||
sessions.put(session.getSessionId(), session);
|
sessions.put(session.getSessionId(), session);
|
||||||
return session;
|
return session;
|
||||||
|
@ -741,11 +733,12 @@ public class CollaborationConnection implements IEventPublisher {
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ID createID(String name) throws CollaborationException {
|
public ID createID(UserId name) throws CollaborationException {
|
||||||
ID id = null;
|
ID id = null;
|
||||||
try {
|
try {
|
||||||
if (connectionNamespace != null) {
|
if (connectionNamespace != null) {
|
||||||
id = IDFactory.getDefault().createID(connectionNamespace, name);
|
id = IDFactory.getDefault().createID(connectionNamespace,
|
||||||
|
name.getFQName());
|
||||||
}
|
}
|
||||||
} catch (IDCreateException idce) {
|
} catch (IDCreateException idce) {
|
||||||
throw new CollaborationException("Could not create id");
|
throw new CollaborationException("Could not create id");
|
||||||
|
|
|
@ -233,7 +233,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
||||||
* java.lang.String, java.lang.String, java.lang.String)
|
* java.lang.String, java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendInvitation(String id, VenueInvite invite)
|
public void sendInvitation(UserId id, VenueInvite invite)
|
||||||
throws CollaborationException {
|
throws CollaborationException {
|
||||||
IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
|
IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
|
||||||
.getChatRoomManager().getInvitationSender();
|
.getChatRoomManager().getInvitationSender();
|
||||||
|
@ -241,7 +241,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
||||||
String msgBody = Tools.marshallData(invite);
|
String msgBody = Tools.marshallData(invite);
|
||||||
ID roomId = venueInfo.getConnectedID();
|
ID roomId = venueInfo.getConnectedID();
|
||||||
ID userId = IDFactory.getDefault().createID(
|
ID userId = IDFactory.getDefault().createID(
|
||||||
getConnectionNamespace(), id);
|
getConnectionNamespace(), id.getFQName());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sender.sendInvitation(roomId, userId, invite.getSubject(),
|
sender.sendInvitation(roomId, userId, invite.getSubject(),
|
||||||
|
@ -267,10 +267,10 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
||||||
* java.lang.String, java.lang.String, java.lang.String)
|
* java.lang.String, java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendInvitation(List<String> ids, VenueInvite invite)
|
public void sendInvitation(List<UserId> ids, VenueInvite invite)
|
||||||
throws CollaborationException {
|
throws CollaborationException {
|
||||||
if (ids != null) {
|
if (ids != null) {
|
||||||
for (String id : ids) {
|
for (UserId id : ids) {
|
||||||
sendInvitation(id, invite);
|
sendInvitation(id, invite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,8 +450,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
||||||
|
|
||||||
String name = Tools.parseName(from.getName());
|
String name = Tools.parseName(from.getName());
|
||||||
|
|
||||||
String account = getSessionManager().getAccount();
|
UserId account = getSessionManager().getAccount();
|
||||||
String aName = Tools.parseName(account);
|
String aName = account.getFQName();
|
||||||
if (aName.equals(name)) {
|
if (aName.equals(name)) {
|
||||||
acceptMessage = false;
|
acceptMessage = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class UserId implements IQualifiedID {
|
||||||
public UserId(String userName, String hostName, String resource,
|
public UserId(String userName, String hostName, String resource,
|
||||||
String alias) {
|
String alias) {
|
||||||
this.name = userName;
|
this.name = userName;
|
||||||
this.host = hostName;
|
setHost(hostName);
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
}
|
}
|
||||||
|
@ -112,8 +112,11 @@ public class UserId implements IQualifiedID {
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHostName(java.lang.String)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHostName(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setHost(String hostName) {
|
public void setHost(String hostname) {
|
||||||
host = hostName;
|
if (hostname.startsWith(CONF_ID)) {
|
||||||
|
hostname = hostname.substring(CONF_ID.length());
|
||||||
|
}
|
||||||
|
host = hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,11 +158,7 @@ public class UserId implements IQualifiedID {
|
||||||
public String getFQName() {
|
public String getFQName() {
|
||||||
StringBuilder sb = new StringBuilder(name);
|
StringBuilder sb = new StringBuilder(name);
|
||||||
sb.append("@");
|
sb.append("@");
|
||||||
String hostname = host;
|
sb.append(host);
|
||||||
if (hostname.startsWith(CONF_ID)) {
|
|
||||||
hostname = hostname.substring(CONF_ID.length());
|
|
||||||
}
|
|
||||||
sb.append(hostname);
|
|
||||||
sb.append("/");
|
sb.append("/");
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
sb.append(resource);
|
sb.append(resource);
|
||||||
|
|
Loading…
Add table
Reference in a new issue