Issue #244 Roster groups now display and improved presents.
Change-Id: I7965201692cab4472ce85d2525e39cf3823ab16f Former-commit-id:b4aa83517d
[formerlybf55bc0d86
] [formerlyb4aa83517d
[formerlybf55bc0d86
] [formerlyc27ee0903c
[formerly 7f4e485aae341b11beb4a55c895a86cd6ff13635]]] Former-commit-id:c27ee0903c
Former-commit-id:8bda505069
[formerlyfbdf4d5c37
] Former-commit-id:5a22143834
This commit is contained in:
parent
9f25ebc259
commit
807547cb8d
8 changed files with 232 additions and 177 deletions
Binary file not shown.
After Width: | Height: | Size: 313 B |
|
@ -36,6 +36,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
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.IPresence.Type;
|
||||
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.provider.session.SessionManager;
|
||||
|
@ -189,6 +190,7 @@ public class CollaborationDataManager {
|
|||
.getInstance().getUser(loginId);
|
||||
// TODO set mode and message here.
|
||||
user.setMode(loginData.getMode());
|
||||
user.type = Type.AVAILABLE;
|
||||
user.statusMessage = loginData.getModeMessage();
|
||||
wbListener = new IWorkbenchListener() {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
|
@ -64,7 +65,10 @@ public class CollaborationUser extends CollaborationNode implements
|
|||
*/
|
||||
@Override
|
||||
public String getImageKey() {
|
||||
return getMode().toString();
|
||||
if (getType() == Type.AVAILABLE) {
|
||||
return getMode().toString();
|
||||
}
|
||||
return "contact_disabled";
|
||||
}
|
||||
|
||||
public DataUser.RoleType[] getRoles(String session) {
|
||||
|
@ -91,10 +95,18 @@ public class CollaborationUser extends CollaborationNode implements
|
|||
return CollaborationDataManager.getInstance().getUser(id).mode;
|
||||
}
|
||||
|
||||
public IPresence.Type getType() {
|
||||
return CollaborationDataManager.getInstance().getUser(id).type;
|
||||
}
|
||||
|
||||
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 =
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||
|
||||
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
|
||||
|
@ -86,6 +87,8 @@ public class DataUser {
|
|||
|
||||
IPresence.Mode mode;
|
||||
|
||||
IPresence.Type type;
|
||||
|
||||
String statusMessage;
|
||||
|
||||
Map<String, List<RoleType>> roleMap;
|
||||
|
@ -115,6 +118,7 @@ public class DataUser {
|
|||
groupsMap = new HashMap<String, DataGroup>();
|
||||
sessionsMap = new HashMap<String, String>();
|
||||
mode = Mode.EXTENDED_AWAY;
|
||||
type = Type.UNKNOWN;
|
||||
roleMap = new HashMap<String, List<RoleType>>();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ import org.eclipse.swt.events.FocusEvent;
|
|||
import org.eclipse.swt.events.FocusListener;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseTrackAdapter;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -56,6 +59,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.TreeItem;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IEditorReference;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
|
@ -69,7 +73,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
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.Mode;
|
||||
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.info.IVenueInfo;
|
||||
|
@ -223,7 +226,6 @@ public class CollaborationGroupView extends ViewPart {
|
|||
public void run() {
|
||||
CollaborationDataManager.getInstance().setLinkCollaboration(
|
||||
isChecked());
|
||||
// createPrivateChat();
|
||||
}
|
||||
};
|
||||
linkToEditorAction.setImageDescriptor(CollaborationUtils
|
||||
|
@ -234,7 +236,11 @@ public class CollaborationGroupView extends ViewPart {
|
|||
inviteAction = new Action("Invite...") {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("Invite...");
|
||||
System.out.println("Invite... to join room " + getId());
|
||||
String sessionId = getId();
|
||||
IVenueSession session = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId);
|
||||
// session.sendInvitation(invitation)
|
||||
};
|
||||
};
|
||||
inviteAction.setImageDescriptor(CollaborationUtils
|
||||
|
@ -656,7 +662,7 @@ public class CollaborationGroupView extends ViewPart {
|
|||
// CollaborationData.getInstance().getClient()
|
||||
// .getConnectNamespace(), "abc@awipscm.omaha.us.ray.com");
|
||||
// users.add(id);
|
||||
|
||||
System.err.println("createPrivateChat with " + user);
|
||||
try {
|
||||
// if (users.size() > 0) {
|
||||
// CollaborationUtils.createChat(users);
|
||||
|
@ -699,6 +705,35 @@ public class CollaborationGroupView extends ViewPart {
|
|||
usersTreeViewer.setInput(topLevel);
|
||||
|
||||
treeEditor = new TreeEditor(usersTreeViewer.getTree());
|
||||
usersTreeViewer.getTree().addMouseTrackListener(
|
||||
new MouseTrackAdapter() {
|
||||
@Override
|
||||
public void mouseHover(MouseEvent e) {
|
||||
TreeItem item = usersTreeViewer.getTree().getItem(
|
||||
new Point(e.x, e.y));
|
||||
if (item != null) {
|
||||
CollaborationNode node = (CollaborationNode) item
|
||||
.getData();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ID: ").append(node.getId())
|
||||
.append("\n");
|
||||
if (node instanceof CollaborationUser) {
|
||||
CollaborationUser user = (CollaborationUser) node;
|
||||
builder.append("Mode: ").append(user.getMode())
|
||||
.append("\n");
|
||||
builder.append("Type: ").append(user.getType())
|
||||
.append("\n");
|
||||
builder.append("Message: \"")
|
||||
.append(user.getStatusMessage())
|
||||
.append("\"\n");
|
||||
}
|
||||
usersTreeViewer.getTree().setToolTipText(
|
||||
builder.toString());
|
||||
} else {
|
||||
usersTreeViewer.getTree().setToolTipText("");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void createContextMenu() {
|
||||
|
@ -749,7 +784,7 @@ public class CollaborationGroupView extends ViewPart {
|
|||
Map<String, IVenueSession> sessions = CollaborationDataManager
|
||||
.getInstance().getSessions();
|
||||
for (String name : sessions.keySet()) {
|
||||
ISession session = sessions.get(name);
|
||||
final ISession session = sessions.get(name);
|
||||
if (session != null) {
|
||||
final IVenueInfo info = sessions.get(name).getVenue()
|
||||
.getInfo();
|
||||
|
@ -764,8 +799,8 @@ public class CollaborationGroupView extends ViewPart {
|
|||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
joinAction.setId(info.getVenueID());
|
||||
joinAction.run();
|
||||
inviteAction.setId(session.getSessionId());
|
||||
inviteAction.run();
|
||||
}
|
||||
};
|
||||
action.setId(info.getVenueID());
|
||||
|
@ -803,8 +838,8 @@ public class CollaborationGroupView extends ViewPart {
|
|||
usersTreeViewer.getTree().setEnabled(false);
|
||||
return;
|
||||
}
|
||||
LoginUser user = new LoginUser(CollaborationDataManager.getInstance()
|
||||
.getLoginId());
|
||||
|
||||
LoginUser user = new LoginUser(manager.getLoginId());
|
||||
topLevel.addChild(user);
|
||||
activeSessionGroup = new SessionGroup("Active Sessions");
|
||||
activeSessionGroup.setSessionRoot(true);
|
||||
|
@ -860,6 +895,7 @@ public class CollaborationGroupView extends ViewPart {
|
|||
int rsize = -1;
|
||||
int gsize = -1;
|
||||
if (roster != null) {
|
||||
// TODO remove DEBUG start
|
||||
if (roster.getUser() != null) {
|
||||
name = roster.getUser().getName();
|
||||
}
|
||||
|
@ -871,51 +907,65 @@ public class CollaborationGroupView extends ViewPart {
|
|||
}
|
||||
System.out.println("rosterManager Name " + name + ": group size "
|
||||
+ gsize + ": entry size " + rsize);
|
||||
// TODO DEBUG end remove
|
||||
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
||||
if (rosterGroup != null) {
|
||||
populateGroup(topLevel, rosterGroup);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Are these buddies not in a group that need to be displayed?
|
||||
if (roster.getEntries() != null && roster.getEntries().size() > 0) {
|
||||
for (IRosterEntry e : roster.getEntries()) {
|
||||
System.out.println(name + " entry: "
|
||||
+ e.getUser().getName() + "@"
|
||||
+ e.getUser().getHost() + "/"
|
||||
+ e.getUser().getResource());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO get Groups from server.
|
||||
for (String g : new String[] { "Mybuddy1", "buddy1" }) {
|
||||
CollaborationGroup group = new CollaborationGroup(g);
|
||||
group.setLocal(true);
|
||||
group.setModifiable(true);
|
||||
topLevel.addChild(group);
|
||||
for (String u : new String[] {
|
||||
"jkorman@awipscm.omaha.us.ray.com",
|
||||
"abc@awipscm.omaha.us.ray.com",
|
||||
"mnash@awipscm.omaha.us.ray.com" }) {
|
||||
CollaborationUser item = new CollaborationUser(u);
|
||||
group.addChild(item);
|
||||
item.setMode(Mode.AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO get from server
|
||||
for (String g : new String[] { "OAX", "DSM", "LBF", "FSD" }) {
|
||||
CollaborationGroup group = new CollaborationGroup(g);
|
||||
group.setLocal(false);
|
||||
topLevel.addChild(group);
|
||||
for (String u : new String[] { g + "_user2", g + "_user3",
|
||||
g + "_user1" }) {
|
||||
CollaborationUser item = new CollaborationUser(u);
|
||||
group.addChild(item);
|
||||
item.setMode(Mode.AWAY);
|
||||
}
|
||||
}
|
||||
// for (String g : new String[] { "Mybuddy1", "buddy1" }) {
|
||||
// CollaborationGroup group = new CollaborationGroup(g);
|
||||
// group.setLocal(true);
|
||||
// group.setModifiable(true);
|
||||
// topLevel.addChild(group);
|
||||
// for (String u : new String[] {
|
||||
// "jkorman@awipscm.omaha.us.ray.com",
|
||||
// "abc@awipscm.omaha.us.ray.com",
|
||||
// "mnash@awipscm.omaha.us.ray.com" }) {
|
||||
// CollaborationUser item = new CollaborationUser(u);
|
||||
// group.addChild(item);
|
||||
// item.setMode(Mode.AVAILABLE);
|
||||
// item.setType(Type.AVAILABLE);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // TODO get from server
|
||||
// for (String g : new String[] { "OAX", "DSM", "LBF", "FSD" }) {
|
||||
// CollaborationGroup group = new CollaborationGroup(g);
|
||||
// group.setLocal(false);
|
||||
// topLevel.addChild(group);
|
||||
// for (String u : new String[] { g + "_user2", g + "_user3",
|
||||
// g + "_user1" }) {
|
||||
// CollaborationUser item = new CollaborationUser(u);
|
||||
// group.addChild(item);
|
||||
// item.setMode(Mode.AWAY);
|
||||
// item.setType(Type.AVAILABLE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
CollaborationUser me = new CollaborationUser("OAX_rferrel");
|
||||
me.setMode(Mode.AVAILABLE);
|
||||
for (CollaborationNode node : topLevel.getChildren()) {
|
||||
if ("OAX".equals(node.getId())) {
|
||||
((CollaborationGroup) node).addChild(me);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// CollaborationUser me = new CollaborationUser("OAX_rferrel");
|
||||
// me.setMode(Mode.AVAILABLE);
|
||||
// me.setType(Type.AVAILABLE);
|
||||
// for (CollaborationNode node : topLevel.getChildren()) {
|
||||
// if ("OAX".equals(node.getId())) {
|
||||
// ((CollaborationGroup) node).addChild(me);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -932,8 +982,8 @@ public class CollaborationGroupView extends ViewPart {
|
|||
CollaborationGroup groupNode = new CollaborationGroup(
|
||||
rosterGroup.getName());
|
||||
// TODO determine if group is modifiable (User) or System group.
|
||||
groupNode.setLocal(true);
|
||||
groupNode.setModifiable(true);
|
||||
groupNode.setLocal(false);
|
||||
groupNode.setModifiable(false);
|
||||
parent.addChild(groupNode);
|
||||
System.out.println("group Name " + rosterGroup.getName() + ": entries "
|
||||
+ rosterGroup.getEntries());
|
||||
|
@ -944,7 +994,12 @@ public class CollaborationGroupView extends ViewPart {
|
|||
}
|
||||
|
||||
for (IRosterEntry e : rosterGroup.getEntries()) {
|
||||
CollaborationUser child = new CollaborationUser(e.getName());
|
||||
CollaborationUser child = new CollaborationUser(e.getUser()
|
||||
.getFQName());
|
||||
IPresence presence = e.getPresence();
|
||||
child.setMode(presence.getMode());
|
||||
child.setType(presence.getType());
|
||||
child.setStatusMessage(presence.getStatusMessage());
|
||||
groupNode.addChild(child);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroup;
|
||||
|
||||
/**
|
||||
* Methods for sending, receiving messages
|
||||
|
@ -105,31 +102,33 @@ public class CollaborationUtils {
|
|||
* @return image
|
||||
*/
|
||||
public static Image getNodeImage(CollaborationNode node) {
|
||||
Image nodeImage = null;
|
||||
if (node instanceof CollaborationUser) {
|
||||
CollaborationUser user = (CollaborationUser) node;
|
||||
if (user.getMode() == IPresence.Mode.AVAILABLE) {
|
||||
nodeImage = getImageDescriptor("available.gif").createImage();
|
||||
} else if (user.getMode() == IPresence.Mode.AWAY) {
|
||||
nodeImage = getImageDescriptor("away.gif").createImage();
|
||||
} else if (user.getMode() == IPresence.Mode.DND) {
|
||||
nodeImage = getImageDescriptor("do_not_disturb.gif")
|
||||
.createImage();
|
||||
} else {
|
||||
nodeImage = getImageDescriptor("available.gif").createImage();
|
||||
}
|
||||
} else if (node instanceof SessionGroup) {
|
||||
if (!((SessionGroup) node).isSessionRoot()) {
|
||||
nodeImage = getImageDescriptor("session_group.gif")
|
||||
.createImage();
|
||||
} else {
|
||||
// nodeImage = getImageDescriptor("").createImage();
|
||||
|
||||
}
|
||||
} else if (node instanceof CollaborationGroup) {
|
||||
nodeImage = getImageDescriptor("group.gif").createImage();
|
||||
}
|
||||
return nodeImage;
|
||||
// Image nodeImage = null;
|
||||
String name = node.getImageKey().toLowerCase() + ".gif";
|
||||
return getImageDescriptor(name).createImage();
|
||||
// if (node instanceof CollaborationUser) {
|
||||
// CollaborationUser user = (CollaborationUser) node;
|
||||
// if (user.getMode() == IPresence.Mode.AVAILABLE) {
|
||||
// nodeImage = getImageDescriptor("available.gif").createImage();
|
||||
// } else if (user.getMode() == IPresence.Mode.AWAY) {
|
||||
// nodeImage = getImageDescriptor("away.gif").createImage();
|
||||
// } else if (user.getMode() == IPresence.Mode.DND) {
|
||||
// nodeImage = getImageDescriptor("do_not_disturb.gif")
|
||||
// .createImage();
|
||||
// } else {
|
||||
// nodeImage = getImageDescriptor("available.gif").createImage();
|
||||
// }
|
||||
// } else if (node instanceof SessionGroup) {
|
||||
// if (!((SessionGroup) node).isSessionRoot()) {
|
||||
// nodeImage = getImageDescriptor("session_group.gif")
|
||||
// .createImage();
|
||||
// } else {
|
||||
// // nodeImage = getImageDescriptor("").createImage();
|
||||
//
|
||||
// }
|
||||
// } else if (node instanceof CollaborationGroup) {
|
||||
// nodeImage = getImageDescriptor("group.gif").createImage();
|
||||
// }
|
||||
// return nodeImage;
|
||||
}
|
||||
|
||||
public static void sendChatMessage(List<String> ids, String message) {
|
||||
|
|
|
@ -19,8 +19,11 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.session;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||
import org.eclipse.jface.viewers.ITableColorProvider;
|
||||
|
@ -57,18 +60,27 @@ import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
|||
public class ParticipantsLabelProvider implements ITableColorProvider,
|
||||
ITableFontProvider, ITableLabelProvider {
|
||||
|
||||
private List<ILabelProviderListener> listeners;
|
||||
|
||||
private String sessionId = null;
|
||||
|
||||
private Map<String, Image> imageMap;
|
||||
|
||||
public ParticipantsLabelProvider() {
|
||||
listeners = new ArrayList<ILabelProviderListener>();
|
||||
imageMap = new HashMap<String, Image>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(ILabelProviderListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
for (String key : imageMap.keySet()) {
|
||||
imageMap.get(key).dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,25 +92,36 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
|
||||
@Override
|
||||
public void removeListener(ILabelProviderListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getColumnImage(Object element, int columnIndex) {
|
||||
CollaborationUser user = (CollaborationUser) element;
|
||||
CollaborationDataManager.getInstance().getUser(user.getId());
|
||||
Image image = CollaborationUtils.getNodeImage(user);
|
||||
// user.getRoles(sessionId);
|
||||
RoleType[] types = new RoleType[] { RoleType.LEADER,
|
||||
RoleType.DATA_PROVIDER };
|
||||
return getModifier(types, image);
|
||||
Image image = null;
|
||||
String key = user.getImageKey();
|
||||
if (key != null) {
|
||||
image = imageMap.get(key);
|
||||
if (image == null) {
|
||||
image = CollaborationUtils.getNodeImage(user);
|
||||
if (image != null) {
|
||||
imageMap.put(key, image);
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO Determine user's role and then test getModifier.
|
||||
if (image != null) {
|
||||
RoleType[] types = new RoleType[] { RoleType.LEADER,
|
||||
RoleType.DATA_PROVIDER };
|
||||
image = getModifier(types, user);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnText(Object element, int columnIndex) {
|
||||
CollaborationUser user = (CollaborationUser) element;
|
||||
RoleType[] roles = user.getRoles(sessionId);
|
||||
// RoleType[] roles = user.getRoles(sessionId);
|
||||
return user.getText();
|
||||
}
|
||||
|
||||
|
@ -137,66 +160,39 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
return sessionId;
|
||||
}
|
||||
|
||||
// usersList.setLabelProvider(new LabelProvider() {
|
||||
// public String getText(Object element) {
|
||||
// CollaborationUser user = (CollaborationUser) element;
|
||||
// DataUser.RoleType[] roles = user.getRoles(sessionId);
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// if (roles.length > 0
|
||||
// && roles[0] != DataUser.RoleType.PARTICIPANT) {
|
||||
// sb.append("[");
|
||||
// for (DataUser.RoleType r : roles) {
|
||||
// switch (r) {
|
||||
// case DATA_PROVIDER:
|
||||
// sb.append("D");
|
||||
// break;
|
||||
// case LEADER:
|
||||
// sb.append("L");
|
||||
// break;
|
||||
// default:
|
||||
// sb.append("?");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// sb.append("] - ");
|
||||
// }
|
||||
// sb.append(user.getId());
|
||||
// return sb.toString();
|
||||
// }
|
||||
//
|
||||
// public Image getImage(Object element) {
|
||||
// Image image = null;
|
||||
// if (element instanceof CollaborationNode) {
|
||||
// CollaborationNode node = (CollaborationNode) element;
|
||||
// String key = node.getImageKey();
|
||||
// if (key != null) {
|
||||
// image = imageMap.get(key);
|
||||
// if (image == null) {
|
||||
// image = CollaborationUtils.getNodeImage(node);
|
||||
// imageMap.put(key, image);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return image;
|
||||
// }
|
||||
// });
|
||||
|
||||
private Image getModifier(RoleType[] types, Image image) {
|
||||
// original image is 16x16
|
||||
GC gc = new GC(image, SWT.LEFT_TO_RIGHT);
|
||||
private Image getModifier(RoleType[] types, CollaborationUser user) {
|
||||
String key = user.getImageKey();
|
||||
StringBuilder modKey = new StringBuilder(key);
|
||||
List<RoleType> t = Arrays.asList(types);
|
||||
|
||||
if (t.contains(RoleType.LEADER)) {
|
||||
// Image im = CollaborationUtils.getImageDescriptor(
|
||||
// "session_leader.png").createImage();
|
||||
// gc.drawImage(im, 7, 7);
|
||||
modKey.append(":").append(RoleType.LEADER.toString());
|
||||
}
|
||||
if (t.contains(RoleType.DATA_PROVIDER)) {
|
||||
Image im = CollaborationUtils.getImageDescriptor(
|
||||
"data_provider.png").createImage();
|
||||
gc.drawImage(im, 0, 16);
|
||||
modKey.append(":").append(RoleType.DATA_PROVIDER.toString());
|
||||
}
|
||||
Image image = imageMap.get(modKey.toString());
|
||||
|
||||
if (image == null) {
|
||||
image = CollaborationUtils.getNodeImage(user);
|
||||
// original image is 16x16
|
||||
GC gc = new GC(image, SWT.LEFT_TO_RIGHT);
|
||||
|
||||
if (t.contains(RoleType.LEADER)) {
|
||||
Image im = CollaborationUtils.getImageDescriptor(
|
||||
"session_leader.png").createImage();
|
||||
gc.drawImage(im, 7, 7);
|
||||
im.dispose();
|
||||
}
|
||||
if (t.contains(RoleType.DATA_PROVIDER)) {
|
||||
Image im = CollaborationUtils.getImageDescriptor(
|
||||
"data_provider.png").createImage();
|
||||
gc.drawImage(im, 0, 16);
|
||||
im.dispose();
|
||||
}
|
||||
image.getImageData();
|
||||
imageMap.put(modKey.toString(), image);
|
||||
gc.dispose();
|
||||
}
|
||||
image.getImageData();
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -333,7 +333,12 @@ public class SessionView extends AbstractSessionView {
|
|||
new Point(e.x, e.y));
|
||||
if (item != null) {
|
||||
CollaborationUser user = (CollaborationUser) item.getData();
|
||||
StringBuilder builder = new StringBuilder("-- Roles --");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("mode: ").append(user.getMode())
|
||||
.append("\n");
|
||||
builder.append("type: ").append(user.getType())
|
||||
.append("\n");
|
||||
builder.append("-- Roles --");
|
||||
for (RoleType type : RoleType.values()) {// user.getRoles(sessionId))
|
||||
// {
|
||||
// TODO fake XXX take this out
|
||||
|
@ -354,12 +359,17 @@ public class SessionView extends AbstractSessionView {
|
|||
List<CollaborationUser> users = new ArrayList<CollaborationUser>();
|
||||
if (session != null) {
|
||||
for (IVenueParticipant part : session.getVenue().getParticipants()) {
|
||||
CollaborationUser user = new CollaborationUser(part.getName());
|
||||
// CollaborationUser user = new
|
||||
// CollaborationUser(part.getName());
|
||||
CollaborationUser user = new CollaborationUser(part.getFQName());
|
||||
|
||||
RoleType[] roles = user.getRoles(sessionId);
|
||||
for (RoleType role : roles) {
|
||||
user.addRole(role);
|
||||
}
|
||||
user.setText(part.getName());
|
||||
user.setText(part.getFQName());
|
||||
// user.setMode(mode);
|
||||
// user.setType(Type.AVAILABLE);
|
||||
users.add(user);
|
||||
}
|
||||
} else {
|
||||
|
@ -374,16 +384,11 @@ public class SessionView extends AbstractSessionView {
|
|||
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
// CollaborationDataManager.getInstance().getSession(sessionId)
|
||||
// .unRegisterEventHandler(this);
|
||||
|
||||
// dispose of the images first
|
||||
disposeArrow(highlightedDownArrow);
|
||||
disposeArrow(highlightedRightArrow);
|
||||
disposeArrow(downArrow);
|
||||
disposeArrow(rightArrow);
|
||||
// CollaborationDataManager.getInstance().closeSession(sessionId);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -502,17 +507,6 @@ public class SessionView extends AbstractSessionView {
|
|||
return SESSION_IMAGE_NAME;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void partActivated(IWorkbenchPart part) {
|
||||
// // nothing to do
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void partBroughtToTop(IWorkbenchPart part) {
|
||||
// // TODO
|
||||
// // if link with editor is on, need to activate the editor
|
||||
// }
|
||||
|
||||
// @Override
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -530,16 +524,6 @@ public class SessionView extends AbstractSessionView {
|
|||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void partDeactivated(IWorkbenchPart part) {
|
||||
// // nothing to do
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void partOpened(IWorkbenchPart part) {
|
||||
// // nothing to do
|
||||
// }
|
||||
|
||||
private void createArrows() {
|
||||
int imgWidth = 11;
|
||||
int imgHeight = 11;
|
||||
|
@ -651,7 +635,8 @@ public class SessionView extends AbstractSessionView {
|
|||
break;
|
||||
case UPDATED:
|
||||
System.out.println("---- handle update here: "
|
||||
+ participant.getName());
|
||||
+ participant.getName() + ", "
|
||||
+ participant.getFQName());
|
||||
break;
|
||||
default:
|
||||
System.err.println("Unknown Event type");
|
||||
|
@ -677,7 +662,7 @@ public class SessionView extends AbstractSessionView {
|
|||
|
||||
private void participantDeparted(IVenueParticipant participant) {
|
||||
System.out.println("++++ handle departed here: "
|
||||
+ participant.getName());
|
||||
+ participant.getName() + ", " + participant.getFQName());
|
||||
int index = -1;
|
||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
||||
String name = participant.getName();
|
||||
|
@ -702,9 +687,10 @@ public class SessionView extends AbstractSessionView {
|
|||
private void participantPresenceUpdated(IVenueParticipant participant,
|
||||
IPresence presence) {
|
||||
System.out.println("++++ handle presence updated here: "
|
||||
+ presence.getMode() + ": " + participant.getName());
|
||||
+ presence.getMode() + "/" + presence.getType() + ": "
|
||||
+ participant.getName() + ", " + participant.getFQName());
|
||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
||||
String name = participant.getName();
|
||||
String name = participant.getFQName();
|
||||
int index = -1;
|
||||
for (int i = 0; i < users.length; ++i) {
|
||||
if (name.equals(users[i].getId())) {
|
||||
|
@ -720,5 +706,6 @@ public class SessionView extends AbstractSessionView {
|
|||
user = new CollaborationUser(name);
|
||||
}
|
||||
user.setMode(presence.getMode());
|
||||
user.setType(presence.getType());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue